changeset 20559:fecae28132f5

merge of '005c57c94d8542339f96a33cfed0fefbad65d68e' and 'b8e1742d36c8359edf356bc6db9c2b945533c29d'
author Sean Egan <seanegan@gmail.com>
date Wed, 19 Sep 2007 20:35:10 +0000
parents 595f3ca5eb75 (current diff) 575d8c84ccba (diff)
children 9d812753d26a
files libpurple/protocols/msn/msn-utils.c libpurple/protocols/msn/msn-utils.h
diffstat 2 files changed, 20 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Sep 19 19:27:43 2007 +0000
+++ b/ChangeLog	Wed Sep 19 20:35:10 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
--- a/libpurple/protocols/jabber/google.c	Wed Sep 19 19:27:43 2007 +0000
+++ b/libpurple/protocols/jabber/google.c	Wed Sep 19 20:35:10 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]);