comparison src/core/xmpp.py @ 334:698cbc6ebec8

core: fixed None instead of empty dict in availableReceived
author Goffi <goffi@goffi.org>
date Tue, 24 May 2011 00:53:09 +0200
parents 4c835d614bdb
children 953536246d9d
comparison
equal deleted inserted replaced
333:4c835d614bdb 334:698cbc6ebec8
163 self.host = host 163 self.host = host
164 164
165 def availableReceived(self, entity, show=None, statuses=None, priority=0): 165 def availableReceived(self, entity, show=None, statuses=None, priority=0):
166 debug (_("presence update for [%(entity)s] (available, show=%(show)s statuses=%(statuses)s priority=%(priority)d)") % {'entity':entity, 'show':show, 'statuses':statuses, 'priority':priority}) 166 debug (_("presence update for [%(entity)s] (available, show=%(show)s statuses=%(statuses)s priority=%(priority)d)") % {'entity':entity, 'show':show, 'statuses':statuses, 'priority':priority})
167 167
168 if not statuses:
169 statuses = {}
170
168 if statuses.has_key(None): #we only want string keys 171 if statuses.has_key(None): #we only want string keys
169 statuses["default"] = statuses[None] 172 statuses["default"] = statuses[None]
170 del statuses[None] 173 del statuses[None]
171 174
172 self.host.memory.addPresenceStatus(entity, show or "", 175 self.host.memory.addPresenceStatus(entity, show or "",
176 self.host.bridge.presenceUpdate(entity.full(), show or "", 179 self.host.bridge.presenceUpdate(entity.full(), show or "",
177 int(priority), statuses, self.parent.profile) 180 int(priority), statuses, self.parent.profile)
178 181
179 def unavailableReceived(self, entity, statuses=None): 182 def unavailableReceived(self, entity, statuses=None):
180 debug (_("presence update for [%(entity)s] (unavailable, statuses=%(statuses)s)") % {'entity':entity, 'statuses':statuses}) 183 debug (_("presence update for [%(entity)s] (unavailable, statuses=%(statuses)s)") % {'entity':entity, 'statuses':statuses})
184
181 if not statuses: 185 if not statuses:
182 statuses = {} 186 statuses = {}
187
183 if statuses.has_key(None): #we only want string keys 188 if statuses.has_key(None): #we only want string keys
184 statuses["default"] = statuses[None] 189 statuses["default"] = statuses[None]
185 del statuses[None] 190 del statuses[None]
186 self.host.memory.addPresenceStatus(entity, "unavailable", 0, statuses, self.parent.profile) 191 self.host.memory.addPresenceStatus(entity, "unavailable", 0, statuses, self.parent.profile)
187 192