ping: use a constant stanza ID

master
Michael Santos 6 months ago
parent 93dcf31d91
commit 49133ef253

@ -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));

@ -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",

@ -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)

Loading…
Cancel
Save