diff --git a/sleekxmpp/basexmpp.py b/sleekxmpp/basexmpp.py index 9162073..961775f 100644 --- a/sleekxmpp/basexmpp.py +++ b/sleekxmpp/basexmpp.py @@ -281,7 +281,7 @@ class basexmpp(object): name = self.roster[jid].get('name', '') if wasoffline and (show == 'available' or show in presence.showtypes): self.event("got_online", presence) - elif not wasoffline and show == 'unavailable': + elif show == 'unavailable': logging.debug("%s %s got offline" % (jid, resource)) if len(self.roster[jid]['presence']) > 1: del self.roster[jid]['presence'][resource] diff --git a/tests/test_messagestanzas.py b/tests/test_messagestanzas.py index ec44803..4de482f 100644 --- a/tests/test_messagestanzas.py +++ b/tests/test_messagestanzas.py @@ -16,4 +16,10 @@ class testmessagestanzas(unittest.TestCase): msg.reply() self.failUnless(str(msg['to']) == 'room@someservice.someserver.tld') + def testAttribProperty(self): + "Test attrib property returning self" + msg = self.m.Message() + msg.attrib.attrib.attrib['to'] = 'usr@server.tld' + self.failUnless(str(msg['to']) == 'usr@server.tld') + suite = unittest.TestLoader().loadTestsFromTestCase(testmessagestanzas)