diff --git a/src/ping.c b/src/ping.c index ac0e4f5..fc66c80 100644 --- a/src/ping.c +++ b/src/ping.c @@ -28,7 +28,7 @@ void xmppipe_ping(xmppipe_state_t *state) { iq = xmppipe_stanza_new(state->ctx); xmppipe_stanza_set_name(iq, "iq"); xmppipe_stanza_set_type(iq, "get"); - xmppipe_stanza_set_id(iq, "c2s1"); + xmppipe_stanza_set_id(iq, XMPPIPE_KEEPALIVE_ID); xmppipe_stanza_set_attribute(iq, "from", xmpp_conn_get_bound_jid(state->conn)); diff --git a/src/xmppipe.c b/src/xmppipe.c index f8f7fd1..b0af4e5 100644 --- a/src/xmppipe.c +++ b/src/xmppipe.c @@ -354,7 +354,8 @@ int xmppipe_stream_init(xmppipe_state_t *state) { xmpp_handler_add(state->conn, handle_iq, NULL, "iq", "result", state); xmpp_handler_add(state->conn, handle_pong, "urn:xmpp:ping", "iq", "get", state); - xmpp_id_handler_add(state->conn, handle_ping_reply, "c2s1", state); + xmpp_id_handler_add(state->conn, handle_ping_reply, XMPPIPE_KEEPALIVE_ID, + state); xmpp_handler_add(state->conn, handle_disco_items, "http://jabber.org/protocol/disco#items", "iq", "result", diff --git a/src/xmppipe.h b/src/xmppipe.h index b02a2c8..9b1afce 100644 --- a/src/xmppipe.h +++ b/src/xmppipe.h @@ -28,6 +28,7 @@ #define XMPPIPE_VERSION "0.15.0" #define XMPPIPE_RESOURCE "xmppipe" +#define XMPPIPE_KEEPALIVE_ID "xmppipe_keepalive" #define XMPPIPE_STREQ(a, b) (strcmp((a), (b)) == 0) #define XMPPIPE_STRNEQ(a, b) (strcmp((a), (b)) != 0)