diff options
author | mathieui <mathieui@mathieui.net> | 2012-02-15 21:47:09 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2012-02-15 21:47:09 +0100 |
commit | a78fb1f62d43d8003d5a9d583a4ccb9e548b144f (patch) | |
tree | 48f29c4f13709114d88449e9547927bc597af9b7 /src | |
parent | 695a7ebebaf6a277420dcb42cd96d92d77df0379 (diff) | |
download | poezio-a78fb1f62d43d8003d5a9d583a4ccb9e548b144f.tar.gz poezio-a78fb1f62d43d8003d5a9d583a4ccb9e548b144f.tar.bz2 poezio-a78fb1f62d43d8003d5a9d583a4ccb9e548b144f.tar.xz poezio-a78fb1f62d43d8003d5a9d583a4ccb9e548b144f.zip |
Do not show joined tabs on startup
and put 0 priority to disconnected tabs
Diffstat (limited to 'src')
-rw-r--r-- | src/core.py | 3 | ||||
-rw-r--r-- | src/tabs.py | 19 |
2 files changed, 16 insertions, 6 deletions
diff --git a/src/core.py b/src/core.py index dfea7dd3..9deac05c 100644 --- a/src/core.py +++ b/src/core.py @@ -196,6 +196,8 @@ class Core(object): self.xmpp.add_event_handler("attention", self.on_attention) self.xmpp.register_handler(Callback('ALL THE STANZAS', connection.MatchAll(None), self.incoming_stanza)) + self.initial_joins = [] + self.timed_events = set() self.connected_events = {} @@ -638,6 +640,7 @@ class Core(object): if not tab: self.open_new_room(bm.jid, bm.nick, False) nick = bm.nick if bm.nick else self.own_nick + self.initial_joins.append(bm.jid) muc.join_groupchat(self.xmpp, bm.jid, nick) def on_groupchat_presence(self, presence): diff --git a/src/tabs.py b/src/tabs.py index c98bbed4..f170d738 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -86,11 +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 } @@ -99,7 +99,11 @@ class Tab(object): tab_core = None def __init__(self): self.input = None - self._state = 'normal' + if isinstance(self, MucTab) and not self.joined: + self._state = 'disconnected' + else: + self._state = 'normal' + self.need_resize = False self.nb = Tab.number Tab.number += 1 @@ -158,7 +162,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' and value != 'joined': + value not in ('current', 'disconnected'): log.debug("Did not set status because of lower priority, asked: %s, kept: %s", value, self._state) else: self._state = value @@ -509,10 +513,10 @@ class MucTab(ChatTab): plugin_commands = {} plugin_keys = {} def __init__(self, jid, nick): + self.joined = False ChatTab.__init__(self) self.own_nick = nick self.name = jid - self.joined = False self.users = [] self.topic = '' self.remote_wants_chatstates = True @@ -1080,8 +1084,11 @@ 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.get_name() in self.core.initial_joins: + self.core.initial_joins.remove(self.get_name()) + self._state = 'normal' + elif 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 |