MUC: update the presence window after each ~10 incoming presences
This commit is contained in:
parent
8cbd8dabdd
commit
c7c3ea49ce
1 changed files with 8 additions and 5 deletions
|
@ -448,8 +448,9 @@ class MucTab(ChatTab):
|
||||||
if presence['type'] == 'error':
|
if presence['type'] == 'error':
|
||||||
self.core.room_error(presence, self.name)
|
self.core.room_error(presence, self.name)
|
||||||
elif not self.joined:
|
elif not self.joined:
|
||||||
if '110' in status_codes or self.own_nick == presence['from'].resource:
|
own = '110' in status_codes or self.own_nick == presence['from'].resource
|
||||||
self.process_presence_buffer(presence)
|
if own or len(self.presence_buffer) >= 10:
|
||||||
|
self.process_presence_buffer(presence, own)
|
||||||
else:
|
else:
|
||||||
self.presence_buffer.append(presence)
|
self.presence_buffer.append(presence)
|
||||||
return
|
return
|
||||||
|
@ -467,7 +468,7 @@ class MucTab(ChatTab):
|
||||||
self.input.refresh()
|
self.input.refresh()
|
||||||
self.core.doupdate()
|
self.core.doupdate()
|
||||||
|
|
||||||
def process_presence_buffer(self, last_presence):
|
def process_presence_buffer(self, last_presence, own):
|
||||||
"""
|
"""
|
||||||
Batch-process all the initial presences
|
Batch-process all the initial presences
|
||||||
"""
|
"""
|
||||||
|
@ -479,11 +480,13 @@ class MucTab(ChatTab):
|
||||||
self.handle_presence_unjoined(stanza, deterministic)
|
self.handle_presence_unjoined(stanza, deterministic)
|
||||||
except PresenceError:
|
except PresenceError:
|
||||||
self.core.room_error(stanza, stanza['from'].bare)
|
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()
|
self.users.sort()
|
||||||
# Enable the self ping event, to regularly check if we
|
# Enable the self ping event, to regularly check if we
|
||||||
# are still in the room.
|
# 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:
|
if self.core.tabs.current_tab is not self:
|
||||||
self.refresh_tab_win()
|
self.refresh_tab_win()
|
||||||
self.core.tabs.current_tab.refresh_input()
|
self.core.tabs.current_tab.refresh_input()
|
||||||
|
|
Loading…
Reference in a new issue