summaryrefslogtreecommitdiff
path: root/src/tabs.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2012-02-14 00:33:29 +0100
committermathieui <mathieui@mathieui.net>2012-02-14 00:33:29 +0100
commit560390793d29728ea96e1a547424a28098dcb610 (patch)
treee73b2d04717f6f2f1efd04b48515a3cedcd17966 /src/tabs.py
parentaf110581290d28b86f991dc48ced55c085852225 (diff)
downloadpoezio-560390793d29728ea96e1a547424a28098dcb610.tar.gz
poezio-560390793d29728ea96e1a547424a28098dcb610.tar.bz2
poezio-560390793d29728ea96e1a547424a28098dcb610.tar.xz
poezio-560390793d29728ea96e1a547424a28098dcb610.zip
Add 'joined' tab state, and rewrite the function handling the priorities
Diffstat (limited to 'src/tabs.py')
-rw-r--r--src/tabs.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/tabs.py b/src/tabs.py
index e2d40e87..365f19c0 100644
--- a/src/tabs.py
+++ b/src/tabs.py
@@ -62,6 +62,7 @@ NS_MUC_USER = 'http://jabber.org/protocol/muc#user'
STATE_COLORS = {
'disconnected': lambda: get_theme().COLOR_TAB_DISCONNECTED,
+ 'joined': lambda: get_theme().COLOR_TAB_JOINED,
'message': lambda: get_theme().COLOR_TAB_NEW_MESSAGE,
'highlight': lambda: get_theme().COLOR_TAB_HIGHLIGHT,
'private': lambda: get_theme().COLOR_TAB_PRIVATE,
@@ -72,6 +73,7 @@ STATE_COLORS = {
VERTICAL_STATE_COLORS = {
'disconnected': lambda: get_theme().COLOR_VERTICAL_TAB_DISCONNECTED,
+ 'joined': lambda: get_theme().COLOR_VERTICAL_TAB_JOINED,
'message': lambda: get_theme().COLOR_VERTICAL_TAB_NEW_MESSAGE,
'highlight': lambda: get_theme().COLOR_VERTICAL_TAB_HIGHLIGHT,
'private': lambda: get_theme().COLOR_VERTICAL_TAB_PRIVATE,
@@ -84,10 +86,11 @@ VERTICAL_STATE_COLORS = {
STATE_PRIORITY = {
'normal': -1,
'current': -1,
- 'disconnected': 0,
'message': 1,
+ 'joined': 1,
'highlight': 2,
'private': 2,
+ 'disconnected': 3,
'attention': 3
}
@@ -155,7 +158,7 @@ class Tab(object):
if not value in STATE_COLORS:
log.debug("Invalid value for tab state: %s", value)
elif STATE_PRIORITY[value] < STATE_PRIORITY[self._state] and \
- value != 'current':
+ value != 'current' and value != 'joined':
log.debug("Did not set status because of lower priority, asked: %s, kept: %s", value, self._state)
else:
self._state = value
@@ -1066,6 +1069,8 @@ class MucTab(ChatTab):
self.users.append(new_user)
if from_nick == self.own_nick:
self.joined = True
+ if self != self.core.current_tab():
+ self.state = 'joined'
if self.core.current_tab() == self and self.core.status.show not in ('xa', 'away'):
self.send_chat_state('active')
new_user.color = get_theme().COLOR_OWN_NICK
@@ -1100,6 +1105,9 @@ class MucTab(ChatTab):
self.info_header.refresh(self, self.text_win)
self.input.refresh()
self.core.doupdate()
+ else:
+ self.core.current_tab().refresh_tab_win()
+ self.core.doupdate()
def on_user_join(self, from_nick, affiliation, show, status, role, jid):
"""