changeset 1898:e25cec543da1

Fix two MUC issues (reported by VarLog) - Reason sometimes missing after kick/ban (fixed by isbear) - mcabber not realizing it's been kicked
author Mikael Berthe <mikael@lilotux.net>
date Mon, 12 Apr 2010 23:24:20 +0200
parents efd7c4c34ff2
children decf94827efe
files mcabber/mcabber/xmpp_muc.c
diffstat 1 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/mcabber/xmpp_muc.c	Mon Apr 12 22:22:22 2010 +0200
+++ b/mcabber/mcabber/xmpp_muc.c	Mon Apr 12 23:24:20 2010 +0200
@@ -491,7 +491,7 @@
   }
 
   // Check for departure/arrival
-  if (!mbnick && ust == offline) {
+  if (statuscode != 303 && ust == offline) {
     // Somebody is leaving
     enum { leave=0, kick, ban } how = leave;
     bool we_left = FALSE;
@@ -515,21 +515,27 @@
     // The message depends on _who_ left, and _how_
     if (how) {
       gchar *mbuf_end;
+      gchar *reason_msg = NULL;
       // Forced leave
       if (actorjid) {
-        mbuf_end = g_strdup_printf("%s from %s by <%s>.\nReason: %s",
+        mbuf_end = g_strdup_printf("%s from %s by <%s>.",
                                    (how == ban ? "banned" : "kicked"),
-                                   roomjid, actorjid, reason);
+                                   roomjid, actorjid);
       } else {
         mbuf_end = g_strdup_printf("%s from %s.",
                                    (how == ban ? "banned" : "kicked"),
                                    roomjid);
       }
+      if (reason)
+        reason_msg = g_strdup_printf("\nReason: %s", reason);
       if (we_left)
-        mbuf = g_strdup_printf("You have been %s", mbuf_end);
+        mbuf = g_strdup_printf("You have been %s%s", mbuf_end,
+                               reason_msg ? reason_msg : "");
       else
-        mbuf = g_strdup_printf("%s has been %s", rname, mbuf_end);
+        mbuf = g_strdup_printf("%s has been %s%s", rname, mbuf_end,
+                               reason_msg ? reason_msg : "");
 
+      g_free(reason_msg);
       g_free(mbuf_end);
     } else {
       // Natural leave