summaryrefslogtreecommitdiff
path: root/sleekxmpp/basexmpp.py
diff options
context:
space:
mode:
authorNathan Fritz <nathan@andyet.net>2010-05-12 18:07:20 -0700
committerNathan Fritz <nathan@andyet.net>2010-05-12 18:07:20 -0700
commitae41c08fecfe627627f2a4d9b3861d4ae24d673e (patch)
tree318eb2d25fb8c8211c157e35912584be2852c633 /sleekxmpp/basexmpp.py
parent223507f36f6dd4c0d4a0733a524fd529231b010b (diff)
downloadslixmpp-ae41c08fecfe627627f2a4d9b3861d4ae24d673e.tar.gz
slixmpp-ae41c08fecfe627627f2a4d9b3861d4ae24d673e.tar.bz2
slixmpp-ae41c08fecfe627627f2a4d9b3861d4ae24d673e.tar.xz
slixmpp-ae41c08fecfe627627f2a4d9b3861d4ae24d673e.zip
added test for unsolicided unavailable presence and fixed bug to make it pass
Diffstat (limited to 'sleekxmpp/basexmpp.py')
-rw-r--r--sleekxmpp/basexmpp.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/sleekxmpp/basexmpp.py b/sleekxmpp/basexmpp.py
index fef8538a..13fe2100 100644
--- a/sleekxmpp/basexmpp.py
+++ b/sleekxmpp/basexmpp.py
@@ -271,12 +271,13 @@ class basexmpp(object):
name = self.roster[jid].get('name', '')
if show == 'unavailable':
logging.debug("%s %s got offline" % (jid, resource))
- if len(self.roster[jid]['presence']):
- del self.roster[jid]['presence'][resource]
- else:
+ del self.roster[jid]['presence'][resource]
+ if len(self.roster[jid]['presence']) == 0 and not self.roster[jid]['in_roster']:
del self.roster[jid]
if not wasoffline:
self.event("got_offline", presence)
+ else:
+ return False
self.event("changed_status", presence)
name = ''
if name: