summaryrefslogtreecommitdiff
path: root/sleekxmpp
diff options
context:
space:
mode:
authorNathan Fritz <nathan@andyet.net>2010-05-13 09:07:20 +0800
committerTom Nichols <tmnichols@gmail.com>2010-05-14 01:47:19 +0800
commit7522839141e7dd5bd081a421a58b0962b705fdda (patch)
tree330e3a05f35675b0779060656156cefe320e27f2 /sleekxmpp
parent4c410dd48aefc69682c30f28e830e5dee62a04ab (diff)
downloadslixmpp-7522839141e7dd5bd081a421a58b0962b705fdda.tar.gz
slixmpp-7522839141e7dd5bd081a421a58b0962b705fdda.tar.bz2
slixmpp-7522839141e7dd5bd081a421a58b0962b705fdda.tar.xz
slixmpp-7522839141e7dd5bd081a421a58b0962b705fdda.zip
added test for unsolicided unavailable presence and fixed bug to make it pass
Diffstat (limited to 'sleekxmpp')
-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: