diff options
author | James Booth <boothj5@gmail.com> | 2013-01-21 02:18:03 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2013-01-21 02:18:03 +0000 |
commit | df790e247cb9573add96e39b49162ad20a47534e (patch) | |
tree | 40a2a58613cebe5c12c00c755d59bb03d3603095 /src/stanza.c | |
parent | 97a497c355a4a80be1dc6e31c41dc587c6dda629 (diff) | |
download | profani-tty-df790e247cb9573add96e39b49162ad20a47534e.tar.gz |
Respond to iq requests for capabilities
Diffstat (limited to 'src/stanza.c')
-rw-r--r-- | src/stanza.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/stanza.c b/src/stanza.c index 4274ed22..dd71d277 100644 --- a/src/stanza.c +++ b/src/stanza.c @@ -431,6 +431,34 @@ stanza_contains_caps(xmpp_stanza_t * const stanza) return TRUE; } +gboolean +stanza_is_caps_request(xmpp_stanza_t * const stanza) +{ + char *type = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_TYPE); + + if (g_strcmp0(type, STANZA_TYPE_GET) != 0) { + return FALSE; + } + + xmpp_stanza_t *query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY); + + if (query == NULL) { + return FALSE; + } + + char *ns = xmpp_stanza_get_ns(query); + + if (ns == NULL) { + return FALSE; + } + + if (strcmp(ns, XMPP_NS_DISCO_INFO) != 0) { + return FALSE; + } + + return TRUE; +} + char * stanza_caps_get_hash(xmpp_stanza_t * const stanza) { |