diff src/core/constants.py @ 1367:f71a0fc26886

merged branch frontends_multi_profiles
author Goffi <goffi@goffi.org>
date Wed, 18 Mar 2015 10:52:28 +0100
parents f296a54af386
children 73f8582c7c99
line wrap: on
line diff
--- a/src/core/constants.py	Thu Feb 05 11:59:26 2015 +0100
+++ b/src/core/constants.py	Wed Mar 18 10:52:28 2015 +0100
@@ -70,18 +70,36 @@
     MENU_JID_CONTEXT = "JID_CONTEXT"
     MENU_ROSTER_JID_CONTEXT = "ROSTER_JID_CONTEXT"
     MENU_ROSTER_GROUP_CONTEXT = "MENU_ROSTER_GROUP_CONTEXT"
+    MENU_ROOM_OCCUPANT_CONTEXT = "MENU_ROOM_OCCUPANT_CONTEXT"
 
 
     ## Profile and entities ##
     PROF_KEY_NONE = '@NONE@'
     PROF_KEY_DEFAULT = '@DEFAULT@'
     ENTITY_ALL = '@ALL@'
-    ENTITY_LAST_RESOURCE = 'LAST_RESOURCE'
+    ENTITY_ALL_RESOURCES = '@ALL_RESOURCES@'
+    ENTITY_MAIN_RESOURCE = '@MAIN_RESOURCE@'
     ENTITY_CAP_HASH = 'CAP_HASH'
 
 
     ## Messages ##
     MESS_TYPE_INFO = 'info'
+    MESS_TYPE_CHAT = 'chat'
+    MESS_TYPE_ERROR = 'error'
+    MESS_TYPE_GROUPCHAT = 'groupchat'
+    MESS_TYPE_HEADLINE = 'headline'
+    MESS_TYPE_NORMAL = 'normal'
+
+    ## PRESENCE ##
+    PRESENCE_UNAVAILABLE = 'unavailable'
+    PRESENCE_SHOW_AWAY = 'away'
+    PRESENCE_SHOW_CHAT = 'chat'
+    PRESENCE_SHOW_DND = 'dnd'
+    PRESENCE_SHOW_XA = 'xa'
+    PRESENCE_SHOW = 'show'
+    PRESENCE_STATUSES = 'statuses'
+    PRESENCE_PRIORITY = 'priority'
+
 
     ## Configuration ##
     if BaseDirectory:  # skipped when xdg module is not available (should not happen in backend)
@@ -202,14 +220,12 @@
 
     @classmethod
     def bool(cls, value):
-        """@return: bool value for any type"""
-        if isinstance(value, str) or isinstance(value, unicode):  # dbus.String is unicode but not str
-            return value.lower() == cls.BOOL_TRUE
-        return bool(value)
+        """@return (bool): bool value for associated constant"""
+        assert isinstance(value, basestring)
+        return value.lower() == cls.BOOL_TRUE
 
     @classmethod
-    def str(cls, value):
-        """@return: str text value for any type"""
-        if isinstance(value, bool):
-            return cls.BOOL_TRUE if value else cls.BOOL_FALSE
-        return str(value)
+    def boolConst(cls, value):
+        """@return (str): constant associated to bool value"""
+        assert isinstance(value, bool)
+        return cls.BOOL_TRUE if value else cls.BOOL_FALSE