Remove Gmail special options
This commit is contained in:
parent
152be4473b
commit
a378152a9c
|
@ -88,8 +88,6 @@ else:
|
||||||
|
|
||||||
os_info = None # used to cache os information
|
os_info = None # used to cache os information
|
||||||
|
|
||||||
gmail_domains = ['gmail.com', 'googlemail.com']
|
|
||||||
|
|
||||||
transport_type = {} # list the type of transport
|
transport_type = {} # list the type of transport
|
||||||
|
|
||||||
last_message_time = {} # list of time of the latest incomming message
|
last_message_time = {} # list of time of the latest incomming message
|
||||||
|
|
|
@ -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') ],
|
'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') ],
|
'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') ],
|
'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 ],
|
'use_gpg_agent': [ opt_bool, False ],
|
||||||
'change_roster_title': [ opt_bool, True, _('Add * and [n] in roster title?')],
|
'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?')],
|
'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' ],
|
'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_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.') ],
|
'muc_message_received': [ False, 'gc_message2.wav', _('Sound to play when any MUC message arrives.') ],
|
||||||
'gmail_received': [ False, 'message1.wav' ],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
themes_default = {
|
themes_default = {
|
||||||
|
|
|
@ -1915,9 +1915,6 @@ class Connection(CommonConnection, ConnectionHandlers):
|
||||||
get_action(self.name + '-archive').set_enabled(True)
|
get_action(self.name + '-archive').set_enabled(True)
|
||||||
|
|
||||||
if obj.fjid == hostname:
|
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:
|
if nbxmpp.NS_SECLABEL in obj.features:
|
||||||
self.seclabel_supported = True
|
self.seclabel_supported = True
|
||||||
for identity in obj.identities:
|
for identity in obj.identities:
|
||||||
|
|
|
@ -1358,7 +1358,6 @@ ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream):
|
||||||
client_caps_factory=capscache.create_suitable_client_caps)
|
client_caps_factory=capscache.create_suitable_client_caps)
|
||||||
ConnectionJingle.__init__(self)
|
ConnectionJingle.__init__(self)
|
||||||
ConnectionHandlersBase.__init__(self)
|
ConnectionHandlersBase.__init__(self)
|
||||||
self.gmail_url = None
|
|
||||||
|
|
||||||
# keep the latest subscribed event for each jid to prevent loop when we
|
# keep the latest subscribed event for each jid to prevent loop when we
|
||||||
# acknowledge presences
|
# acknowledge presences
|
||||||
|
@ -1377,9 +1376,6 @@ ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream):
|
||||||
|
|
||||||
self.privacy_default_list = None
|
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(PrivateStorageBookmarksReceivedEvent)
|
||||||
app.nec.register_incoming_event(BookmarksReceivedEvent)
|
app.nec.register_incoming_event(BookmarksReceivedEvent)
|
||||||
app.nec.register_incoming_event(
|
app.nec.register_incoming_event(
|
||||||
|
@ -1417,8 +1413,6 @@ ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream):
|
||||||
self._nec_roster_received)
|
self._nec_roster_received)
|
||||||
app.ged.register_event_handler('iq-error-received', ged.CORE,
|
app.ged.register_event_handler('iq-error-received', ged.CORE,
|
||||||
self._nec_iq_error_received)
|
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,
|
app.ged.register_event_handler('ping-received', ged.CORE,
|
||||||
self._nec_ping_received)
|
self._nec_ping_received)
|
||||||
app.ged.register_event_handler('subscribe-presence-received',
|
app.ged.register_event_handler('subscribe-presence-received',
|
||||||
|
@ -1463,8 +1457,6 @@ ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream):
|
||||||
self._nec_roster_received)
|
self._nec_roster_received)
|
||||||
app.ged.remove_event_handler('iq-error-received', ged.CORE,
|
app.ged.remove_event_handler('iq-error-received', ged.CORE,
|
||||||
self._nec_iq_error_received)
|
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,
|
app.ged.remove_event_handler('ping-received', ged.CORE,
|
||||||
self._nec_ping_received)
|
self._nec_ping_received)
|
||||||
app.ged.remove_event_handler('subscribe-presence-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,
|
app.nec.push_incoming_event(TimeResultReceivedEvent(None, conn=self,
|
||||||
stanza=iq_obj))
|
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):
|
def _rosterItemExchangeCB(self, con, msg):
|
||||||
"""
|
"""
|
||||||
XEP-0144 Roster Item Echange
|
XEP-0144 Roster Item Echange
|
||||||
|
@ -2123,28 +2077,6 @@ ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream):
|
||||||
# hashes of already received messages
|
# hashes of already received messages
|
||||||
self.received_message_hashes = []
|
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):
|
def _SearchCB(self, con, iq_obj):
|
||||||
log.debug('SearchCB')
|
log.debug('SearchCB')
|
||||||
app.nec.push_incoming_event(SearchFormReceivedEvent(None,
|
app.nec.push_incoming_event(SearchFormReceivedEvent(None,
|
||||||
|
|
|
@ -232,61 +232,6 @@ class TimeResultReceivedEvent(nec.NetworkIncomingEvent, HelperEvent):
|
||||||
self.time_info = t.astimezone(contact_tz()).strftime('%c')
|
self.time_info = t.astimezone(contact_tz()).strftime('%c')
|
||||||
return True
|
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):
|
class RosterItemExchangeEvent(nec.NetworkIncomingEvent, HelperEvent):
|
||||||
name = 'roster-item-exchange-received'
|
name = 'roster-item-exchange-received'
|
||||||
base_network_events = []
|
base_network_events = []
|
||||||
|
@ -671,18 +616,6 @@ class IqErrorReceivedEvent(nec.NetworkIncomingEvent, HelperEvent):
|
||||||
self.errcode = self.stanza.getErrorCode()
|
self.errcode = self.stanza.getErrorCode()
|
||||||
return True
|
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):
|
class PingReceivedEvent(nec.NetworkIncomingEvent):
|
||||||
name = 'ping-received'
|
name = 'ping-received'
|
||||||
base_network_events = []
|
base_network_events = []
|
||||||
|
|
|
@ -339,23 +339,6 @@ class PreferencesWindow:
|
||||||
else:
|
else:
|
||||||
self.xml.get_object('manage_sounds_button').set_sensitive(False)
|
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 ###
|
#### Status tab ###
|
||||||
# Autoaway
|
# Autoaway
|
||||||
st = app.config.get('autoaway')
|
st = app.config.get('autoaway')
|
||||||
|
@ -1144,12 +1127,6 @@ class PreferencesWindow:
|
||||||
widget.set_inconsistent(False)
|
widget.set_inconsistent(False)
|
||||||
self.on_per_account_checkbutton_toggled(widget, 'send_idle_time')
|
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):
|
def fill_msg_treeview(self):
|
||||||
self.xml.get_object('delete_msg_button').set_sensitive(False)
|
self.xml.get_object('delete_msg_button').set_sensitive(False)
|
||||||
model = self.msg_tree.get_model()
|
model = self.msg_tree.get_model()
|
||||||
|
@ -3054,7 +3031,6 @@ class ManageSoundsWindow:
|
||||||
'message_sent': _('Message Sent'),
|
'message_sent': _('Message Sent'),
|
||||||
'muc_message_highlight': _('Group Chat Message Highlight'),
|
'muc_message_highlight': _('Group Chat Message Highlight'),
|
||||||
'muc_message_received': _('Group Chat Message Received'),
|
'muc_message_received': _('Group Chat Message Received'),
|
||||||
'gmail_received': _('GMail Email Received')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for sound_event_config_name, sound_ui_name in sounds_dict.items():
|
for sound_event_config_name, sound_ui_name in sounds_dict.items():
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- Generated with glade 3.18.3 -->
|
<!-- Generated with glade 3.20.0 -->
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk+" version="3.12"/>
|
<requires lib="gtk+" version="3.12"/>
|
||||||
<object class="GtkMenu" id="account_context_menu">
|
<object class="GtkMenu" id="account_context_menu">
|
||||||
|
@ -75,14 +75,6 @@
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
|
||||||
<object class="GtkMenuItem" id="open_gmail_inbox_menuitem">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="label" translatable="yes">_Open Gmail Inbox</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkSeparatorMenuItem" id="seperator1">
|
<object class="GtkSeparatorMenuItem" id="seperator1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- Generated with glade 3.18.3 -->
|
<!-- Generated with glade 3.20.0 -->
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk+" version="3.12"/>
|
<requires lib="gtk+" version="3.12"/>
|
||||||
<object class="GtkAdjustment" id="adjustment1">
|
<object class="GtkAdjustment" id="adjustment1">
|
||||||
|
@ -727,75 +727,6 @@
|
||||||
<property name="position">4</property>
|
<property name="position">4</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
|
||||||
<object class="GtkFrame" id="frame_gmail">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="sensitive">False</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="no_show_all">True</property>
|
|
||||||
<property name="label_xalign">0</property>
|
|
||||||
<property name="shadow_type">none</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkBox" id="vbox_gmail">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="margin_left">12</property>
|
|
||||||
<property name="border_width">6</property>
|
|
||||||
<property name="orientation">vertical</property>
|
|
||||||
<property name="spacing">6</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkCheckButton" id="notify_gmail_checkbutton">
|
|
||||||
<property name="label" translatable="yes">Notify on new _GMail email</property>
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="receives_default">False</property>
|
|
||||||
<property name="tooltip_text" translatable="yes">If checked, Gajim will show a notification when a new e-mail is received via GMail</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<property name="xalign">0</property>
|
|
||||||
<property name="draw_indicator">True</property>
|
|
||||||
<signal name="toggled" handler="on_notify_gmail_checkbutton_toggled" swapped="no"/>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">False</property>
|
|
||||||
<property name="position">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkCheckButton" id="notify_gmail_extra_checkbutton">
|
|
||||||
<property name="label" translatable="yes">Display _extra email details</property>
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="receives_default">False</property>
|
|
||||||
<property name="tooltip_text" translatable="yes">If checked, Gajim will also include information about the sender of new emails</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<property name="xalign">0</property>
|
|
||||||
<property name="draw_indicator">True</property>
|
|
||||||
<signal name="toggled" handler="on_notify_gmail_extra_checkbutton_toggled" swapped="no"/>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">False</property>
|
|
||||||
<property name="position">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child type="label">
|
|
||||||
<object class="GtkLabel" id="gmail_options_label">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="label" translatable="yes"><b>GMail Options</b></property>
|
|
||||||
<property name="use_markup">True</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">False</property>
|
|
||||||
<property name="position">5</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox" id="hbox5">
|
<object class="GtkBox" id="hbox5">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -836,7 +767,7 @@
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
<property name="position">6</property>
|
<property name="position">5</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
@ -1215,7 +1146,7 @@ $T will be replaced by auto-not-available timeout</property>
|
||||||
<property name="width_request">50</property>
|
<property name="width_request">50</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="text" translatable="yes">12</property>
|
<property name="text">12</property>
|
||||||
<property name="adjustment">adjustment2</property>
|
<property name="adjustment">adjustment2</property>
|
||||||
<property name="climb_rate">1</property>
|
<property name="climb_rate">1</property>
|
||||||
<property name="value">12</property>
|
<property name="value">12</property>
|
||||||
|
@ -1231,7 +1162,7 @@ $T will be replaced by auto-not-available timeout</property>
|
||||||
<property name="width_request">50</property>
|
<property name="width_request">50</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="text" translatable="yes">20</property>
|
<property name="text">20</property>
|
||||||
<property name="adjustment">adjustment1</property>
|
<property name="adjustment">adjustment1</property>
|
||||||
<property name="climb_rate">1</property>
|
<property name="climb_rate">1</property>
|
||||||
<property name="value">20</property>
|
<property name="value">20</property>
|
||||||
|
@ -2127,10 +2058,10 @@ $T will be replaced by auto-not-available timeout</property>
|
||||||
<property name="label" translatable="yes">_Reset to Default Colors</property>
|
<property name="label" translatable="yes">_Reset to Default Colors</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
|
<property name="focus_on_click">False</property>
|
||||||
<property name="receives_default">False</property>
|
<property name="receives_default">False</property>
|
||||||
<property name="image">image1</property>
|
<property name="image">image1</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
<property name="focus_on_click">False</property>
|
|
||||||
<signal name="clicked" handler="on_reset_colors_button_clicked" swapped="no"/>
|
<signal name="clicked" handler="on_reset_colors_button_clicked" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
|
|
@ -847,44 +847,6 @@ class Interface:
|
||||||
notify.popup(event_type, jid, account, 'file-send-error', path,
|
notify.popup(event_type, jid, account, 'file-send-error', path,
|
||||||
event_type, file_props.name)
|
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):
|
def handle_event_file_request_error(self, obj):
|
||||||
# ('FILE_REQUEST_ERROR', account, (jid, file_props, error_msg))
|
# ('FILE_REQUEST_ERROR', account, (jid, file_props, error_msg))
|
||||||
ft = self.instances['file_transfers']
|
ft = self.instances['file_transfers']
|
||||||
|
@ -1553,7 +1515,6 @@ class Interface:
|
||||||
'gc-decline-received': [self.handle_event_gc_decline],
|
'gc-decline-received': [self.handle_event_gc_decline],
|
||||||
'gc-presence-received': [self.handle_event_gc_presence],
|
'gc-presence-received': [self.handle_event_gc_presence],
|
||||||
'gc-message-received': [self.handle_event_gc_message],
|
'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-password-required': [self.handle_event_gpg_password_required],
|
||||||
'gpg-trust-key': [self.handle_event_gpg_trust_key],
|
'gpg-trust-key': [self.handle_event_gpg_trust_key],
|
||||||
'http-auth-received': [self.handle_event_http_auth],
|
'http-auth-received': [self.handle_event_http_auth],
|
||||||
|
@ -1762,10 +1723,6 @@ class Interface:
|
||||||
else:
|
else:
|
||||||
# Open the window
|
# Open the window
|
||||||
self.roster.open_event(account, fjid, event)
|
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':
|
elif type_ == 'gc-invitation':
|
||||||
event = app.events.get_first_event(account, jid, type_)
|
event = app.events.get_first_event(account, jid, type_)
|
||||||
dialogs.InvitationReceivedDialog(account, event.room_jid, jid,
|
dialogs.InvitationReceivedDialog(account, event.room_jid, jid,
|
||||||
|
|
|
@ -111,8 +111,6 @@ class Remote:
|
||||||
self.on_os_info)
|
self.on_os_info)
|
||||||
app.ged.register_event_handler('time-result-received', ged.POSTGUI,
|
app.ged.register_event_handler('time-result-received', ged.POSTGUI,
|
||||||
self.on_time)
|
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,
|
app.ged.register_event_handler('roster-info', ged.POSTGUI,
|
||||||
self.on_roster_info)
|
self.on_roster_info)
|
||||||
app.ged.register_event_handler('presence-received', ged.POSTGUI,
|
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,
|
self.raise_signal('EntityTime', (obj.conn.name, [obj.jid, obj.resource,
|
||||||
obj.time_info]))
|
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):
|
def on_roster_info(self, obj):
|
||||||
self.raise_signal('RosterInfo', (obj.conn.name, [obj.jid, obj.nickname,
|
self.raise_signal('RosterInfo', (obj.conn.name, [obj.jid, obj.nickname,
|
||||||
obj.sub, obj.ask, obj.groups]))
|
obj.sub, obj.ask, obj.groups]))
|
||||||
|
@ -292,10 +286,6 @@ class SignalObject(dbus.service.Object):
|
||||||
def RosterInfo(self, account_and_array):
|
def RosterInfo(self, account_and_array):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@dbus.service.signal(INTERFACE, signature='av')
|
|
||||||
def NewGmail(self, account_and_array):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@dbus.service.signal(INTERFACE, signature='av')
|
@dbus.service.signal(INTERFACE, signature='av')
|
||||||
def ChatState(self, account_and_array):
|
def ChatState(self, account_and_array):
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -3235,11 +3235,6 @@ class RosterWindow:
|
||||||
app.interface.instances['accounts'] = config.AccountsWindow()
|
app.interface.instances['accounts'] = config.AccountsWindow()
|
||||||
app.interface.instances['accounts'].select_account(account)
|
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):
|
def on_change_status_message_activate(self, widget, account):
|
||||||
show = app.SHOW_LIST[app.connections[account].connected]
|
show = app.SHOW_LIST[app.connections[account].connected]
|
||||||
def on_response(message, pep_dict):
|
def on_response(message, pep_dict):
|
||||||
|
@ -5036,8 +5031,6 @@ class RosterWindow:
|
||||||
start_chat_menuitem = xml.get_object('start_chat_menuitem')
|
start_chat_menuitem = xml.get_object('start_chat_menuitem')
|
||||||
join_group_chat_menuitem = xml.get_object(
|
join_group_chat_menuitem = xml.get_object(
|
||||||
'join_group_chat_menuitem')
|
'join_group_chat_menuitem')
|
||||||
open_gmail_inbox_menuitem = xml.get_object(
|
|
||||||
'open_gmail_inbox_menuitem')
|
|
||||||
add_contact_menuitem = xml.get_object('add_contact_menuitem')
|
add_contact_menuitem = xml.get_object('add_contact_menuitem')
|
||||||
service_discovery_menuitem = xml.get_object(
|
service_discovery_menuitem = xml.get_object(
|
||||||
'service_discovery_menuitem')
|
'service_discovery_menuitem')
|
||||||
|
@ -5108,13 +5101,6 @@ class RosterWindow:
|
||||||
else:
|
else:
|
||||||
pep_menuitem.set_sensitive(False)
|
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,
|
edit_account_menuitem.connect('activate', self.on_edit_account,
|
||||||
account)
|
account)
|
||||||
if app.connections[account].roster_supported:
|
if app.connections[account].roster_supported:
|
||||||
|
|
Loading…
Reference in New Issue