# HG changeset patch # User Mikael Berthe # Date 1271098219 -7200 # Node ID c5ab9cf3819a39de7ca1ea14c0559308d1e1ad81 # Parent 7043542b3565a2f90e88e61e5ed5f30be2f16e5e [MUC] Fix handling of empty room topic lm_message_node_get_child_value() didn't make any difference between a missing node and an empty one. With this patch it will return "" if the node exists but has no value. diff -r 7043542b3565 -r c5ab9cf3819a mcabber/mcabber/xmpp.c --- a/mcabber/mcabber/xmpp.c Sun Apr 11 20:02:16 2010 +0200 +++ b/mcabber/mcabber/xmpp.c Mon Apr 12 20:50:19 2010 +0200 @@ -1239,9 +1239,15 @@ // Display inside the room window if (r == s) { // No specific resource (this is certainly history) - mbuf = g_strdup_printf("The topic has been set to: %s", subj); + if (*subj) + mbuf = g_strdup_printf("The topic has been set to: %s", subj); + else + mbuf = g_strdup_printf("The topic has been cleared"); } else { - mbuf = g_strdup_printf("%s has set the topic to: %s", r, subj); + if (*subj) + mbuf = g_strdup_printf("%s has set the topic to: %s", r, subj); + else + mbuf = g_strdup_printf("%s has cleared the topic", r); } scr_WriteIncomingMessage(s, mbuf, 0, HBB_PREFIX_INFO|HBB_PREFIX_NOFLAG, 0); diff -r 7043542b3565 -r c5ab9cf3819a mcabber/mcabber/xmpp_helper.c --- a/mcabber/mcabber/xmpp_helper.c Sun Apr 11 20:02:16 2010 +0200 +++ b/mcabber/mcabber/xmpp_helper.c Mon Apr 12 20:50:19 2010 +0200 @@ -109,9 +109,11 @@ { LmMessageNode *tmp; tmp = lm_message_node_find_child(node, child); - if (tmp) - return lm_message_node_get_value(tmp); - else return NULL; + if (tmp) { + const gchar *val = lm_message_node_get_value(tmp); + return (val ? val : ""); + } + return NULL; } static LmMessageNode *hidden = NULL;