Mercurial > hg
comparison mcabber/src/jab_iq.c @ 690:3e965a1186c7
Implement IQ:version requests
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Thu, 09 Feb 2006 23:20:28 +0100 |
parents | 281aab5aef50 |
children | 3c0a0a993de8 |
comparison
equal
deleted
inserted
replaced
689:281aab5aef50 | 690:3e965a1186c7 |
---|---|
239 update_roster = TRUE; | 239 update_roster = TRUE; |
240 if (need_refresh) | 240 if (need_refresh) |
241 scr_ShowBuddyWindow(); | 241 scr_ShowBuddyWindow(); |
242 } | 242 } |
243 | 243 |
244 void iqscallback_version(iqs *iqp, xmlnode xml_result) | |
245 { | |
246 xmlnode ansqry; | |
247 char *p, *p_noutf8; | |
248 | |
249 // xml_result is null for timeouts and errors | |
250 if (!xml_result) return; | |
251 | |
252 ansqry = xmlnode_get_tag(xml_result, "query"); | |
253 if (!ansqry) { | |
254 scr_LogPrint(LPRINT_LOGNORM, "Invalid IQ:version result!"); | |
255 return; | |
256 } | |
257 // Display IQ result sender... | |
258 p = xmlnode_get_attrib(xml_result, "from"); | |
259 if (!p) { | |
260 scr_LogPrint(LPRINT_LOGNORM, "Invalid IQ:version result (no sender name)."); | |
261 return; | |
262 } | |
263 p_noutf8 = from_utf8(p); | |
264 if (p_noutf8) { | |
265 scr_LogPrint(LPRINT_LOGNORM, "IQ:version from <%s>", p_noutf8); | |
266 g_free(p_noutf8); | |
267 } | |
268 // Get result data... | |
269 p = xmlnode_get_tag_data(ansqry, "name"); | |
270 if (p) { | |
271 p_noutf8 = from_utf8(p); | |
272 if (p_noutf8) { | |
273 scr_LogPrint(LPRINT_LOGNORM, "Name: %s", p_noutf8); | |
274 g_free(p_noutf8); | |
275 } | |
276 } | |
277 p = xmlnode_get_tag_data(ansqry, "version"); | |
278 if (p) { | |
279 p_noutf8 = from_utf8(p); | |
280 if (p_noutf8) { | |
281 scr_LogPrint(LPRINT_LOGNORM, "Version: %s", p_noutf8); | |
282 g_free(p_noutf8); | |
283 } | |
284 } | |
285 p = xmlnode_get_tag_data(ansqry, "os"); | |
286 if (p) { | |
287 p_noutf8 = from_utf8(p); | |
288 if (p_noutf8) { | |
289 scr_LogPrint(LPRINT_LOGNORM, "OS: %s", p_noutf8); | |
290 g_free(p_noutf8); | |
291 } | |
292 } | |
293 } | |
294 | |
295 void request_version(const char *fulljid) | |
296 { | |
297 iqs *iqn; | |
298 gchar *utf8_jid = to_utf8(fulljid); | |
299 | |
300 iqn = iqs_new(JPACKET__GET, NS_VERSION, "version", IQS_DEFAULT_TIMEOUT); | |
301 xmlnode_put_attrib(iqn->xmldata, "to", utf8_jid); | |
302 if (utf8_jid) g_free(utf8_jid); | |
303 iqn->callback = &iqscallback_version; | |
304 jab_send(jc, iqn->xmldata); | |
305 } | |
306 | |
244 void iqscallback_auth(iqs *iqp, xmlnode xml_result) | 307 void iqscallback_auth(iqs *iqp, xmlnode xml_result) |
245 { | 308 { |
246 if (jstate == STATE_GETAUTH) { | 309 if (jstate == STATE_GETAUTH) { |
247 iqs *iqn; | 310 iqs *iqn; |
248 | 311 |