Mercurial > pidgin.yaz
changeset 26999:6b0e150f2276
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: <iq type='get' id='purplefc9e10a4' to='livejournal.com'><ping xmlns='urn:xmpp:ping'/></iq>
S: <iq to='Adium user' type='error' id='purplefc9e10a4'><ping xmlns='urn:xmpp:ping'/><error type='cancel'><feature-not-implemented xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/><text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas' xml:lang='en'>This feature is not implemented yet in DJabberd.</text></error></iq>
This fixes Adium#12124.
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Wed, 20 May 2009 00:34:59 +0000 |
parents | bf3ad70508f4 |
children | a6a4b440e5ae |
files | libpurple/protocols/jabber/jabber.c libpurple/protocols/jabber/ping.c libpurple/protocols/jabber/ping.h |
diffstat | 3 files changed, 22 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- 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); }
--- 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)
--- 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_ */