MUC: Fix a strange bug when a user isn't in a room anymore (network issue)
authorMikael Berthe <mikael@lilotux.net>
Sun, 07 May 2006 15:40:09 +0200
changeset 845 51829325fe21
parent 844 5002948c7360
child 846 683516b450be
MUC: Fix a strange bug when a user isn't in a room anymore (network issue) When the Jabber server cannot reach a server anymore, it considers the users of this server have left, but doesn't send type=unavailable. Mcabber didn't understand and still believed the users were in the room. This patch should fix that.
mcabber/src/jabglue.c
--- a/mcabber/src/jabglue.c	Sat May 06 18:41:24 2006 +0200
+++ b/mcabber/src/jabglue.c	Sun May 07 15:40:09 2006 +0200
@@ -1109,10 +1109,17 @@
           mbuf = g_strdup_printf("You have left %s", roomjid);
         }
       } else {
-        if (ustmsg)
-          mbuf = g_strdup_printf("%s has left: %s", rname, ustmsg);
-        else
-          mbuf = g_strdup_printf("%s has left", rname);
+        if (ust != offline) {
+          // This can happen when a network failure occurs,
+          // this isn't an official leave but the user isn't there anymore.
+          mbuf = g_strdup_printf("%s has disappeared!", rname);
+          ust = offline;
+        } else {
+          if (ustmsg)
+            mbuf = g_strdup_printf("%s has left: %s", rname, ustmsg);
+          else
+            mbuf = g_strdup_printf("%s has left", rname);
+        }
       }
     }