changeset 616:a61a257ec38b

MUC: display reason, if any, when a room has been destroyed
author Mikael Berthe <mikael@lilotux.net>
date Fri, 16 Dec 2005 12:09:46 +0100
parents 6f65b937fcf7
children d3a8b43bf9e7
files mcabber/src/jabglue.c
diffstat 1 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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);