core: fixed a None sent instead of empty dict in unavailableReceived

This commit is contained in:
Goffi 2011-05-24 00:49:20 +02:00
commit 75f4211b95

View file

@ -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)