Fix various roster count issues
disconnections not clearing the number of connected contacts, leading to an ever-increasing count, and roster count not always being setup
This commit is contained in:
parent
06217c4a0c
commit
99d5e25f9b
2 changed files with 8 additions and 1 deletions
|
@ -748,6 +748,7 @@ def on_roster_update(self, iq):
|
|||
del roster[jid]
|
||||
else:
|
||||
roster.update_contact_groups(jid)
|
||||
roster.update_size()
|
||||
if isinstance(self.current_tab(), tabs.RosterInfoTab):
|
||||
self.refresh_window()
|
||||
|
||||
|
@ -936,6 +937,7 @@ def on_disconnected(self, event):
|
|||
"""
|
||||
When we are disconnected from remote server
|
||||
"""
|
||||
roster.connected = 0
|
||||
# Stop the ping plugin. It would try to send stanza on regular basis
|
||||
self.xmpp.plugin['xep_0199'].disable_keepalive()
|
||||
roster.modified()
|
||||
|
|
|
@ -149,9 +149,14 @@ class Roster(object):
|
|||
contact = self.get_and_set(key)
|
||||
if key != self.jid and (contact and self.exists(contact)):
|
||||
l.append(key)
|
||||
self.length = len(l)
|
||||
self.update_size(l)
|
||||
return l
|
||||
|
||||
def update_size(self, jids=None):
|
||||
if jids is None:
|
||||
jids = self.jids()
|
||||
self.length = len(jids)
|
||||
|
||||
def get_contacts(self):
|
||||
"""
|
||||
Return a list of all the contacts
|
||||
|
|
Loading…
Reference in a new issue