summaryrefslogtreecommitdiff
path: root/sleekxmpp/roster.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2011-02-14 16:24:49 -0500
committerLance Stout <lancestout@gmail.com>2011-02-14 16:24:49 -0500
commite4f3b777f9d6c57a2d05296079828609e6b18375 (patch)
treebe7099f190830a4b1cde2abd77550114496344eb /sleekxmpp/roster.py
parenta278f79bdbdb842193092a9e0176ecb8b1867762 (diff)
downloadslixmpp-e4f3b777f9d6c57a2d05296079828609e6b18375.tar.gz
slixmpp-e4f3b777f9d6c57a2d05296079828609e6b18375.tar.bz2
slixmpp-e4f3b777f9d6c57a2d05296079828609e6b18375.tar.xz
slixmpp-e4f3b777f9d6c57a2d05296079828609e6b18375.zip
Reset the roster on disconnect instead of replacing it.
Diffstat (limited to 'sleekxmpp/roster.py')
-rw-r--r--sleekxmpp/roster.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/sleekxmpp/roster.py b/sleekxmpp/roster.py
index 60a13c11..043981e3 100644
--- a/sleekxmpp/roster.py
+++ b/sleekxmpp/roster.py
@@ -105,6 +105,14 @@ class Roster(object):
for node in self._rosters:
self._rosters[node].set_backend(db)
+ def reset(self):
+ """
+ Reset the state of the roster to forget any current
+ presence information. Useful after a disconnection occurs.
+ """
+ for node in self:
+ self[node].reset()
+
class RosterNode(object):
@@ -305,6 +313,15 @@ class RosterNode(object):
return self[jid].resources.get(resource,
default_presence)
+ def reset(self):
+ """
+ Reset the state of the roster to forget any current
+ presence information. Useful after a disconnection occurs.
+ """
+ for jid in self:
+ self[jid].reset()
+
+
class RosterItem(object):
@@ -725,3 +742,10 @@ class RosterItem(object):
self.subscribe()
if not self['to']:
self._unsubscribed()
+
+ def reset(self):
+ """
+ Forgot current resource presence information as part of
+ a roster reset request.
+ """
+ self.resources = {}