Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/xmpp_iqrequest.c @ 1899:decf94827efe
More lm_message_node_get_child_value() return value checks
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Mon, 12 Apr 2010 23:40:14 +0200 |
parents | e6d355e50d7a |
children | e6beab22099b |
comparison
equal
deleted
inserted
replaced
1898:e25cec543da1 | 1899:decf94827efe |
---|---|
239 scr_WriteIncomingMessage(bjid, buf, 0, HBB_PREFIX_INFO, 0); | 239 scr_WriteIncomingMessage(bjid, buf, 0, HBB_PREFIX_INFO, 0); |
240 g_free(buf); | 240 g_free(buf); |
241 | 241 |
242 // Get result data... | 242 // Get result data... |
243 p = lm_message_node_get_child_value(ansqry, "name"); | 243 p = lm_message_node_get_child_value(ansqry, "name"); |
244 if (p) { | 244 if (p && *p) { |
245 buf = g_strdup_printf("Name: %s", p); | 245 buf = g_strdup_printf("Name: %s", p); |
246 scr_WriteIncomingMessage(bjid, buf, | 246 scr_WriteIncomingMessage(bjid, buf, |
247 0, HBB_PREFIX_INFO | HBB_PREFIX_CONT, 0); | 247 0, HBB_PREFIX_INFO | HBB_PREFIX_CONT, 0); |
248 g_free(buf); | 248 g_free(buf); |
249 } | 249 } |
250 p = lm_message_node_get_child_value(ansqry, "version"); | 250 p = lm_message_node_get_child_value(ansqry, "version"); |
251 if (p) { | 251 if (p && *p) { |
252 buf = g_strdup_printf("Version: %s", p); | 252 buf = g_strdup_printf("Version: %s", p); |
253 scr_WriteIncomingMessage(bjid, buf, | 253 scr_WriteIncomingMessage(bjid, buf, |
254 0, HBB_PREFIX_INFO | HBB_PREFIX_CONT, 0); | 254 0, HBB_PREFIX_INFO | HBB_PREFIX_CONT, 0); |
255 g_free(buf); | 255 g_free(buf); |
256 } | 256 } |
257 p = lm_message_node_get_child_value(ansqry, "os"); | 257 p = lm_message_node_get_child_value(ansqry, "os"); |
258 if (p) { | 258 if (p && *p) { |
259 buf = g_strdup_printf("OS: %s", p); | 259 buf = g_strdup_printf("OS: %s", p); |
260 scr_WriteIncomingMessage(bjid, buf, | 260 scr_WriteIncomingMessage(bjid, buf, |
261 0, HBB_PREFIX_INFO | HBB_PREFIX_CONT, 0); | 261 0, HBB_PREFIX_INFO | HBB_PREFIX_CONT, 0); |
262 g_free(buf); | 262 g_free(buf); |
263 } | 263 } |
304 scr_WriteIncomingMessage(bjid, buf, 0, HBB_PREFIX_INFO, 0); | 304 scr_WriteIncomingMessage(bjid, buf, 0, HBB_PREFIX_INFO, 0); |
305 g_free(buf); | 305 g_free(buf); |
306 | 306 |
307 // Get result data... | 307 // Get result data... |
308 p = lm_message_node_get_child_value(ansqry, "utc"); | 308 p = lm_message_node_get_child_value(ansqry, "utc"); |
309 if (p) { | 309 if (p && *p) { |
310 buf = g_strdup_printf("UTC: %s", p); | 310 buf = g_strdup_printf("UTC: %s", p); |
311 scr_WriteIncomingMessage(bjid, buf, | 311 scr_WriteIncomingMessage(bjid, buf, |
312 0, HBB_PREFIX_INFO | HBB_PREFIX_CONT, 0); | 312 0, HBB_PREFIX_INFO | HBB_PREFIX_CONT, 0); |
313 g_free(buf); | 313 g_free(buf); |
314 } | 314 } |
315 p = lm_message_node_get_child_value(ansqry, "tz"); | 315 p = lm_message_node_get_child_value(ansqry, "tz"); |
316 if (p) { | 316 if (p && *p) { |
317 buf = g_strdup_printf("TZ: %s", p); | 317 buf = g_strdup_printf("TZ: %s", p); |
318 scr_WriteIncomingMessage(bjid, buf, | 318 scr_WriteIncomingMessage(bjid, buf, |
319 0, HBB_PREFIX_INFO | HBB_PREFIX_CONT, 0); | 319 0, HBB_PREFIX_INFO | HBB_PREFIX_CONT, 0); |
320 g_free(buf); | 320 g_free(buf); |
321 } | 321 } |
322 p = lm_message_node_get_child_value(ansqry, "display"); | 322 p = lm_message_node_get_child_value(ansqry, "display"); |
323 if (p) { | 323 if (p && *p) { |
324 buf = g_strdup_printf("Time: %s", p); | 324 buf = g_strdup_printf("Time: %s", p); |
325 scr_WriteIncomingMessage(bjid, buf, | 325 scr_WriteIncomingMessage(bjid, buf, |
326 0, HBB_PREFIX_INFO | HBB_PREFIX_CONT, 0); | 326 0, HBB_PREFIX_INFO | HBB_PREFIX_CONT, 0); |
327 g_free(buf); | 327 g_free(buf); |
328 } | 328 } |
404 static void display_vcard_item(const char *bjid, const char *label, | 404 static void display_vcard_item(const char *bjid, const char *label, |
405 enum vcard_attr vcard_attrib, const char *text) | 405 enum vcard_attr vcard_attrib, const char *text) |
406 { | 406 { |
407 char *buf; | 407 char *buf; |
408 | 408 |
409 if (!text || !bjid || !label) | 409 if (!text || !*text || !bjid || !label) |
410 return; | 410 return; |
411 | 411 |
412 buf = g_strdup_printf("%s: %s%s%s%s%s%s%s%s%s%s", label, | 412 buf = g_strdup_printf("%s: %s%s%s%s%s%s%s%s%s%s", label, |
413 (vcard_attrib & vcard_home ? "[home]" : ""), | 413 (vcard_attrib & vcard_home ? "[home]" : ""), |
414 (vcard_attrib & vcard_work ? "[work]" : ""), | 414 (vcard_attrib & vcard_work ? "[work]" : ""), |