From 7a312992921debb1d904a0f2b7083272113e253e Mon Sep 17 00:00:00 2001
From: mathieui <mathieui@mathieui.net>
Date: Mon, 12 Sep 2011 10:56:02 +0200
Subject: Add a color state for disconnected rooms (Fixes #2166)

---
 data/themes/dark   | 3 ++-
 data/themes/poezio | 1 +
 src/room.py        | 1 +
 src/tabs.py        | 6 ++++++
 src/theme.py       | 1 +
 5 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/data/themes/dark b/data/themes/dark
index db1b2021..77093577 100644
--- a/data/themes/dark
+++ b/data/themes/dark
@@ -34,6 +34,7 @@ COLOR_TAB_CURRENT = 7
 COLOR_TAB_NEW_MESSAGE = 10
 COLOR_TAB_HIGHLIGHT = 8
 COLOR_TAB_PRIVATE = 9
+COLOR_TAB_DISCONNECTED = 30
 
 # Nickname colors
 LIST_COLOR_NICKNAMES = [
@@ -77,4 +78,4 @@ COLOR_CURLYBRACKETED_WORD = 4
 # words between {}
 COLOR_ACCOLADE_WORD = 6
 # words between []
-COLOR_BRACKETED_WORD = 3
\ No newline at end of file
+COLOR_BRACKETED_WORD = 3
diff --git a/data/themes/poezio b/data/themes/poezio
index b49403ab..b5bb6a66 100644
--- a/data/themes/poezio
+++ b/data/themes/poezio
@@ -37,6 +37,7 @@ COLOR_TAB_CURRENT = 56
 COLOR_TAB_NEW_MESSAGE = 49
 COLOR_TAB_HIGHLIGHT = 21
 COLOR_TAB_PRIVATE = 28
+COLOR_TAB_DISCONNECTED = 30
 
 # Nickname colors
 LIST_COLOR_NICKNAMES = [
diff --git a/src/room.py b/src/room.py
index be376b54..58b96adb 100644
--- a/src/room.py
+++ b/src/room.py
@@ -35,6 +35,7 @@ class Room(TextBuffer):
         we can know if we can join it, send messages to it, etc
         """
         self.users = []
+        self.color_state = theme.COLOR_TAB_DISCONNECTED
         self.joined = False
 
     def get_single_line_topic(self):
diff --git a/src/tabs.py b/src/tabs.py
index 0d1c5751..77b1610d 100644
--- a/src/tabs.py
+++ b/src/tabs.py
@@ -868,6 +868,8 @@ class MucTab(ChatTab):
         if from_nick == room.own_nick: # we are banned
             room.disconnect()
             self.core.disable_private_tabs(room.name)
+            self.tab_win.refresh()
+            self.core.doupdate()
             if by:
                 kick_msg = _('\x191%(spec)s \x193You\x195 have been banned by \x194%(by)s') % {'spec': theme.CHAR_KICK, 'by':by}
             else:
@@ -892,6 +894,8 @@ class MucTab(ChatTab):
         if from_nick == room.own_nick: # we are kicked
             room.disconnect()
             self.core.disable_private_tabs(room.name)
+            self.tab_win.refresh()
+            self.core.doupdate()
             if by:
                 kick_msg = _('\x191%(spec)s \x193You\x195 have been kicked by \x193%(by)s') % {'spec': theme.CHAR_KICK, 'by':by}
             else:
@@ -917,6 +921,8 @@ class MucTab(ChatTab):
             # We are now out of the room. Happens with some buggy (? not sure) servers
             room.disconnect()
             self.core.disable_private_tabs(from_room)
+            self.tab_win.refresh()
+            self.core.doupdate()
         hide_exit_join = config.get('hide_exit_join', -1) if config.get('hide_exit_join', -1) >= -1 else -1
         if hide_exit_join == -1 or user.has_talked_since(hide_exit_join):
             if not jid.full:
diff --git a/src/theme.py b/src/theme.py
index 244d6006..2502e5c6 100644
--- a/src/theme.py
+++ b/src/theme.py
@@ -58,6 +58,7 @@ COLOR_TAB_CURRENT = 56
 COLOR_TAB_NEW_MESSAGE = 49
 COLOR_TAB_HIGHLIGHT = 21
 COLOR_TAB_PRIVATE = 28
+COLOR_TAB_DISCONNECTED = 30
 
 # Nickname colors
 LIST_COLOR_NICKNAMES = [
-- 
cgit v1.2.3