Commit 997f0e5a authored by Dan Pascu's avatar Dan Pascu

Adapted test to the latest sipsimple changes

parent 463c3ded
...@@ -178,13 +178,13 @@ class PresencePublicationHandler(object): ...@@ -178,13 +178,13 @@ class PresencePublicationHandler(object):
if notification.sender is BlinkSettings(): if notification.sender is BlinkSettings():
account_manager = AccountManager() account_manager = AccountManager()
if 'presence.offline_note' in notification.data.modified: if 'presence.offline_note' in notification.data.modified:
for account in (account for account in account_manager.get_accounts() if account.xcap_available): for account in (account for account in account_manager.get_accounts() if account.xcap.discovered):
state = BlinkPresenceState(account).offline_state state = BlinkPresenceState(account).offline_state
account.xcap_manager.set_offline_status(OfflineStatus(state) if state is not None else None) account.xcap_manager.set_offline_status(OfflineStatus(state) if state is not None else None)
if 'presence.icon' in notification.data.modified: if 'presence.icon' in notification.data.modified:
icon = IconManager().get('avatar') icon = IconManager().get('avatar')
status_icon = Icon(icon.content, icon.content_type) if icon is not None else None status_icon = Icon(icon.content, icon.content_type) if icon is not None else None
for account in (account for account in account_manager.get_accounts() if account.xcap_available): for account in (account for account in account_manager.get_accounts() if account.xcap.discovered):
account.xcap_manager.set_status_icon(status_icon) account.xcap_manager.set_status_icon(status_icon)
if 'presence.current_state' in notification.data.modified: if 'presence.current_state' in notification.data.modified:
for account in (account for account in account_manager.get_accounts() if account.enabled and account.presence.enabled): for account in (account for account in account_manager.get_accounts() if account.enabled and account.presence.enabled):
...@@ -196,7 +196,7 @@ class PresencePublicationHandler(object): ...@@ -196,7 +196,7 @@ class PresencePublicationHandler(object):
account.save() account.save()
elif {'presence.enabled', 'display_name', 'xcap.icon'}.intersection(notification.data.modified) and account.presence.enabled: elif {'presence.enabled', 'display_name', 'xcap.icon'}.intersection(notification.data.modified) and account.presence.enabled:
account.presence_state = BlinkPresenceState(account).online_state account.presence_state = BlinkPresenceState(account).online_state
if account.xcap_available and (set(notification.data.modified) != {'xcap.icon'} or account.id in self._should_set_offline_status): if account.xcap.discovered and (set(notification.data.modified) != {'xcap.icon'} or account.id in self._should_set_offline_status):
state = BlinkPresenceState(account).offline_state state = BlinkPresenceState(account).offline_state
account.xcap_manager.set_offline_status(OfflineStatus(state) if state is not None else None) account.xcap_manager.set_offline_status(OfflineStatus(state) if state is not None else None)
if account.id in self._should_set_offline_status: # do not use set.discard() here to avoid race conditions. it should only be removed if present. if account.id in self._should_set_offline_status: # do not use set.discard() here to avoid race conditions. it should only be removed if present.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment