Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/xmpp_muc.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 | e25cec543da1 |
children | e2def760c6d0 |
comparison
equal
deleted
inserted
replaced
1898:e25cec543da1 | 1899:decf94827efe |
---|---|
323 } | 323 } |
324 *mbjid = lm_message_node_get_attribute(y, "jid"); | 324 *mbjid = lm_message_node_get_attribute(y, "jid"); |
325 *mbnick = lm_message_node_get_attribute(y, "nick"); | 325 *mbnick = lm_message_node_get_attribute(y, "nick"); |
326 // For kick/ban, there can be actor and reason tags | 326 // For kick/ban, there can be actor and reason tags |
327 *reason = lm_message_node_get_child_value(y, "reason"); | 327 *reason = lm_message_node_get_child_value(y, "reason"); |
328 if (*reason && !**reason) | |
329 *reason = NULL; | |
328 z = lm_message_node_find_child(y, "actor"); | 330 z = lm_message_node_find_child(y, "actor"); |
329 if (z) | 331 if (z) |
330 *actorjid = lm_message_node_get_attribute(z, "jid"); | 332 *actorjid = lm_message_node_get_attribute(z, "jid"); |
331 } | 333 } |
332 | 334 |
541 // Natural leave | 543 // Natural leave |
542 if (we_left) { | 544 if (we_left) { |
543 LmMessageNode *destroynode = lm_message_node_find_child(xmldata, | 545 LmMessageNode *destroynode = lm_message_node_find_child(xmldata, |
544 "destroy"); | 546 "destroy"); |
545 if (destroynode) { | 547 if (destroynode) { |
546 if ((reason = lm_message_node_get_child_value(destroynode, | 548 reason = lm_message_node_get_child_value(destroynode, "reason"); |
547 "reason"))) { | 549 if (reason && *reason) { |
548 mbuf = g_strdup_printf("You have left %s, " | 550 mbuf = g_strdup_printf("You have left %s, " |
549 "the room has been destroyed: %s", | 551 "the room has been destroyed: %s", |
550 roomjid, reason); | 552 roomjid, reason); |
551 } else { | 553 } else { |
552 mbuf = g_strdup_printf("You have left %s, " | 554 mbuf = g_strdup_printf("You have left %s, " |