comparison mcabber/src/xmpp_helper.c @ 1607:14690e624e9d

Add modules
author Myhailo Danylenko <isbear@ukrpost.net>
date Sun, 11 Oct 2009 16:01:52 +0200
parents 351427ef0b4b
children
comparison
equal deleted inserted replaced
1606:d7f26538c24c 1607:14690e624e9d
28 #include "xmpp_helper.h" 28 #include "xmpp_helper.h"
29 #include "settings.h" 29 #include "settings.h"
30 #include "utils.h" 30 #include "utils.h"
31 #include "caps.h" 31 #include "caps.h"
32 #include "logprint.h" 32 #include "logprint.h"
33 #include "config.h"
33 34
34 time_t iqlast; // last message/status change time 35 time_t iqlast; // last message/status change time
35 36
36 extern char *imstatus_showmap[]; 37 extern char *imstatus_showmap[];
37 38
72 "Disconnected", "service-unavailable", "cancel"}, 73 "Disconnected", "service-unavailable", "cancel"},
73 {0, NULL, NULL, NULL, NULL} 74 {0, NULL, NULL, NULL, NULL}
74 }; 75 };
75 76
76 77
78 #ifdef MODULES_ENABLE
79 static GSList *xmpp_additional_features = NULL;
80 static char *ver, *ver_notavail;
81
82 void xmpp_add_feature (const char *xmlns)
83 {
84 if (xmlns) {
85 ver = NULL;
86 ver_notavail = NULL;
87 xmpp_additional_features = g_slist_append(xmpp_additional_features,
88 g_strdup (xmlns));
89 }
90 }
91
92 void xmpp_del_feature (const char *xmlns)
93 {
94 GSList *feature = xmpp_additional_features;
95 while (feature) {
96 if (!strcmp(feature->data, xmlns)) {
97 ver = NULL;
98 ver_notavail = NULL;
99 g_free (feature->data);
100 xmpp_additional_features = g_slist_delete_link(xmpp_additional_features,
101 feature);
102 return;
103 }
104 feature = g_slist_next (feature);
105 }
106 }
107 #endif
108
77 const gchar* lm_message_node_get_child_value(LmMessageNode *node, 109 const gchar* lm_message_node_get_child_value(LmMessageNode *node,
78 const gchar *child) 110 const gchar *child)
79 { 111 {
80 LmMessageNode *tmp; 112 LmMessageNode *tmp;
81 tmp = lm_message_node_find_child(node, child); 113 tmp = lm_message_node_find_child(node, child);
178 // It should be specific to the client version, please change the id 210 // It should be specific to the client version, please change the id
179 // if you alter mcabber's disco support (or add something to the version 211 // if you alter mcabber's disco support (or add something to the version
180 // number) so that it doesn't conflict with the official client. 212 // number) so that it doesn't conflict with the official client.
181 const char *entity_version(enum imstatus status) 213 const char *entity_version(enum imstatus status)
182 { 214 {
215 #ifndef MODULES_ENABLE
183 static char *ver, *ver_notavail; 216 static char *ver, *ver_notavail;
217 #endif
184 218
185 if (ver && (status != notavail)) 219 if (ver && (status != notavail))
186 return ver; 220 return ver;
187 if (ver_notavail) 221 if (ver_notavail)
188 return ver_notavail; 222 return ver_notavail;
202 caps_add_feature("", NS_RECEIPTS); 236 caps_add_feature("", NS_RECEIPTS);
203 if (!settings_opt_get_int("iq_last_disable") && 237 if (!settings_opt_get_int("iq_last_disable") &&
204 (!settings_opt_get_int("iq_last_disable_when_notavail") || 238 (!settings_opt_get_int("iq_last_disable_when_notavail") ||
205 status != notavail)) 239 status != notavail))
206 caps_add_feature("", NS_LAST); 240 caps_add_feature("", NS_LAST);
241 #ifdef MODULES_ENABLE
242 {
243 GSList *el = xmpp_additional_features;
244 while (el) {
245 caps_add_feature("", el->data);
246 el = g_slist_next (el);
247 }
248 }
249 #endif
207 250
208 if (status == notavail) { 251 if (status == notavail) {
209 ver_notavail = caps_generate(); 252 ver_notavail = caps_generate();
210 return ver_notavail; 253 return ver_notavail;
211 } 254 }