Ticket #883: new_gmail_v3.patch
| File new_gmail_v3.patch, 5.5 KB (added by knuckles@…, 4 years ago) |
|---|
-
src/notify.py
195 195 else: 196 196 txt = '' 197 197 elif event_type == _('New E-mail'): 198 txt = _('You have new E-mail on %s.') % (jid) 198 no_of_messages = int(msg_type) 199 text = i18n.ngettext('You have %d new E-mail message', 'You have %d new E-mail messages', no_of_messages, no_of_messages, no_of_messages) 200 txt = _('%(new_mail_gajim_ui_msg)s on %(gmail_mail_address)s') % {'new_mail_gajim_ui_msg': text, 'gmail_mail_address': jid} 199 201 ntype = 'gmail.notify' 200 202 img = 'single_msg_recv.png' #FIXME: find a better image 203 self.msg_type = msg_type = 'gmail' 201 204 else: 202 205 # defaul failsafe values 203 206 img = 'chat_msg_recv.png' # img to display -
src/dialogs.py
924 924 dodgerblue = gtk.gdk.color_parse('dodgerblue') 925 925 close_button.modify_bg(gtk.STATE_NORMAL, dodgerblue) 926 926 eventbox.modify_bg(gtk.STATE_NORMAL, dodgerblue) 927 txt = _('You have new E-mail on %s.') % (jid) 927 no_of_messages = int(msg_type) 928 text = i18n.ngettext('You have %d new E-mail message', 'You have %d new E-mail messages', no_of_messages, no_of_messages, no_of_messages) 929 txt = _('%(new_mail_gajim_ui_msg)s on %(gmail_mail_address)s') % {'new_mail_gajim_ui_msg': text, 'gmail_mail_address': jid} 930 self.msg_type = msg_type = 'gmail' 928 931 event_description_label.set_markup('<span foreground="black">%s</span>' % txt) 929 932 # position the window to bottom-right of screen 930 933 window_width, self.window_height = self.window.get_size() -
src/gajim.py
852 852 notify.notify(_('File Transfer Error'), 853 853 jid, account, 'file-send-error', file_props) 854 854 855 def handle_event_gmail_notify(self, account, jid): 855 def handle_event_gmail_notify(self, account, array): 856 jid = array[0] 857 newmsgs = array[1] 856 858 if gajim.config.get('notify_on_new_gmail_email'): 857 notify.notify(_('New E-mail'), jid, account )859 notify.notify(_('New E-mail'), jid, account, newmsgs) 858 860 859 861 def add_event(self, account, jid, typ, args): 860 862 '''add an event to the awaiting_events var''' … … 1322 1324 ev = gajim.get_first_event(account, jid, typ) 1323 1325 # Open the window 1324 1326 self.roster.open_event(account, jid, ev) 1327 elif typ == message_control.TYPE_GMAIL: 1328 if gajim.config.get_per('accounts', account, 'savepass'): 1329 url = ('http://www.google.com/accounts/ServiceLoginAuth?service=mail&Email=%s&Passwd=%s&continue=https://mail.google.com/mail') % (gajim.config.get_per('accounts', account, 'name'),gajim.config.get_per('accounts', account, 'password')) 1330 else: 1331 url = ('http://mail.google.com/') 1332 helpers.launch_browser_mailer('url', url) 1325 1333 if w: 1326 1334 w.set_active_tab(jid) 1327 1335 w.window.present() -
src/common/connection.py
331 331 else: 332 332 self.dispatch('VCARD', vcard) 333 333 334 def _gMail CB(self, con, gm):334 def _gMailNewMailCB(self, con, gm): 335 335 """Called when we get notified of new mail messages in gmail account""" 336 336 if not gm.getTag('new-mail'): 337 337 return 338 338 if gm.getTag('new-mail').getNamespace() == common.xmpp.NS_GMAILNOTIFY: 339 # we'll now ask the server for the exact number of new messages 339 340 jid = gajim.get_jid_from_account(self.name) 340 gajim.log.debug(('Notifying user of new gmail e-mail on %s.') % (jid)) 341 self.dispatch('GMAIL_NOTIFY', jid) 341 gajim.log.debug(('Got notification of new gmail e-mail on %s. Asking the server for more info.') % (jid)) 342 iq = common.xmpp.Iq(typ = 'get') 343 iq.setAttr('id', '13') 344 query = iq.setTag('query') 345 query.setNamespace(common.xmpp.NS_GMAILNOTIFY) 346 self.to_be_sent.append(iq) 342 347 raise common.xmpp.NodeProcessed 348 349 def _gMailQueryCB(self, con, gm): 350 """Called when we receive results from Querying the server for mail messages in gmail account""" 351 if not gm.getTag('mailbox'): 352 return 353 if gm.getTag('mailbox').getNamespace() == common.xmpp.NS_GMAILNOTIFY: 354 newmsgs = gm.getTag('mailbox').getAttr('total-matched') 355 if newmsgs != '0': 356 # there are new messages 357 jid = gajim.get_jid_from_account(self.name) 358 gajim.log.debug(('User has %s new gmail e-mails on %s.') % (newmsgs, jid)) 359 self.dispatch('GMAIL_NOTIFY', (jid, newmsgs)) 360 raise common.xmpp.NodeProcessed 343 361 344 362 def _messageCB(self, con, msg): 345 363 """Called when we receive a message""" … … 1746 1764 common.xmpp.NS_PRIVATE) 1747 1765 con.RegisterHandler('iq', self._HttpAuthCB, 'get', 1748 1766 common.xmpp.NS_HTTP_AUTH) 1749 con.RegisterHandler('iq', self._gMail CB, 'set',1767 con.RegisterHandler('iq', self._gMailNewMailCB, 'set', 1750 1768 common.xmpp.NS_GMAILNOTIFY) 1769 con.RegisterHandler('iq', self._gMailQueryCB, 'result', 1770 common.xmpp.NS_GMAILNOTIFY) 1751 1771 con.RegisterHandler('iq', self._ErrorCB, 'error') 1752 1772 con.RegisterHandler('iq', self._IqCB) 1753 1773 con.RegisterHandler('iq', self._StanzaArrivedCB) -
src/message_control.py
24 24 TYPE_CHAT = 'chat' 25 25 TYPE_GC = 'gc' 26 26 TYPE_PM = 'pm' 27 TYPE_GMAIL = 'gmail' 27 28 28 29 #################### 29 30 # FIXME: Can't this stuff happen once?
