# HG changeset patch # User Paul Aurich # Date 1246573633 0 # Node ID beb33c9841002dcbf617ec6d61be8fa98c040c73 # Parent ea9df9bfa9212f273dbbdff0c1bf4351d18d857a Fix Google Mail notifications when they inexplicably weren't working. Fixes #3300. I don't really know why this is a setting, given that the server can reasonably determine a client's interest based on an initial request at login (which is what the google:mail:notify doc still says). Moreover, they explicitly say clients shouldn't set this setting to false. diff -r ea9df9bfa921 -r beb33c984100 ChangeLog --- a/ChangeLog Thu Jul 02 22:03:21 2009 +0000 +++ b/ChangeLog Thu Jul 02 22:27:13 2009 +0000 @@ -70,6 +70,8 @@ characters. * Show emblem for mobile, handheld, and web clients and bots (if the other client supports it). + * Google Talk mail notifications should now work for people for whom they + inexplicably did not. (Thanks to yukam for determining the reason) Yahoo: * P2P file transfers. (Sulabh Mahajan) diff -r ea9df9bfa921 -r beb33c984100 libpurple/protocols/jabber/google.c --- a/libpurple/protocols/jabber/google.c Thu Jul 02 22:03:21 2009 +0000 +++ b/libpurple/protocols/jabber/google.c Thu Jul 02 22:27:13 2009 +0000 @@ -939,10 +939,25 @@ void jabber_gmail_init(JabberStream *js) { JabberIq *iq; + xmlnode *usersetting, *mailnotifications; - if (!purple_account_get_check_mail(js->gc->account)) + if (!purple_account_get_check_mail(purple_connection_get_account(js->gc))) return; + /* + * Quoting http://code.google.com/apis/talk/jep_extensions/usersettings.html: + * To ensure better compatibility with other clients, rather than + * setting this value to "false" to turn off notifications, it is + * recommended that a client set this to "true" and filter incoming + * email notifications itself. + */ + iq = jabber_iq_new(js, JABBER_IQ_SET); + usersetting = xmlnode_new_child(iq->node, "usersetting"); + xmlnode_set_namespace(usersetting, "google:setting"); + mailnotifications = xmlnode_new_child(usersetting, "mailnotifications"); + xmlnode_set_attrib(mailnotifications, "value", "true"); + jabber_iq_send(iq); + iq = jabber_iq_new_query(js, JABBER_IQ_GET, "google:mail:notify"); jabber_iq_set_callback(iq, jabber_gmail_parse, NULL); jabber_iq_send(iq);