cpw.darkrain42.xmpp.iq-handlers: 71472efa: Reduce the debug log spam from the ping ...

paul at darkrain42.org paul at darkrain42.org
Sun Feb 8 15:25:27 EST 2009


-----------------------------------------------------------------
Revision: 71472efa8c0b361169eb3e31c1dfaee75fdc67a1
Ancestor: feeb9fc1d00e482ebf1a6c28889fe48d5ccfbfeb
Author: paul at darkrain42.org
Date: 2009-02-08T16:50:58
Branch: im.pidgin.cpw.darkrain42.xmpp.iq-handlers
URL: http://d.pidgin.im/viewmtn/revision/info/71472efa8c0b361169eb3e31c1dfaee75fdc67a1

Modified files:
        libpurple/protocols/jabber/ping.c

ChangeLog: 

Reduce the debug log spam from the ping code and fix a logic error.

The response will come from our own bare JID (or have no 'from' attributes)
for the keepalive pings.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/ping.c	4083811c6d5c709175584918789f4a7f359e7876
+++ libpurple/protocols/jabber/ping.c	b826144e95aa9ae66244e219b0e678daabefe3d4
@@ -38,8 +38,6 @@ jabber_ping_parse(JabberStream *js, cons
 jabber_ping_parse(JabberStream *js, const char *from,
                   JabberIqType type, const char *id, xmlnode *ping)
 {
-	purple_debug_info("jabber", "jabber_ping_parse\n");
-
 	if (type == JABBER_IQ_GET) {
 		JabberIq *iq = jabber_iq_new(js, JABBER_IQ_RESULT);
 
@@ -58,14 +56,15 @@ static void jabber_ping_result_cb(Jabber
 {
 	const char *type = xmlnode_get_attrib(packet, "type");
 	const char *from = xmlnode_get_attrib(packet, "from");
+	char *own_bare_jid = g_strdup_printf("%s@%s", js->user->node,
+	                                     js->user->domain);
 
-	purple_debug_info("jabber", "jabber_ping_result_cb\n");
-
-	if (!from || !strcmp(from, js->user->domain)) {
-		/* If the pong is from our server, treat it as a return from the
+	if (!from || !strcmp(from, own_bare_jid)) {
+		/* If the pong is from our bare JID, treat it as a return from the
 		 * keepalive functions */
 		jabber_keepalive_pong_cb(js);
 	}
+	g_free(own_bare_jid);
 
 	if(type && !strcmp(type, "result")) {
 		purple_debug_info("jabber", "PONG!\n");
@@ -79,8 +78,6 @@ gboolean jabber_ping_jid(JabberStream *j
 	JabberIq *iq;
 	xmlnode *ping;
 
-	purple_debug_info("jabber", "jabber_ping_jid\n");
-
 	iq = jabber_iq_new(js, JABBER_IQ_GET);
 	if (jid)
 		xmlnode_set_attrib(iq->node, "to", jid);


More information about the Commits mailing list