diff libpurple/protocols/jabber/google.c @ 25648:050052891c55

Pass IQ handlers type, from, id, and the child node As QuLogic pointed out in 8a80f271, it's pointless for the handlers to re-get the information from the IQ stanza. Additionally, instead of string-matching the type everywhere, pass around a JabberIqType. Last, 'child' cannot be NULL, but 'from' may be.
author Paul Aurich <paul@darkrain42.org>
date Sun, 08 Feb 2009 06:31:18 +0000
parents 36c73d036026
children 439f07ce4c8a
line wrap: on
line diff
--- a/libpurple/protocols/jabber/google.c	Sun Feb 08 04:30:23 2009 +0000
+++ b/libpurple/protocols/jabber/google.c	Sun Feb 08 06:31:18 2009 +0000
@@ -144,9 +144,9 @@
 }
 
 void
-jabber_gmail_poke(JabberStream *js, xmlnode *packet)
+jabber_gmail_poke(JabberStream *js, const char *from, JabberIqType type,
+                  const char *id, xmlnode *new_mail)
 {
-	const char *type;
 	xmlnode *query;
 	JabberIq *iq;
 
@@ -154,11 +154,8 @@
 	if (!purple_account_get_check_mail(js->gc->account))
 		return;
 
-	type = xmlnode_get_attrib(packet, "type");
-
-
 	/* Is this an initial incoming mail notification? If so, send a request for more info */
-	if (strcmp(type, "set") || !xmlnode_get_child(packet, "new-mail"))
+	if (type != JABBER_IQ_SET)
 		return;
 
 	purple_debug(PURPLE_DEBUG_MISC, "jabber",