about summary refs log tree commit diff stats
path: root/src/capabilities.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/capabilities.c')
-rw-r--r--src/capabilities.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/capabilities.c b/src/capabilities.c
index 12f16c65..56ca93ea 100644
--- a/src/capabilities.c
+++ b/src/capabilities.c
@@ -27,6 +27,7 @@
 #include <openssl/evp.h>
 #include <strophe.h>
 
+#include "config.h"
 #include "common.h"
 #include "capabilities.h"
 #include "stanza.h"
@@ -169,6 +170,50 @@ caps_get_sha1_str(xmpp_stanza_t *query)
     return result;
 }
 
+xmpp_stanza_t *
+caps_get_query_response_stanza(xmpp_ctx_t *ctx)
+{
+    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_t *identity = xmpp_stanza_new(ctx);
+    xmpp_stanza_set_name(identity, "identity");
+    xmpp_stanza_set_attribute(identity, "category", "client");
+    xmpp_stanza_set_attribute(identity, "type", "pc");
+
+    GString *name_str = g_string_new("Profanity ");
+    g_string_append(name_str, PACKAGE_VERSION);
+    if (strcmp(PACKAGE_STATUS, "development") == 0) {
+        g_string_append(name_str, "dev");
+    }
+    xmpp_stanza_set_attribute(identity, "name", name_str->str);
+
+    xmpp_stanza_t *feature_caps = xmpp_stanza_new(ctx);
+    xmpp_stanza_set_name(feature_caps, STANZA_NAME_FEATURE);
+    xmpp_stanza_set_attribute(feature_caps, STANZA_ATTR_VAR, STANZA_NS_CAPS);
+
+    xmpp_stanza_t *feature_discoinfo = xmpp_stanza_new(ctx);
+    xmpp_stanza_set_name(feature_discoinfo, STANZA_NAME_FEATURE);
+    xmpp_stanza_set_attribute(feature_discoinfo, STANZA_ATTR_VAR, XMPP_NS_DISCO_INFO);
+
+    xmpp_stanza_t *feature_muc = xmpp_stanza_new(ctx);
+    xmpp_stanza_set_name(feature_muc, STANZA_NAME_FEATURE);
+    xmpp_stanza_set_attribute(feature_muc, STANZA_ATTR_VAR, STANZA_NS_MUC);
+
+    xmpp_stanza_t *feature_version = xmpp_stanza_new(ctx);
+    xmpp_stanza_set_name(feature_version, STANZA_NAME_FEATURE);
+    xmpp_stanza_set_attribute(feature_version, STANZA_ATTR_VAR, STANZA_NS_VERSION);
+
+    xmpp_stanza_add_child(query, identity);
+    xmpp_stanza_add_child(query, feature_muc);
+    xmpp_stanza_add_child(query, feature_discoinfo);
+    xmpp_stanza_add_child(query, feature_caps);
+    xmpp_stanza_add_child(query, feature_version);
+
+    return query;
+}
+
 void
 caps_close(void)
 {
Ben Morrison <ben@gbmor.dev> 2019-06-05 00:47:38 -0400 committer Ben Morrison <ben@gbmor.dev> 2019-06-05 00:47:38 -0400 added db type, assets dir to config' href='/gbmor/getwtxt/commit/getwtxt.yml?h=v0.4.13&id=579c0beb541677be2efb49f46f0b2b35c1b9b26e'>579c0be ^
daa4853 ^



69217dd ^
daa4853 ^
1e0e919 ^


4d7c4f5 ^

daa4853 ^
86b7c42 ^

daa4853 ^













1e0e919 ^



daa4853 ^

86b7c42 ^
c5cf0e1 ^
86b7c42 ^
daa4853 ^
c5cf0e1 ^
daa4853 ^



c5cf0e1 ^
daa4853 ^

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106