changeset 1345:8e4e741787be

Small change to buffer close Don't leave chat mode if the buffer to close isn't the current one.
author Mikael Berthe <mikael@lilotux.net>
date Fri, 09 Nov 2007 19:32:45 +0100
parents 44ff580ee388
children e36b21e11760
files mcabber/src/screen.c
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/src/screen.c	Thu Nov 08 23:46:18 2007 +0100
+++ b/mcabber/src/screen.c	Fri Nov 09 19:32:45 2007 +0100
@@ -2397,10 +2397,18 @@
   guint isspe;
   guint *p_closebuf;
   const char *cjid;
+  guint hold_chatmode = FALSE;
 
   if (jid) {
     cjid = jid;
     isspe = FALSE;
+    // If closebuf is TRUE, it's probably better not to leave chat mode
+    // if the change isn't related to the current buffer.
+    if (closebuf && current_buddy) {
+      if (buddy_gettype(BUDDATA(current_buddy)) & ROSTER_TYPE_SPECIAL ||
+          strcasecmp(jid, CURRENT_JID))
+        hold_chatmode = TRUE;
+    }
   } else {
     // Get win_entry
     if (!current_buddy) return;
@@ -2415,7 +2423,7 @@
     *p_closebuf = closebuf;
     buffer_purge((gpointer)cjid, win_entry, p_closebuf);
     g_free(p_closebuf);
-    if (closebuf) {
+    if (closebuf && !hold_chatmode) {
       scr_set_chatmode(FALSE);
       currentWindow = NULL;
     }