From 6be17ebbe27c17da01abe4fe1134e070c6ee632f Mon Sep 17 00:00:00 2001 From: Nathan Fritz Date: Wed, 11 Nov 2009 03:14:16 +0000 Subject: [PATCH] * clean up offline contacts --- sleekxmpp/basexmpp.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sleekxmpp/basexmpp.py b/sleekxmpp/basexmpp.py index 2095867..07715e0 100644 --- a/sleekxmpp/basexmpp.py +++ b/sleekxmpp/basexmpp.py @@ -419,6 +419,10 @@ class basexmpp(object): self.event("got_online", eventdata) elif not wasoffline and show == 'unavailable': self.event("got_offline", eventdata) + if len(self.roster[jid]['presence']) > 1: + del self.roster[jid]['presence'][resource] + else: + del self.roster[jid] elif oldroster != self.roster.get(jid, {'presence': {}})['presence'].get(resource, {}) and show != 'unavailable': self.event("changed_status", eventdata) name = ''