diff src/core/xmpp.py @ 1417:176de79c8c39

core, plugin XEP-0045, frontends: change frontend method "setStatusOnline" for "setPresenceStatus": - remove parameter "online" (can be guess from "presence" value) - process "statuses" dict in quick_frontend, so this method can get a simple unicode "status" - add C.PRESENCE_STATUSES_DEFAULT to define the key to use for fallback status
author souliane <souliane@mailoo.org>
date Mon, 20 Apr 2015 16:39:38 +0200
parents 3265a2639182
children 614145ef6e60
line wrap: on
line diff
--- a/src/core/xmpp.py	Sat Apr 18 00:27:39 2015 +0200
+++ b/src/core/xmpp.py	Mon Apr 20 16:39:38 2015 +0200
@@ -315,8 +315,7 @@
             statuses = {}
 
         if None in statuses:  # we only want string keys
-            statuses["default"] = statuses[None]
-            del statuses[None]
+            statuses[C.PRESENCE_STATUSES_DEFAULT] = statuses.pop(None)
 
         self.host.memory.setPresenceStatus(entity, show or "",
                                            int(priority), statuses,
@@ -334,8 +333,7 @@
             statuses = {}
 
         if None in statuses:  # we only want string keys
-            statuses["default"] = statuses[None]
-            del statuses[None]
+            statuses[C.PRESENCE_STATUSES_DEFAULT] = statuses.pop(None)
         self.host.memory.setPresenceStatus(entity, "unavailable", 0, statuses, self.parent.profile)
 
         if not self.host.trigger.point("presenceReceived", entity, "unavailable", 0, statuses, self.parent.profile):
@@ -356,16 +354,14 @@
 
         # default for us is None for wokkel
         # so we must temporarily switch to wokkel's convention...
-        if 'default' in statuses:
-            statuses[None] = statuses['default']
-            del statuses['default']
+        if C.PRESENCE_STATUSES_DEFAULT in statuses:
+            statuses[None] = statuses.pop(C.PRESENCE_STATUSES_DEFAULT)
 
         presence_elt = xmppim.AvailablePresence(entity, show, statuses, priority)
 
         # ... before switching back
         if None in statuses:
-            statuses['default'] = statuses[None]
-            del statuses[None]
+            statuses['default'] = statuses.pop(None)
 
         if not self.host.trigger.point("presence_available", presence_elt, self.parent):
             return