diff --git a/gajim/common/app.py b/gajim/common/app.py index 4778ffc4c..7f6a6e105 100644 --- a/gajim/common/app.py +++ b/gajim/common/app.py @@ -88,8 +88,6 @@ else: os_info = None # used to cache os information -gmail_domains = ['gmail.com', 'googlemail.com'] - transport_type = {} # list the type of transport last_message_time = {} # list of time of the latest incomming message diff --git a/gajim/common/config.py b/gajim/common/config.py index bb6fd060b..178badb4f 100644 --- a/gajim/common/config.py +++ b/gajim/common/config.py @@ -178,9 +178,6 @@ class Config: 'time_stamp': [ opt_str, '[%X] ', _('This option let you customize timestamp that is printed in conversation. For exemple "[%H:%M] " will show "[hour:minute] ". See python doc on strftime for full documentation: http://docs.python.org/lib/module-time.html') ], 'before_nickname': [ opt_str, '', _('Characters that are printed before the nickname in conversations') ], 'after_nickname': [ opt_str, ':', _('Characters that are printed after the nickname in conversations') ], - 'notify_on_new_gmail_email': [ opt_bool, True ], - 'notify_on_new_gmail_email_extra': [ opt_bool, False ], - 'notify_on_new_gmail_email_command': [ opt_str, '', _('Specify the command to run when new mail arrives, e.g.: /usr/bin/getmail -q') ], 'use_gpg_agent': [ opt_bool, False ], 'change_roster_title': [ opt_bool, True, _('Add * and [n] in roster title?')], 'restore_lines': [opt_int, 10, _('How many history messages should be restored when a chat tab/window is reopened?')], @@ -538,7 +535,6 @@ class Config: 'message_sent': [ False, 'sent.wav' ], 'muc_message_highlight': [ True, 'gc_message1.wav', _('Sound to play when a group chat message contains one of the words in muc_highlight_words, or when a group chat message contains your nickname.')], 'muc_message_received': [ False, 'gc_message2.wav', _('Sound to play when any MUC message arrives.') ], - 'gmail_received': [ False, 'message1.wav' ], } themes_default = { diff --git a/gajim/common/connection.py b/gajim/common/connection.py index 923aff9ce..d0c3b9304 100644 --- a/gajim/common/connection.py +++ b/gajim/common/connection.py @@ -1915,9 +1915,6 @@ class Connection(CommonConnection, ConnectionHandlers): get_action(self.name + '-archive').set_enabled(True) if obj.fjid == hostname: - if nbxmpp.NS_GMAILNOTIFY in obj.features: - app.gmail_domains.append(obj.fjid) - self.request_gmail_notifications() if nbxmpp.NS_SECLABEL in obj.features: self.seclabel_supported = True for identity in obj.identities: diff --git a/gajim/common/connection_handlers.py b/gajim/common/connection_handlers.py index 159f95346..3528e0b99 100644 --- a/gajim/common/connection_handlers.py +++ b/gajim/common/connection_handlers.py @@ -1358,7 +1358,6 @@ ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream): client_caps_factory=capscache.create_suitable_client_caps) ConnectionJingle.__init__(self) ConnectionHandlersBase.__init__(self) - self.gmail_url = None # keep the latest subscribed event for each jid to prevent loop when we # acknowledge presences @@ -1377,9 +1376,6 @@ ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream): self.privacy_default_list = None - self.gmail_last_tid = None - self.gmail_last_time = None - app.nec.register_incoming_event(PrivateStorageBookmarksReceivedEvent) app.nec.register_incoming_event(BookmarksReceivedEvent) app.nec.register_incoming_event( @@ -1417,8 +1413,6 @@ ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream): self._nec_roster_received) app.ged.register_event_handler('iq-error-received', ged.CORE, self._nec_iq_error_received) - app.ged.register_event_handler('gmail-new-mail-received', ged.CORE, - self._nec_gmail_new_mail_received) app.ged.register_event_handler('ping-received', ged.CORE, self._nec_ping_received) app.ged.register_event_handler('subscribe-presence-received', @@ -1463,8 +1457,6 @@ ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream): self._nec_roster_received) app.ged.remove_event_handler('iq-error-received', ged.CORE, self._nec_iq_error_received) - app.ged.remove_event_handler('gmail-new-mail-received', ged.CORE, - self._nec_gmail_new_mail_received) app.ged.remove_event_handler('ping-received', ged.CORE, self._nec_ping_received) app.ged.remove_event_handler('subscribe-presence-received', @@ -1721,44 +1713,6 @@ ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream): app.nec.push_incoming_event(TimeResultReceivedEvent(None, conn=self, stanza=iq_obj)) - def _gMailNewMailCB(self, con, iq_obj): - """ - Called when we get notified of new mail messages in gmail account - """ - log.debug('gMailNewMailCB') - app.nec.push_incoming_event(GmailNewMailReceivedEvent(None, conn=self, - stanza=iq_obj)) - raise nbxmpp.NodeProcessed - - def _nec_gmail_new_mail_received(self, obj): - if obj.conn.name != self.name: - return - if not self.connection or self.connected < 2: - return - # we'll now ask the server for the exact number of new messages - jid = app.get_jid_from_account(self.name) - log.debug('Got notification of new gmail e-mail on %s. Asking the ' - 'server for more info.' % jid) - iq = nbxmpp.Iq(typ='get') - query = iq.setTag('query') - query.setNamespace(nbxmpp.NS_GMAILNOTIFY) - # we want only be notified about newer mails - if self.gmail_last_tid: - query.setAttr('newer-than-tid', self.gmail_last_tid) - if self.gmail_last_time: - query.setAttr('newer-than-time', self.gmail_last_time) - self.connection.send(iq) - - def _gMailQueryCB(self, con, iq_obj): - """ - Called when we receive results from Querying the server for mail messages - in gmail account - """ - log.debug('gMailQueryCB') - app.nec.push_incoming_event(GMailQueryReceivedEvent(None, conn=self, - stanza=iq_obj)) - raise nbxmpp.NodeProcessed - def _rosterItemExchangeCB(self, con, msg): """ XEP-0144 Roster Item Echange @@ -2123,28 +2077,6 @@ ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream): # hashes of already received messages self.received_message_hashes = [] - def request_gmail_notifications(self): - if not self.connection or self.connected < 2: - return - # It's a gmail account, - # inform the server that we want e-mail notifications - our_jid = helpers.parse_jid(app.get_jid_from_account(self.name)) - log.debug(('%s is a gmail account. Setting option ' - 'to get e-mail notifications on the server.') % (our_jid)) - iq = nbxmpp.Iq(typ='set', to=our_jid) - iq.setAttr('id', 'MailNotify') - query = iq.setTag('usersetting') - query.setNamespace(nbxmpp.NS_GTALKSETTING) - query = query.setTag('mailnotifications') - query.setAttr('value', 'true') - self.connection.send(iq) - # Ask how many messages there are now - iq = nbxmpp.Iq(typ='get') - iq.setID(self.connection.getAnID()) - query = iq.setTag('query') - query.setNamespace(nbxmpp.NS_GMAILNOTIFY) - self.connection.send(iq) - def _SearchCB(self, con, iq_obj): log.debug('SearchCB') app.nec.push_incoming_event(SearchFormReceivedEvent(None, diff --git a/gajim/common/connection_handlers_events.py b/gajim/common/connection_handlers_events.py index f7249c8e1..f5fa8cfd9 100644 --- a/gajim/common/connection_handlers_events.py +++ b/gajim/common/connection_handlers_events.py @@ -232,61 +232,6 @@ class TimeResultReceivedEvent(nec.NetworkIncomingEvent, HelperEvent): self.time_info = t.astimezone(contact_tz()).strftime('%c') return True -class GMailQueryReceivedEvent(nec.NetworkIncomingEvent): - name = 'gmail-notify' - base_network_events = [] - - def generate(self): - if not self.stanza.getTag('mailbox'): - return - mb = self.stanza.getTag('mailbox') - if not mb.getAttr('url'): - return - self.conn.gmail_url = mb.getAttr('url') - if mb.getNamespace() != nbxmpp.NS_GMAILNOTIFY: - return - self.newmsgs = mb.getAttr('total-matched') - if not self.newmsgs: - return - if self.newmsgs == '0': - return - # there are new messages - self.gmail_messages_list = [] - if mb.getTag('mail-thread-info'): - gmail_messages = mb.getTags('mail-thread-info') - for gmessage in gmail_messages: - unread_senders = [] - for sender in gmessage.getTag('senders').getTags('sender'): - if sender.getAttr('unread') != '1': - continue - if sender.getAttr('name'): - unread_senders.append(sender.getAttr('name') + \ - '< ' + sender.getAttr('address') + '>') - else: - unread_senders.append(sender.getAttr('address')) - - if not unread_senders: - continue - gmail_subject = gmessage.getTag('subject').getData() - gmail_snippet = gmessage.getTag('snippet').getData() - tid = int(gmessage.getAttr('tid')) - if not self.conn.gmail_last_tid or \ - tid > self.conn.gmail_last_tid: - self.conn.gmail_last_tid = tid - self.gmail_messages_list.append({ - 'From': unread_senders, - 'Subject': gmail_subject, - 'Snippet': gmail_snippet, - 'url': gmessage.getAttr('url'), - 'participation': gmessage.getAttr('participation'), - 'messages': gmessage.getAttr('messages'), - 'date': gmessage.getAttr('date')}) - self.conn.gmail_last_time = int(mb.getAttr('result-time')) - - self.jid = app.get_jid_from_account(self.name) - log.debug('You have %s new gmail e-mails on %s.', self.newmsgs, self.jid) - return True - class RosterItemExchangeEvent(nec.NetworkIncomingEvent, HelperEvent): name = 'roster-item-exchange-received' base_network_events = [] @@ -671,18 +616,6 @@ class IqErrorReceivedEvent(nec.NetworkIncomingEvent, HelperEvent): self.errcode = self.stanza.getErrorCode() return True -class GmailNewMailReceivedEvent(nec.NetworkIncomingEvent): - name = 'gmail-new-mail-received' - base_network_events = [] - - def generate(self): - if not self.stanza.getTag('new-mail'): - return - if self.stanza.getTag('new-mail').getNamespace() != \ - nbxmpp.NS_GMAILNOTIFY: - return - return True - class PingReceivedEvent(nec.NetworkIncomingEvent): name = 'ping-received' base_network_events = [] diff --git a/gajim/config.py b/gajim/config.py index eed528b9e..449bab701 100644 --- a/gajim/config.py +++ b/gajim/config.py @@ -339,23 +339,6 @@ class PreferencesWindow: else: self.xml.get_object('manage_sounds_button').set_sensitive(False) - # Notify user of new gmail e-mail messages, - # make checkbox sensitive if user has a gtalk account - frame_gmail = self.xml.get_object('frame_gmail') - notify_gmail_checkbutton = self.xml.get_object('notify_gmail_checkbutton') - notify_gmail_extra_checkbutton = self.xml.get_object( - 'notify_gmail_extra_checkbutton') - - for account in app.config.get_per('accounts'): - jid = app.get_jid_from_account(account) - if app.get_server_from_jid(jid) in app.gmail_domains: - frame_gmail.set_sensitive(True) - st = app.config.get('notify_on_new_gmail_email') - notify_gmail_checkbutton.set_active(st) - st = app.config.get('notify_on_new_gmail_email_extra') - notify_gmail_extra_checkbutton.set_active(st) - break - #### Status tab ### # Autoaway st = app.config.get('autoaway') @@ -1144,12 +1127,6 @@ class PreferencesWindow: widget.set_inconsistent(False) self.on_per_account_checkbutton_toggled(widget, 'send_idle_time') - def on_notify_gmail_checkbutton_toggled(self, widget): - self.on_checkbutton_toggled(widget, 'notify_on_new_gmail_email') - - def on_notify_gmail_extra_checkbutton_toggled(self, widget): - self.on_checkbutton_toggled(widget, 'notify_on_new_gmail_email_extra') - def fill_msg_treeview(self): self.xml.get_object('delete_msg_button').set_sensitive(False) model = self.msg_tree.get_model() @@ -3054,7 +3031,6 @@ class ManageSoundsWindow: 'message_sent': _('Message Sent'), 'muc_message_highlight': _('Group Chat Message Highlight'), 'muc_message_received': _('Group Chat Message Received'), - 'gmail_received': _('GMail Email Received') } for sound_event_config_name, sound_ui_name in sounds_dict.items(): diff --git a/gajim/data/gui/account_context_menu.ui b/gajim/data/gui/account_context_menu.ui index 91257c213..665f54d80 100644 --- a/gajim/data/gui/account_context_menu.ui +++ b/gajim/data/gui/account_context_menu.ui @@ -1,5 +1,5 @@ - + @@ -75,14 +75,6 @@ True - - - True - False - _Open Gmail Inbox - True - - True diff --git a/gajim/data/gui/preferences_window.ui b/gajim/data/gui/preferences_window.ui index a8b667471..15a2156a9 100644 --- a/gajim/data/gui/preferences_window.ui +++ b/gajim/data/gui/preferences_window.ui @@ -1,5 +1,5 @@ - + @@ -727,75 +727,6 @@ 4 - - - True - False - False - True - 0 - none - - - True - False - 12 - 6 - vertical - 6 - - - Notify on new _GMail email - True - True - False - If checked, Gajim will show a notification when a new e-mail is received via GMail - True - 0 - True - - - - False - False - 0 - - - - - Display _extra email details - True - True - False - If checked, Gajim will also include information about the sender of new emails - True - 0 - True - - - - False - False - 1 - - - - - - - True - False - <b>GMail Options</b> - True - - - - - False - False - 5 - - True @@ -836,7 +767,7 @@ False True - 6 + 5 @@ -1215,7 +1146,7 @@ $T will be replaced by auto-not-available timeout 50 True True - 12 + 12 adjustment2 1 12 @@ -1231,7 +1162,7 @@ $T will be replaced by auto-not-available timeout 50 True True - 20 + 20 adjustment1 1 20 @@ -2127,10 +2058,10 @@ $T will be replaced by auto-not-available timeout _Reset to Default Colors True True + False False image1 True - False diff --git a/gajim/gui_interface.py b/gajim/gui_interface.py index 078a88cfc..d73d9d08c 100644 --- a/gajim/gui_interface.py +++ b/gajim/gui_interface.py @@ -847,44 +847,6 @@ class Interface: notify.popup(event_type, jid, account, 'file-send-error', path, event_type, file_props.name) - @staticmethod - def handle_event_gmail_notify(obj): - jid = obj.jid - gmail_new_messages = int(obj.newmsgs) - gmail_messages_list = obj.gmail_messages_list - if not app.config.get('notify_on_new_gmail_email'): - return - path = gtkgui_helpers.get_icon_path('gajim-new_email_recv', 48) - title = _('New e-mail on %(gmail_mail_address)s') % \ - {'gmail_mail_address': jid} - text = i18n.ngettext('You have %d new e-mail conversation', - 'You have %d new e-mail conversations', gmail_new_messages, - gmail_new_messages, gmail_new_messages) - - if app.config.get('notify_on_new_gmail_email_extra'): - cnt = 0 - for gmessage in gmail_messages_list: - # FIXME: emulate Gtalk client popups. find out what they - # parse and how they decide what to show each message has a - # 'From', 'Subject' and 'Snippet' field - if cnt >= 5: - break - senders = ',\n '.join(reversed(gmessage['From'])) - text += _('\n\nFrom: %(from_address)s\nSubject: ' - '%(subject)s\n%(snippet)s') % {'from_address': senders, - 'subject': gmessage['Subject'], - 'snippet': gmessage['Snippet']} - cnt += 1 - - command = app.config.get('notify_on_new_gmail_email_command') - if command: - Popen(command, shell=True) - - if app.config.get_per('soundevents', 'gmail_received', 'enabled'): - helpers.play_sound('gmail_received') - notify.popup(_('New E-mail'), jid, obj.conn.name, 'gmail', - path_to_image=path, title=title, text=text) - def handle_event_file_request_error(self, obj): # ('FILE_REQUEST_ERROR', account, (jid, file_props, error_msg)) ft = self.instances['file_transfers'] @@ -1553,7 +1515,6 @@ class Interface: 'gc-decline-received': [self.handle_event_gc_decline], 'gc-presence-received': [self.handle_event_gc_presence], 'gc-message-received': [self.handle_event_gc_message], - 'gmail-notify': [self.handle_event_gmail_notify], 'gpg-password-required': [self.handle_event_gpg_password_required], 'gpg-trust-key': [self.handle_event_gpg_trust_key], 'http-auth-received': [self.handle_event_http_auth], @@ -1762,10 +1723,6 @@ class Interface: else: # Open the window self.roster.open_event(account, fjid, event) - elif type_ == 'gmail': - url = app.connections[account].gmail_url - if url: - helpers.launch_browser_mailer('url', url) elif type_ == 'gc-invitation': event = app.events.get_first_event(account, jid, type_) dialogs.InvitationReceivedDialog(account, event.room_jid, jid, diff --git a/gajim/remote_control.py b/gajim/remote_control.py index 60c9a96a0..c9ce5f36c 100644 --- a/gajim/remote_control.py +++ b/gajim/remote_control.py @@ -111,8 +111,6 @@ class Remote: self.on_os_info) app.ged.register_event_handler('time-result-received', ged.POSTGUI, self.on_time) - app.ged.register_event_handler('gmail-nofify', ged.POSTGUI, - self.on_gmail_notify) app.ged.register_event_handler('roster-info', ged.POSTGUI, self.on_roster_info) app.ged.register_event_handler('presence-received', ged.POSTGUI, @@ -156,10 +154,6 @@ class Remote: self.raise_signal('EntityTime', (obj.conn.name, [obj.jid, obj.resource, obj.time_info])) - def on_gmail_notify(self, obj): - self.raise_signal('NewGmail', (obj.conn.name, [obj.jid, obj.newmsgs, - obj.gmail_messages_list])) - def on_roster_info(self, obj): self.raise_signal('RosterInfo', (obj.conn.name, [obj.jid, obj.nickname, obj.sub, obj.ask, obj.groups])) @@ -292,10 +286,6 @@ class SignalObject(dbus.service.Object): def RosterInfo(self, account_and_array): pass - @dbus.service.signal(INTERFACE, signature='av') - def NewGmail(self, account_and_array): - pass - @dbus.service.signal(INTERFACE, signature='av') def ChatState(self, account_and_array): pass diff --git a/gajim/roster_window.py b/gajim/roster_window.py index bf613da4a..10844afbd 100644 --- a/gajim/roster_window.py +++ b/gajim/roster_window.py @@ -3235,11 +3235,6 @@ class RosterWindow: app.interface.instances['accounts'] = config.AccountsWindow() app.interface.instances['accounts'].select_account(account) - def on_open_gmail_inbox(self, widget, account): - url = app.connections[account].gmail_url - if url: - helpers.launch_browser_mailer('url', url) - def on_change_status_message_activate(self, widget, account): show = app.SHOW_LIST[app.connections[account].connected] def on_response(message, pep_dict): @@ -5036,8 +5031,6 @@ class RosterWindow: start_chat_menuitem = xml.get_object('start_chat_menuitem') join_group_chat_menuitem = xml.get_object( 'join_group_chat_menuitem') - open_gmail_inbox_menuitem = xml.get_object( - 'open_gmail_inbox_menuitem') add_contact_menuitem = xml.get_object('add_contact_menuitem') service_discovery_menuitem = xml.get_object( 'service_discovery_menuitem') @@ -5108,13 +5101,6 @@ class RosterWindow: else: pep_menuitem.set_sensitive(False) - if not app.connections[account].gmail_url: - open_gmail_inbox_menuitem.set_no_show_all(True) - open_gmail_inbox_menuitem.hide() - else: - open_gmail_inbox_menuitem.connect('activate', - self.on_open_gmail_inbox, account) - edit_account_menuitem.connect('activate', self.on_edit_account, account) if app.connections[account].roster_supported: