# HG changeset patch # User Paul Aurich # Date 1242779699 0 # Node ID 6b0e150f2276e1aa208e41fc829c285066a1a57e # Parent bf3ad70508f486ac955868cebcc1fe33bae7bc30 Stop trying to be clever with XMPP keepalive pings. djabberd is responding like this (note no 'from' on the reply. No, I haven't yet filed a bug with them): C: S: This feature is not implemented yet in DJabberd. This fixes Adium#12124. diff -r bf3ad70508f4 -r 6b0e150f2276 libpurple/protocols/jabber/jabber.c --- a/libpurple/protocols/jabber/jabber.c Tue May 19 06:47:40 2009 +0000 +++ b/libpurple/protocols/jabber/jabber.c Wed May 20 00:34:59 2009 +0000 @@ -483,7 +483,7 @@ JabberStream *js = gc->proto_data; if (js->keepalive_timeout == -1) { - jabber_ping_jid(js, js->user->domain); + jabber_keepalive_ping(js); js->keepalive_timeout = purple_timeout_add_seconds(120, (GSourceFunc)(jabber_keepalive_timeout), gc); } diff -r bf3ad70508f4 -r 6b0e150f2276 libpurple/protocols/jabber/ping.c --- a/libpurple/protocols/jabber/ping.c Tue May 19 06:47:40 2009 +0000 +++ b/libpurple/protocols/jabber/ping.c Wed May 20 00:34:59 2009 +0000 @@ -28,7 +28,9 @@ #include "ping.h" #include "iq.h" -static void jabber_keepalive_pong_cb(JabberStream *js) +static void jabber_keepalive_pong_cb(JabberStream *js, const char *from, + JabberIqType type, const char *id, + xmlnode *packet, gpointer data) { if (js->keepalive_timeout >= 0) { purple_timeout_remove(js->keepalive_timeout); @@ -57,16 +59,23 @@ JabberIqType type, const char *id, xmlnode *packet, gpointer data) { - if (purple_strequal(from, js->user->domain)) - /* If the pong is from the server, assume it's a result of the - * keepalive functions */ - jabber_keepalive_pong_cb(js); - else { - if (type == JABBER_IQ_RESULT) - purple_debug_info("jabber", "PONG!\n"); - else - purple_debug_info("jabber", "ping not supported\n"); - } + if (type == JABBER_IQ_RESULT) + purple_debug_info("jabber", "PONG!\n"); + else + purple_debug_info("jabber", "ping not supported\n"); +} + +void jabber_keepalive_ping(JabberStream *js) +{ + JabberIq *iq; + xmlnode *ping; + + iq = jabber_iq_new(js, JABBER_IQ_GET); + ping = xmlnode_new_child(iq->node, "ping"); + xmlnode_set_namespace(ping, "urn:xmpp:ping"); + + jabber_iq_set_callback(iq, jabber_keepalive_pong_cb, NULL); + jabber_iq_send(iq); } gboolean jabber_ping_jid(JabberStream *js, const char *jid) diff -r bf3ad70508f4 -r 6b0e150f2276 libpurple/protocols/jabber/ping.h --- a/libpurple/protocols/jabber/ping.h Tue May 19 06:47:40 2009 +0000 +++ b/libpurple/protocols/jabber/ping.h Wed May 20 00:34:59 2009 +0000 @@ -29,5 +29,6 @@ void jabber_ping_parse(JabberStream *js, const char *from, JabberIqType, const char *id, xmlnode *child); gboolean jabber_ping_jid(JabberStream *js, const char *jid); +void jabber_keepalive_ping(JabberStream *js); #endif /* PURPLE_JABBER_PING_H_ */