changeset 25063:8f5a63aebdb6

merge of '0bfcaf78ec07efb71812fff2c8b738b4532aac7f' and '8a80f271858548f73cac50625660e87df1970bcc'
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Thu, 05 Feb 2009 06:25:18 +0000
parents 49d51dbcb799 (current diff) e30e9779e7bf (diff)
children 9c96fb57632d 3c9af6627767 a34d6975c239 6f1bd5f3aaa0 4561aa5b368c
files
diffstat 10 files changed, 30 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/data.c	Wed Feb 04 22:46:45 2009 +0000
+++ b/libpurple/protocols/jabber/data.c	Thu Feb 05 06:25:18 2009 +0000
@@ -200,11 +200,9 @@
 }
 
 void
-jabber_data_parse(JabberStream *js, xmlnode *packet)
+jabber_data_parse(JabberStream *js, xmlnode *data_node, const char *who, const char *id)
 {
 	JabberIq *result = NULL;
-	const char *who = xmlnode_get_attrib(packet, "from");
-	xmlnode *data_node = xmlnode_get_child(packet, "data");
 	const JabberData *data =
 		jabber_data_find_local_by_cid(xmlnode_get_attrib(data_node, "cid"));
 
@@ -213,12 +211,12 @@
 
 		result = jabber_iq_new(js, JABBER_IQ_ERROR);
 		xmlnode_set_attrib(result->node, "to", who);
-		xmlnode_set_attrib(result->node, "id", xmlnode_get_attrib(packet, "id"));
+		xmlnode_set_attrib(result->node, "id", id);
 		xmlnode_insert_child(result->node, item_not_found);
 	} else {
 		result = jabber_iq_new(js, JABBER_IQ_RESULT);
 		xmlnode_set_attrib(result->node, "to", who);
-		xmlnode_set_attrib(result->node, "id", xmlnode_get_attrib(packet, "id"));
+		xmlnode_set_attrib(result->node, "id", id);
 		xmlnode_insert_child(result->node,
 							 jabber_data_get_xml_definition(data));
 	}
--- a/libpurple/protocols/jabber/data.h	Wed Feb 04 22:46:45 2009 +0000
+++ b/libpurple/protocols/jabber/data.h	Thu Feb 05 06:25:18 2009 +0000
@@ -65,7 +65,8 @@
 void jabber_data_associate_remote(JabberData *data);
 
 /* handles iq requests */
-void jabber_data_parse(JabberStream *js, xmlnode *packet);
+void jabber_data_parse(JabberStream *js, xmlnode *data_node,
+                       const char *who, const char *id);
 
 void jabber_data_init(void);
 void jabber_data_uninit(void);
--- a/libpurple/protocols/jabber/google.c	Wed Feb 04 22:46:45 2009 +0000
+++ b/libpurple/protocols/jabber/google.c	Thu Feb 05 06:25:18 2009 +0000
@@ -144,9 +144,8 @@
 }
 
 void
-jabber_gmail_poke(JabberStream *js, xmlnode *packet)
+jabber_gmail_poke(JabberStream *js, const char *type)
 {
-	const char *type;
 	xmlnode *query;
 	JabberIq *iq;
 
@@ -154,11 +153,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 (strcmp(type, "set"))
 		return;
 
 	purple_debug(PURPLE_DEBUG_MISC, "jabber",
--- a/libpurple/protocols/jabber/google.h	Wed Feb 04 22:46:45 2009 +0000
+++ b/libpurple/protocols/jabber/google.h	Thu Feb 05 06:25:18 2009 +0000
@@ -27,7 +27,7 @@
 #include "jabber.h"
 
 void jabber_gmail_init(JabberStream *js);
-void jabber_gmail_poke(JabberStream *js, xmlnode *node);
+void jabber_gmail_poke(JabberStream *js, const char *type);
 
 void jabber_google_roster_init(JabberStream *js);
 void jabber_google_roster_outgoing(JabberStream *js, xmlnode *query, xmlnode *item);
--- a/libpurple/protocols/jabber/iq.c	Wed Feb 04 22:46:45 2009 +0000
+++ b/libpurple/protocols/jabber/iq.c	Thu Feb 05 06:25:18 2009 +0000
@@ -309,7 +309,7 @@
 void jabber_iq_parse(JabberStream *js, xmlnode *packet)
 {
 	JabberCallbackData *jcd;
-	xmlnode *query, *error, *x;
+	xmlnode *child, *query, *error, *x;
 	const char *xmlns;
 	const char *type, *id, *from;
 	JabberIqHandler *jih;
@@ -371,25 +371,25 @@
 		}
 	}
 
-	if(xmlnode_get_child_with_namespace(packet, "si", "http://jabber.org/protocol/si")) {
-		jabber_si_parse(js, packet);
+	if ((child = xmlnode_get_child_with_namespace(packet, "si", "http://jabber.org/protocol/si"))) {
+		jabber_si_parse(js, child, from, id);
 		return;
 	}
 
-	if(xmlnode_get_child_with_namespace(packet, "new-mail", "google:mail:notify")) {
-		jabber_gmail_poke(js, packet);
+	if (xmlnode_get_child_with_namespace(packet, "new-mail", "google:mail:notify")) {
+		jabber_gmail_poke(js, type);
 		return;
 	}
 
 	purple_debug_info("jabber", "jabber_iq_parse\n");
 
-	if(xmlnode_get_child_with_namespace(packet, "ping", "urn:xmpp:ping")) {
-		jabber_ping_parse(js, packet);
+	if (xmlnode_get_child_with_namespace(packet, "ping", "urn:xmpp:ping")) {
+		jabber_ping_parse(js, from, id);
 		return;
 	}
 
-	if (xmlnode_get_child_with_namespace(packet, "data", XEP_0231_NAMESPACE)) {
-		jabber_data_parse(js, packet);
+	if ((child = xmlnode_get_child_with_namespace(packet, "data", XEP_0231_NAMESPACE))) {
+		jabber_data_parse(js, child, from, id);
 		return;
 	}
 
--- a/libpurple/protocols/jabber/ping.c	Wed Feb 04 22:46:45 2009 +0000
+++ b/libpurple/protocols/jabber/ping.c	Thu Feb 05 06:25:18 2009 +0000
@@ -30,7 +30,7 @@
 #include "iq.h"
 
 void
-jabber_ping_parse(JabberStream *js, xmlnode *packet)
+jabber_ping_parse(JabberStream *js, const char *from, const char *id)
 {
 	JabberIq *iq;
 
@@ -38,9 +38,9 @@
 
 	iq = jabber_iq_new(js, JABBER_IQ_RESULT);
 
-	xmlnode_set_attrib(iq->node, "to", xmlnode_get_attrib(packet, "from") );
+	xmlnode_set_attrib(iq->node, "to", from);
 
-	jabber_iq_set_id(iq, xmlnode_get_attrib(packet, "id"));
+	jabber_iq_set_id(iq, id);
 
 	jabber_iq_send(iq);
 }
--- a/libpurple/protocols/jabber/ping.h	Wed Feb 04 22:46:45 2009 +0000
+++ b/libpurple/protocols/jabber/ping.h	Thu Feb 05 06:25:18 2009 +0000
@@ -26,7 +26,8 @@
 #include "conversation.h"
 
 void jabber_ping_parse(JabberStream *js,
-						xmlnode *packet);
+                       const char *from,
+                       const char *id);
 
 
 gboolean jabber_ping_jid(PurpleConversation *conv, const char *jid);
--- a/libpurple/protocols/jabber/si.c	Wed Feb 04 22:46:45 2009 +0000
+++ b/libpurple/protocols/jabber/si.c	Thu Feb 05 06:25:18 2009 +0000
@@ -1182,17 +1182,14 @@
 		purple_xfer_request(xfer);
 }
 
-void jabber_si_parse(JabberStream *js, xmlnode *packet)
+void jabber_si_parse(JabberStream *js, xmlnode *si, const char *from, const char *id)
 {
 	JabberSIXfer *jsx;
 	PurpleXfer *xfer;
-	xmlnode *si, *file, *feature, *x, *field, *option, *value;
-	const char *stream_id, *filename, *filesize_c, *profile, *from;
+	xmlnode *file, *feature, *x, *field, *option, *value;
+	const char *stream_id, *filename, *filesize_c, *profile;
 	size_t filesize = 0;
 
-	if(!(si = xmlnode_get_child(packet, "si")))
-		return;
-
 	if(!(profile = xmlnode_get_attrib(si, "profile")) ||
 			strcmp(profile, "http://jabber.org/protocol/si/profile/file-transfer"))
 		return;
@@ -1215,7 +1212,7 @@
 	if(!(x = xmlnode_get_child_with_namespace(feature, "x", "jabber:x:data")))
 		return;
 
-	if(!(from = xmlnode_get_attrib(packet, "from")))
+	if(!from)
 		return;
 
 	/* if they've already sent us this file transfer with the same damn id
@@ -1256,7 +1253,7 @@
 
 	jsx->js = js;
 	jsx->stream_id = g_strdup(stream_id);
-	jsx->iq_id = g_strdup(xmlnode_get_attrib(packet, "id"));
+	jsx->iq_id = g_strdup(id);
 
 	xfer = purple_xfer_new(js->gc->account, PURPLE_XFER_RECEIVE, from);
 	if (xfer)
--- a/libpurple/protocols/jabber/si.h	Wed Feb 04 22:46:45 2009 +0000
+++ b/libpurple/protocols/jabber/si.h	Thu Feb 05 06:25:18 2009 +0000
@@ -27,7 +27,7 @@
 #include "jabber.h"
 
 void jabber_bytestreams_parse(JabberStream *js, xmlnode *packet);
-void jabber_si_parse(JabberStream *js, xmlnode *packet);
+void jabber_si_parse(JabberStream *js, xmlnode *si, const char *from, const char *id);
 PurpleXfer *jabber_si_new_xfer(PurpleConnection *gc, const char *who);
 void jabber_si_xfer_send(PurpleConnection *gc, const char *who, const char *file);
 
--- a/libpurple/protocols/msn/msg.c	Wed Feb 04 22:46:45 2009 +0000
+++ b/libpurple/protocols/msn/msg.c	Thu Feb 05 06:25:18 2009 +0000
@@ -80,7 +80,7 @@
 	msg->ref_count++;
 
 #ifdef MSN_DEBUG_MSG
-	purple_debug_info("msn", "message ref (%p)[%d]\n", msg, msg->ref_count);
+	purple_debug_info("msn", "message ref (%p)[%" G_GSIZE_FORMAT "]\n", msg, msg->ref_count);
 #endif
 
 	return msg;
@@ -95,7 +95,7 @@
 	msg->ref_count--;
 
 #ifdef MSN_DEBUG_MSG
-	purple_debug_info("msn", "message unref (%p)[%d]\n", msg, msg->ref_count);
+	purple_debug_info("msn", "message unref (%p)[%" G_GSIZE_FORMAT "]\n", msg, msg->ref_count);
 #endif
 
 	if (msg->ref_count == 0)