diff options
-rw-r--r-- | poezio/tabs/muctab.py | 16 | ||||
-rw-r--r-- | poezio/user.py | 4 |
2 files changed, 12 insertions, 8 deletions
diff --git a/poezio/tabs/muctab.py b/poezio/tabs/muctab.py index 80631388..d77aaf39 100644 --- a/poezio/tabs/muctab.py +++ b/poezio/tabs/muctab.py @@ -448,8 +448,9 @@ class MucTab(ChatTab): if presence['type'] == 'error': self.core.room_error(presence, self.name) elif not self.joined: - if '110' in status_codes or self.own_nick == presence['from'].resource: - self.process_presence_buffer(presence) + own = '110' in status_codes or self.own_nick == presence['from'].resource + if own or len(self.presence_buffer) >= 10: + self.process_presence_buffer(presence, own) else: self.presence_buffer.append(presence) return @@ -467,7 +468,7 @@ class MucTab(ChatTab): self.input.refresh() self.core.doupdate() - def process_presence_buffer(self, last_presence): + def process_presence_buffer(self, last_presence, own): """ Batch-process all the initial presences """ @@ -479,11 +480,13 @@ class MucTab(ChatTab): self.handle_presence_unjoined(stanza, deterministic) except PresenceError: self.core.room_error(stanza, stanza['from'].bare) - self.handle_presence_unjoined(last_presence, deterministic, own=True) + self.presence_buffer = [] + self.handle_presence_unjoined(last_presence, deterministic, own) self.users.sort() # Enable the self ping event, to regularly check if we # are still in the room. - self.enable_self_ping_event() + if own: + self.enable_self_ping_event() if self.core.tabs.current_tab is not self: self.refresh_tab_win() self.core.tabs.current_tab.refresh_input() @@ -1151,7 +1154,8 @@ class MucTab(ChatTab): timeout=timeout) def on_self_ping_result(self, iq): - if iq["type"] == "error" and iq["error"]["condition"] != "feature-not-implemented": + if iq["type"] == "error" and iq["error"]["condition"] not in \ + ("feature-not-implemented", "service-unavailable", "item-not-found"): self.command_cycle(iq["error"]["text"] or "not in this room") self.core.refresh_window() else: # Re-send a self-ping in a few seconds diff --git a/poezio/user.py b/poezio/user.py index 43832917..146a70da 100644 --- a/poezio/user.py +++ b/poezio/user.py @@ -6,7 +6,7 @@ # it under the terms of the zlib license. See the COPYING file. """ Define the user class. -An user is a MUC participant, not a roster contact (see contact.py) +A user is a MUC participant, not a roster contact (see contact.py) """ import logging @@ -26,7 +26,7 @@ ROLE_DICT = {'': 0, 'none': 0, 'visitor': 1, 'participant': 2, 'moderator': 3} class User: """ - keep trace of an user in a Room + keep track of a user in a Room """ __slots__ = ('last_talked', 'jid', 'chatstate', 'affiliation', 'show', 'status', 'role', 'nick', 'color') |