1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Send diso#info request if capabilities not cached

This commit is contained in:
James Booth 2013-01-20 01:29:15 +00:00
parent f967395f0f
commit 8ff283d44d
3 changed files with 27 additions and 1 deletions

View File

@ -1064,6 +1064,7 @@ _presence_handler(xmpp_conn_t * const conn,
if ((node != NULL) && (ver != NULL)) {
GString *caps_gstr = g_string_new(node);
g_string_append(caps_gstr, "#");
g_string_append(caps_gstr, ver);
caps_str = caps_gstr->str;
g_string_free(caps_gstr, FALSE);
@ -1072,7 +1073,9 @@ _presence_handler(xmpp_conn_t * const conn,
if (caps_str != NULL) {
if (!caps_contains(caps_str)) {
// send iq request for caps info
xmpp_stanza_t *iq = stanza_create_disco_iq(jabber_conn.ctx, from, caps_str);
xmpp_send(jabber_conn.conn, iq);
xmpp_stanza_release(iq);
}
}

View File

@ -178,6 +178,27 @@ stanza_create_roster_iq(xmpp_ctx_t *ctx)
return iq;
}
xmpp_stanza_t *
stanza_create_disco_iq(xmpp_ctx_t *ctx, const char * const to,
const char * const node)
{
xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ);
xmpp_stanza_set_type(iq, STANZA_TYPE_GET);
xmpp_stanza_set_attribute(iq, STANZA_ATTR_TO, to);
xmpp_stanza_set_id(iq, "disco");
xmpp_stanza_t *query = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(query, STANZA_NAME_QUERY);
xmpp_stanza_set_ns(query, XMPP_NS_DISCO_INFO);
xmpp_stanza_set_attribute(query, STANZA_ATTR_NODE, node);
xmpp_stanza_add_child(iq, query);
xmpp_stanza_release(query);
return iq;
}
gboolean
stanza_contains_chat_state(xmpp_stanza_t *stanza)
{

View File

@ -110,6 +110,8 @@ xmpp_stanza_t* stanza_create_presence(xmpp_ctx_t *ctx, const char * const show,
xmpp_stanza_t* stanza_create_roster_iq(xmpp_ctx_t *ctx);
xmpp_stanza_t* stanza_create_ping_iq(xmpp_ctx_t *ctx);
xmpp_stanza_t* stanza_create_disco_iq(xmpp_ctx_t *ctx, const char * const to,
const char * const node);
gboolean stanza_contains_chat_state(xmpp_stanza_t *stanza);