comparison src/core/xmpp.py @ 333:4c835d614bdb

core: fixed a None sent instead of empty dict in unavailableReceived
author Goffi <goffi@goffi.org>
date Tue, 24 May 2011 00:49:20 +0200
parents 608a4a2ba94e
children 698cbc6ebec8
comparison
equal deleted inserted replaced
332:8c9b9ef13ba1 333:4c835d614bdb
21 21
22 from twisted.internet import task, defer 22 from twisted.internet import task, defer
23 from twisted.words.protocols.jabber import jid, xmlstream 23 from twisted.words.protocols.jabber import jid, xmlstream
24 from wokkel import client, disco, xmppim, generic, compat 24 from wokkel import client, disco, xmppim, generic, compat
25 from logging import debug, info, error 25 from logging import debug, info, error
26
26 27
27 class SatXMPPClient(client.XMPPClient): 28 class SatXMPPClient(client.XMPPClient):
28 29
29 def __init__(self, host_app, profile, user_jid, password, host=None, port=5222): 30 def __init__(self, host_app, profile, user_jid, password, host=None, port=5222):
30 client.XMPPClient.__init__(self, user_jid, password, host, port) 31 client.XMPPClient.__init__(self, user_jid, password, host, port)
175 self.host.bridge.presenceUpdate(entity.full(), show or "", 176 self.host.bridge.presenceUpdate(entity.full(), show or "",
176 int(priority), statuses, self.parent.profile) 177 int(priority), statuses, self.parent.profile)
177 178
178 def unavailableReceived(self, entity, statuses=None): 179 def unavailableReceived(self, entity, statuses=None):
179 debug (_("presence update for [%(entity)s] (unavailable, statuses=%(statuses)s)") % {'entity':entity, 'statuses':statuses}) 180 debug (_("presence update for [%(entity)s] (unavailable, statuses=%(statuses)s)") % {'entity':entity, 'statuses':statuses})
180 if statuses and statuses.has_key(None): #we only want string keys 181 if not statuses:
182 statuses = {}
183 if statuses.has_key(None): #we only want string keys
181 statuses["default"] = statuses[None] 184 statuses["default"] = statuses[None]
182 del statuses[None] 185 del statuses[None]
183 self.host.memory.addPresenceStatus(entity, "unavailable", 0, statuses, self.parent.profile) 186 self.host.memory.addPresenceStatus(entity, "unavailable", 0, statuses, self.parent.profile)
184 187
185 #now it's time to notify frontends 188 #now it's time to notify frontends