Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/xmpp_helper.c @ 1600:c5ee395fbc8c
Updated Entity Capabilities support (XEP-0115)
author | franky |
---|---|
date | Tue, 23 Sep 2008 10:59:25 +0200 |
parents | dcd5d4c75199 |
children | f4a2c6f767d1 |
comparison
equal
deleted
inserted
replaced
1599:dcd5d4c75199 | 1600:c5ee395fbc8c |
---|---|
123 lm_message_node_set_attribute(new->node, "id", id); | 123 lm_message_node_set_attribute(new->node, "id", id); |
124 | 124 |
125 return new; | 125 return new; |
126 } | 126 } |
127 | 127 |
128 // entity_version() | 128 // entity_version(enum imstatus status) |
129 // Return a static version string for Entity Capabilities. | 129 // Return a static version string for Entity Capabilities. |
130 // It should be specific to the client version, please change the id | 130 // It should be specific to the client version, please change the id |
131 // if you alter mcabber's disco support (or add something to the version | 131 // if you alter mcabber's disco support (or add something to the version |
132 // number) so that it doesn't conflict with the official client. | 132 // number) so that it doesn't conflict with the official client. |
133 const char *entity_version(void) | 133 const char *entity_version(enum imstatus status) |
134 { | 134 { |
135 static char *ver; | 135 static char *ver, *ver_notavail; |
136 const char *PVERSION = PACKAGE_VERSION; // "+xxx"; | 136 |
137 | 137 if (ver && (status != notavail)) |
138 if (ver) | |
139 return ver; | 138 return ver; |
140 | 139 if (ver_notavail) |
141 #ifdef HGCSET | 140 return ver_notavail; |
142 ver = g_strdup_printf("%s-%s", PVERSION, HGCSET); | 141 |
143 #else | 142 caps_add(""); |
144 ver = g_strdup(PVERSION); | 143 caps_set_identity("", "client", PACKAGE_STRING, "pc"); |
145 #endif | 144 caps_add_feature("", NS_DISCO_INFO); |
146 | 145 caps_add_feature("", NS_MUC); |
146 // advertise ChatStates only if they aren't disabled | |
147 if (!settings_opt_get_int("disable_chatstates")) | |
148 caps_add_feature("", NS_CHATSTATES); | |
149 caps_add_feature("", NS_TIME); | |
150 caps_add_feature("", NS_XMPP_TIME); | |
151 caps_add_feature("", NS_VERSION); | |
152 caps_add_feature("", NS_PING); | |
153 caps_add_feature("", NS_COMMANDS); | |
154 if (!settings_opt_get_int("iq_last_disable") && | |
155 (!settings_opt_get_int("iq_last_disable_when_notavail") || | |
156 status != notavail)) | |
157 caps_add_feature("", NS_LAST); | |
158 | |
159 if (status == notavail) { | |
160 ver_notavail = caps_generate(); | |
161 return ver_notavail; | |
162 } | |
163 | |
164 ver = caps_generate(); | |
147 return ver; | 165 return ver; |
148 } | 166 } |
149 | 167 |
150 inline static LmMessageNode *lm_message_node_find_xmlns(LmMessageNode *node, | 168 inline static LmMessageNode *lm_message_node_find_xmlns(LmMessageNode *node, |
151 const char *xmlns) | 169 const char *xmlns) |