From 75f4211b95e3762d875d0e9a87dcbfe4fd5a4595 Mon Sep 17 00:00:00 2001 From: Goffi Date: Tue, 24 May 2011 00:49:20 +0200 Subject: [PATCH] core: fixed a None sent instead of empty dict in unavailableReceived --- src/core/xmpp.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/xmpp.py b/src/core/xmpp.py index 76e5b4a9..4f058602 100644 --- a/src/core/xmpp.py +++ b/src/core/xmpp.py @@ -24,6 +24,7 @@ from twisted.words.protocols.jabber import jid, xmlstream from wokkel import client, disco, xmppim, generic, compat from logging import debug, info, error + class SatXMPPClient(client.XMPPClient): def __init__(self, host_app, profile, user_jid, password, host=None, port=5222): @@ -177,7 +178,9 @@ class SatPresenceProtocol(xmppim.PresenceClientProtocol): def unavailableReceived(self, entity, statuses=None): debug (_("presence update for [%(entity)s] (unavailable, statuses=%(statuses)s)") % {'entity':entity, 'statuses':statuses}) - if statuses and statuses.has_key(None): #we only want string keys + if not statuses: + statuses = {} + if statuses.has_key(None): #we only want string keys statuses["default"] = statuses[None] del statuses[None] self.host.memory.addPresenceStatus(entity, "unavailable", 0, statuses, self.parent.profile)