Mercurial > pidgin
diff libpurple/protocols/jabber/ping.c @ 26985:bc2aa262a567
propagate from branch 'im.pidgin.pidgin' (head ca6eb11f6084be37aeabcb2d99df789aaf8b4afd)
to branch 'im.pidgin.cpw.malu.client_type' (head 61fe08ebe574f1112f120259839dbc0474a701cb)
author | Marcus Lundblad <ml@update.uu.se> |
---|---|
date | Mon, 25 May 2009 19:24:17 +0000 |
parents | 6b0e150f2276 |
children | 08f5c5b12e7c |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/ping.c Sun May 17 19:04:15 2009 +0000 +++ b/libpurple/protocols/jabber/ping.c Mon May 25 19:24:17 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)