comparison src/core/xmpp.py @ 379:adcc41e4d6ea

core: Fix status update crash bug: 4
author Xavier Maillard <xavier@maillard.im>
date Sat, 27 Aug 2011 12:39:51 +0200
parents ea3e1b82dd79
children 32dc8b18c2ae
comparison
equal deleted inserted replaced
378:3646f6b9adb6 379:adcc41e4d6ea
222 #now it's time to notify frontends 222 #now it's time to notify frontends
223 self.host.bridge.presenceUpdate(entity.full(), "unavailable", 0, statuses, self.parent.profile) 223 self.host.bridge.presenceUpdate(entity.full(), "unavailable", 0, statuses, self.parent.profile)
224 224
225 225
226 def available(self, entity=None, show=None, statuses=None, priority=0): 226 def available(self, entity=None, show=None, statuses=None, priority=0):
227 if statuses and statuses.has_key('default'): 227 if not statuses:
228 statuses = {}
229 # default for us is None for wokkel
230 # so we must temporarily switch to wokkel's convention...
231 if 'default' in statuses:
228 statuses[None] = statuses['default'] 232 statuses[None] = statuses['default']
229 del statuses['default'] 233
230 xmppim.PresenceClientProtocol.available(self, entity, show, statuses, priority) 234 xmppim.PresenceClientProtocol.available(self, entity, show, statuses, priority)
231 235
236 # ... before switching back
237 if None in statuses:
238 del statuses[None]
239
232 def subscribed(self, entity): 240 def subscribed(self, entity):
233 xmppim.PresenceClientProtocol.subscribed(self, entity) 241 xmppim.PresenceClientProtocol.subscribed(self, entity)
234 self.host.memory.delWaitingSub(entity.userhost(), self.parent.profile) 242 self.host.memory.delWaitingSub(entity.userhost(), self.parent.profile)
235 contact = self.host.memory.getContact(entity, self.parent.profile) 243 contact = self.host.memory.getContact(entity, self.parent.profile)
236 if not contact or contact[0]['to'] == 'False': #we automatically subscribe to 'to' presence 244 if not contact or contact[0]['to'] == 'False': #we automatically subscribe to 'to' presence