comparison libpurple/protocols/jabber/google.c @ 27253:beb33c984100

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.
author Paul Aurich <paul@darkrain42.org>
date Thu, 02 Jul 2009 22:27:13 +0000
parents 01f1929d0936
children 7f5ce6fa0a25
comparison
equal deleted inserted replaced
27252:ea9df9bfa921 27253:beb33c984100
937 return; 937 return;
938 } 938 }
939 939
940 void jabber_gmail_init(JabberStream *js) { 940 void jabber_gmail_init(JabberStream *js) {
941 JabberIq *iq; 941 JabberIq *iq;
942 942 xmlnode *usersetting, *mailnotifications;
943 if (!purple_account_get_check_mail(js->gc->account)) 943
944 return; 944 if (!purple_account_get_check_mail(purple_connection_get_account(js->gc)))
945 return;
946
947 /*
948 * Quoting http://code.google.com/apis/talk/jep_extensions/usersettings.html:
949 * To ensure better compatibility with other clients, rather than
950 * setting this value to "false" to turn off notifications, it is
951 * recommended that a client set this to "true" and filter incoming
952 * email notifications itself.
953 */
954 iq = jabber_iq_new(js, JABBER_IQ_SET);
955 usersetting = xmlnode_new_child(iq->node, "usersetting");
956 xmlnode_set_namespace(usersetting, "google:setting");
957 mailnotifications = xmlnode_new_child(usersetting, "mailnotifications");
958 xmlnode_set_attrib(mailnotifications, "value", "true");
959 jabber_iq_send(iq);
945 960
946 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "google:mail:notify"); 961 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "google:mail:notify");
947 jabber_iq_set_callback(iq, jabber_gmail_parse, NULL); 962 jabber_iq_set_callback(iq, jabber_gmail_parse, NULL);
948 jabber_iq_send(iq); 963 jabber_iq_send(iq);
949 } 964 }