about summary refs log tree commit diff stats
path: root/src/stanza.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-01-21 22:05:30 +0000
committerJames Booth <boothj5@gmail.com>2013-01-21 22:05:30 +0000
commit745786434738a9626aa813028ae107f17a2197e2 (patch)
tree41f098da9dfe9c1c2f74bb173787694d1425e6c3 /src/stanza.c
parentdf38fc332a2593514cb94c9a632e522f11c5583e (diff)
downloadprofani-tty-745786434738a9626aa813028ae107f17a2197e2.tar.gz
Added software version capability and iq response
Diffstat (limited to 'src/stanza.c')
-rw-r--r--src/stanza.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/stanza.c b/src/stanza.c
index dd71d277..5e90cf90 100644
--- a/src/stanza.c
+++ b/src/stanza.c
@@ -432,6 +432,34 @@ stanza_contains_caps(xmpp_stanza_t * const stanza)
 }
 
 gboolean
+stanza_is_version_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, STANZA_NS_VERSION) != 0) {
+        return FALSE;
+    }
+
+    return TRUE;
+}
+
+gboolean
 stanza_is_caps_request(xmpp_stanza_t * const stanza)
 {
     char *type = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_TYPE);