MUC: display reason, if any, when a room has been destroyed
authorMikael Berthe <mikael@lilotux.net>
Fri, 16 Dec 2005 12:09:46 +0100
changeset 616 a61a257ec38b
parent 615 6f65b937fcf7
child 617 d3a8b43bf9e7
MUC: display reason, if any, when a room has been destroyed
mcabber/src/jabglue.c
--- a/mcabber/src/jabglue.c	Fri Dec 16 00:48:01 2005 +0100
+++ b/mcabber/src/jabglue.c	Fri Dec 16 12:09:46 2005 +0100
@@ -1011,11 +1011,24 @@
     } else {
       // Natural leave
       if (we_left) {
-        if (xmlnode_get_tag(xmldata, "destroy"))
-          mbuf = g_strdup_printf("You have left %s, "
-                                 "the room has been destroyed", roomjid);
-        else
+        xmlnode destroynode = xmlnode_get_tag(xmldata, "destroy");
+        if (destroynode) {
+          gchar *rsn_noutf8 = NULL;
+          reason = from_utf8(xmlnode_get_tag_data(destroynode, "reason"));
+          if (reason)
+            rsn_noutf8 = from_utf8(reason);
+          if (rsn_noutf8) {
+            mbuf = g_strdup_printf("You have left %s, "
+                                   "the room has been destroyed: %s",
+                                   roomjid, rsn_noutf8);
+            g_free(rsn_noutf8);
+          } else {
+            mbuf = g_strdup_printf("You have left %s, "
+                                   "the room has been destroyed", roomjid);
+          }
+        } else {
           mbuf = g_strdup_printf("You have left %s", roomjid);
+        }
       } else {
         if (ustmsg)
           mbuf = g_strdup_printf("%s has left: %s", rname, ustmsg);