about summary refs log tree commit diff stats
path: root/src/xmpp
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-04-30 23:00:07 +0100
committerJames Booth <boothj5@gmail.com>2016-04-30 23:00:07 +0100
commit623fbe9e4727f80ff3adaf820f3133e918a3f87e (patch)
treec43c52297197513d7c5e503a4526586c73c16c68 /src/xmpp
parenta718e6f91b53139e35450fb119a3ccd83e48ab26 (diff)
downloadprofani-tty-623fbe9e4727f80ff3adaf820f3133e918a3f87e.tar.gz
Plugins: Added prof_disco_add_feature()
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/capabilities.c22
-rw-r--r--src/xmpp/xmpp.h1
2 files changed, 23 insertions, 0 deletions
diff --git a/src/xmpp/capabilities.c b/src/xmpp/capabilities.c
index db840246..358f6bff 100644
--- a/src/xmpp/capabilities.c
+++ b/src/xmpp/capabilities.c
@@ -57,6 +57,7 @@
 #include "xmpp/stanza.h"
 #include "xmpp/form.h"
 #include "xmpp/capabilities.h"
+#include "plugins/plugins.h"
 
 static gchar *cache_loc;
 static GKeyFile *cache;
@@ -552,6 +553,15 @@ caps_get_my_sha1(xmpp_ctx_t *const ctx)
     return my_sha1;
 }
 
+void
+caps_reset_ver(void)
+{
+    if (my_sha1) {
+        g_free(my_sha1);
+        my_sha1 = NULL;
+    }
+}
+
 xmpp_stanza_t*
 caps_create_query_response_stanza(xmpp_ctx_t *const ctx)
 {
@@ -632,6 +642,18 @@ caps_create_query_response_stanza(xmpp_ctx_t *const ctx)
     xmpp_stanza_add_child(query, feature_ping);
     xmpp_stanza_add_child(query, feature_receipts);
 
+    GList *plugin_features = plugins_get_disco_features();
+    GList *curr = plugin_features;
+    while (curr) {
+        xmpp_stanza_t *feature = xmpp_stanza_new(ctx);
+        xmpp_stanza_set_name(feature, STANZA_NAME_FEATURE);
+        xmpp_stanza_set_attribute(feature, STANZA_ATTR_VAR, curr->data);
+        xmpp_stanza_add_child(query, feature);
+        xmpp_stanza_release(feature);
+
+        curr = g_list_next(curr);
+    }
+
     xmpp_stanza_release(feature_receipts);
     xmpp_stanza_release(feature_ping);
     xmpp_stanza_release(feature_conference);
diff --git a/src/xmpp/xmpp.h b/src/xmpp/xmpp.h
index ea8a6e1d..56a4bf5f 100644
--- a/src/xmpp/xmpp.h
+++ b/src/xmpp/xmpp.h
@@ -190,6 +190,7 @@ void iq_http_upload_request(HTTPUpload *upload);
 Capabilities* caps_lookup(const char *const jid);
 void caps_close(void);
 void caps_destroy(Capabilities *caps);
+void caps_reset_ver(void);
 
 gboolean bookmark_add(const char *jid, const char *nick, const char *password, const char *autojoin_str);
 gboolean bookmark_update(const char *jid, const char *nick, const char *password, const char *autojoin_str);