about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-09-29 23:55:01 +0100
committerJames Booth <boothj5@gmail.com>2015-09-29 23:55:01 +0100
commit1afe492e307de8f3548ebf2661323ea30e03ed52 (patch)
tree942f6f6a49fd48d23e8b74bd5a0ce2e377b8072b
parent99fc70bd9283280bdb6056634c759196f549a4c6 (diff)
downloadprofani-tty-1afe492e307de8f3548ebf2661323ea30e03ed52.tar.gz
Added jabber:iq:last to capabilities
-rw-r--r--src/xmpp/capabilities.c10
-rw-r--r--src/xmpp/iq.c16
-rw-r--r--src/xmpp/stanza.c2
3 files changed, 17 insertions, 11 deletions
diff --git a/src/xmpp/capabilities.c b/src/xmpp/capabilities.c
index adaea383..cdbb9e4a 100644
--- a/src/xmpp/capabilities.c
+++ b/src/xmpp/capabilities.c
@@ -615,6 +615,10 @@ caps_create_query_response_stanza(xmpp_ctx_t * const ctx)
     xmpp_stanza_set_name(feature_receipts, STANZA_NAME_FEATURE);
     xmpp_stanza_set_attribute(feature_receipts, STANZA_ATTR_VAR, STANZA_NS_RECEIPTS);
 
+    xmpp_stanza_t *feature_last = xmpp_stanza_new(ctx);
+    xmpp_stanza_set_name(feature_last, STANZA_NAME_FEATURE);
+    xmpp_stanza_set_attribute(feature_last, STANZA_ATTR_VAR, STANZA_NS_LASTACTIVITY);
+
     xmpp_stanza_add_child(query, identity);
 
     xmpp_stanza_add_child(query, feature_caps);
@@ -622,15 +626,17 @@ caps_create_query_response_stanza(xmpp_ctx_t * const ctx)
     xmpp_stanza_add_child(query, feature_discoinfo);
     xmpp_stanza_add_child(query, feature_discoitems);
     xmpp_stanza_add_child(query, feature_muc);
-    xmpp_stanza_add_child(query, feature_conference);
     xmpp_stanza_add_child(query, feature_version);
+    xmpp_stanza_add_child(query, feature_last);
+    xmpp_stanza_add_child(query, feature_conference);
     xmpp_stanza_add_child(query, feature_ping);
     xmpp_stanza_add_child(query, feature_receipts);
 
     xmpp_stanza_release(feature_receipts);
     xmpp_stanza_release(feature_ping);
-    xmpp_stanza_release(feature_version);
     xmpp_stanza_release(feature_conference);
+    xmpp_stanza_release(feature_last);
+    xmpp_stanza_release(feature_version);
     xmpp_stanza_release(feature_muc);
     xmpp_stanza_release(feature_discoitems);
     xmpp_stanza_release(feature_discoinfo);
diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c
index 8796cf0b..ba2d8e63 100644
--- a/src/xmpp/iq.c
+++ b/src/xmpp/iq.c
@@ -103,18 +103,18 @@ iq_add_handlers(void)
     xmpp_conn_t * const conn = connection_get_conn();
     xmpp_ctx_t * const ctx = connection_get_ctx();
 
-    HANDLE(NULL,                STANZA_TYPE_ERROR,  _error_handler);
+    HANDLE(NULL,                    STANZA_TYPE_ERROR,  _error_handler);
 
-    HANDLE(XMPP_NS_DISCO_INFO,  STANZA_TYPE_GET,    _disco_info_get_handler);
+    HANDLE(XMPP_NS_DISCO_INFO,      STANZA_TYPE_GET,    _disco_info_get_handler);
 
-    HANDLE(XMPP_NS_DISCO_ITEMS, STANZA_TYPE_GET,    _disco_items_get_handler);
-    HANDLE(XMPP_NS_DISCO_ITEMS, STANZA_TYPE_RESULT, _disco_items_result_handler);
+    HANDLE(XMPP_NS_DISCO_ITEMS,     STANZA_TYPE_GET,    _disco_items_get_handler);
+    HANDLE(XMPP_NS_DISCO_ITEMS,     STANZA_TYPE_RESULT, _disco_items_result_handler);
 
-    HANDLE("jabber:iq:last",    STANZA_TYPE_GET,    _last_activity_get_handler);
+    HANDLE(STANZA_NS_LASTACTIVITY,  STANZA_TYPE_GET,    _last_activity_get_handler);
 
-    HANDLE(STANZA_NS_VERSION,   STANZA_TYPE_GET,    _version_get_handler);
+    HANDLE(STANZA_NS_VERSION,       STANZA_TYPE_GET,    _version_get_handler);
 
-    HANDLE(STANZA_NS_PING,      STANZA_TYPE_GET,    _ping_get_handler);
+    HANDLE(STANZA_NS_PING,          STANZA_TYPE_GET,    _ping_get_handler);
 
     if (prefs_get_autoping() != 0) {
         int millis = prefs_get_autoping() * 1000;
@@ -1107,7 +1107,7 @@ _last_activity_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanz
 
         xmpp_stanza_t *query = xmpp_stanza_new(ctx);
         xmpp_stanza_set_name(query, STANZA_NAME_QUERY);
-        xmpp_stanza_set_attribute(query, STANZA_ATTR_XMLNS, "jabber:iq:last");
+        xmpp_stanza_set_attribute(query, STANZA_ATTR_XMLNS, STANZA_NS_LASTACTIVITY);
         xmpp_stanza_set_attribute(query, "seconds", str);
 
         xmpp_stanza_add_child(response, query);
diff --git a/src/xmpp/stanza.c b/src/xmpp/stanza.c
index 7bd648f7..691441d4 100644
--- a/src/xmpp/stanza.c
+++ b/src/xmpp/stanza.c
@@ -976,7 +976,7 @@ stanza_create_last_activity_iq(xmpp_ctx_t *ctx, const char * const id, const cha
 
     xmpp_stanza_t *query = xmpp_stanza_new(ctx);
     xmpp_stanza_set_name(query, STANZA_NAME_QUERY);
-    xmpp_stanza_set_ns(query, "jabber:iq:last");
+    xmpp_stanza_set_ns(query, STANZA_NS_LASTACTIVITY);
 
     xmpp_stanza_add_child(iq, query);
     xmpp_stanza_release(query);