changeset 709:5aa66101807b

Leave full-width mode automatically under some conditions Leave full-width mode when leaving chat mode and when changing the selected buddy. Enter chat mode when hiding the roster.
author Mikael Berthe <mikael@lilotux.net>
date Tue, 21 Feb 2006 23:47:29 +0100
parents ed326697e4ed
children 0311d7e2bb1c
files mcabber/src/screen.c
diffstat 1 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/src/screen.c	Tue Feb 21 23:05:08 2006 +0100
+++ b/mcabber/src/screen.c	Tue Feb 21 23:47:29 2006 +0100
@@ -867,6 +867,20 @@
     roster_hidden = !roster_hidden;
 
   if (roster_hidden != old_roster_status) {
+    if (roster_hidden) {
+      // The requested status is hidden.
+      // Let's check it makes sense...
+      if ((!current_buddy) ||
+          ((buddy_gettype(BUDDATA(current_buddy)) &
+            (ROSTER_TYPE_USER|ROSTER_TYPE_ROOM|ROSTER_TYPE_AGENT)) == 0)) {
+        // We should not hide the roster.
+        roster_hidden = FALSE;
+        return; // No need to refresh, a priori.
+      }
+      // Enter chat mode
+      scr_set_chatmode(TRUE);
+      scr_ShowBuddyWindow();
+    }
     // Recalculate windows size and redraw
     scr_Resize();
     redrawwin(stdscr);
@@ -967,6 +981,9 @@
   if (!current_buddy || !newbuddy)  return;
   if (newbuddy == current_buddy)    return;
 
+  // We're changing the selected buddy, the roster must be displayed.
+  scr_RosterVisibility(1);
+
   prev_st = buddy_getstatus(BUDDATA(current_buddy), NULL);
   buddy_setflags(BUDDATA(current_buddy), ROSTER_FLAG_LOCK, FALSE);
   if (chatmode)
@@ -1821,6 +1838,7 @@
         chatmode = FALSE;
         if (current_buddy)
           buddy_setflags(BUDDATA(current_buddy), ROSTER_FLAG_LOCK, FALSE);
+        scr_RosterVisibility(1);
         top_panel(chatPanel);
         top_panel(inputPanel);
         update_panels();