# HG changeset patch # User Sean Egan # Date 1190234100 0 # Node ID 575d8c84ccba8c26c5016d6a1a037d501b3c8ab1 # Parent 181bcc9a28881f8e7b057698c12ca2bbb685f594 Show when Gmail count falls, instead of only when it rises. Fixes #1462 diff -r 181bcc9a2888 -r 575d8c84ccba ChangeLog --- a/ChangeLog Tue Sep 18 23:33:31 2007 +0000 +++ b/ChangeLog Wed Sep 19 20:35:00 2007 +0000 @@ -9,6 +9,7 @@ it in an ambiguous state. (It will be disabled.) * Fixed an erroneous size display for MSN file transfers. (galt) * Real usernames are now shown in the system log. + * Gmail notifications are better tracked Pidgin: * If you alias a buddy to an alias that is already present within diff -r 181bcc9a2888 -r 575d8c84ccba libpurple/protocols/jabber/google.c --- a/libpurple/protocols/jabber/google.c Tue Sep 18 23:33:31 2007 +0000 +++ b/libpurple/protocols/jabber/google.c Wed Sep 19 20:35:00 2007 +0000 @@ -39,6 +39,8 @@ char *subject; const char *in_str; char *to_name; + char *default_tos[1]; + int i, count = 1, returned_count; const char **tos, **froms, **urls; @@ -55,15 +57,25 @@ if (in_str && *in_str) count = atoi(in_str); - if (count == 0) + /* If Gmail doesn't tell us who the mail is to, let's use our JID */ + to = xmlnode_get_attrib(packet, "to"); + default_tos[0] = jabber_get_bare_jid(to); + + if (count == 0) { + purple_notify_emails(js->gc, count, FALSE, NULL, NULL, default_tos, NULL, NULL, NULL); + g_free(default_tos[0]); return; + } message = xmlnode_get_child(child, "mail-thread-info"); + if (!message) { + purple_notify_emails(js->gc, count, FALSE, NULL, NULL, default_tos, NULL, NULL, NULL); + g_free(default_tos[0]); + return; + } /* Loop once to see how many messages were returned so we can allocate arrays * accordingly */ - if (!message) - return; for (returned_count = 0; message; returned_count++, message=xmlnode_get_next_twin(message)); froms = g_new0(const char* , returned_count); @@ -115,9 +127,13 @@ if (i>0) purple_notify_emails(js->gc, count, count == i, (const char**) subjects, froms, tos, urls, NULL, NULL); + else + purple_notify_emails(js->gc, count, FALSE, NULL, NULL, default_tos, NULL, NULL, NULL); + g_free(to_name); g_free(tos); + g_free(default_tos[0]); g_free(froms); for (; i > 0; i--) g_free(subjects[i - 1]);