changeset 20202:71b9f22d97c7

applied changes from 19e3744fd4b392cdc631c9efe0ce658537070713 through b8e1742d36c8359edf356bc6db9c2b945533c29d excluding ChangeLog
author Richard Laager <rlaager@wiktel.com>
date Fri, 28 Sep 2007 15:23:54 +0000
parents 6b17f0424f25
children a842ee320d51
files libpurple/protocols/jabber/google.c
diffstat 1 files changed, 19 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/google.c	Fri Sep 28 15:22:23 2007 +0000
+++ b/libpurple/protocols/jabber/google.c	Fri Sep 28 15:23:54 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]);