From ce69213a1ec1c6ed281c38ee6df39a4bc9794356 Mon Sep 17 00:00:00 2001 From: Nathan Fritz Date: Wed, 20 Oct 2010 19:33:40 -0700 Subject: [PATCH] when disconnected, reset the roster --- sleekxmpp/basexmpp.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sleekxmpp/basexmpp.py b/sleekxmpp/basexmpp.py index 8197f6a..802f44c 100644 --- a/sleekxmpp/basexmpp.py +++ b/sleekxmpp/basexmpp.py @@ -135,6 +135,8 @@ class BaseXMPP(XMLStream): self.add_event_handler('presence_subscribe', self._handle_subscribe) + self.add_event_handler('disconnected', + self._handle_disconnected) # Set up the XML stream with XMPP's root stanzas. self.registerStanza(Message) @@ -518,6 +520,10 @@ class BaseXMPP(XMLStream): def getjidbare(self, fulljid): return fulljid.split('/', 1)[0] + def _handle_disconnected(self, event): + """When disconnected, reset the roster""" + self.roster = {} + def _handle_message(self, msg): """Process incoming message stanzas.""" self.event('message', msg)