changeset 916:1a759096ccbd

core: use of Const for profile_key + replaced '@DEFAULT@' default profile_key by '@NONE@'
author Goffi <goffi@goffi.org>
date Fri, 21 Mar 2014 16:27:09 +0100
parents 6f96ee4d8cc0
children a9401694d2dc
files src/core/constants.py src/core/sat_main.py src/memory/memory.py src/memory/params.py src/plugins/plugin_adhoc_dbus.py src/plugins/plugin_exp_pipe.py src/plugins/plugin_misc_groupblog.py src/plugins/plugin_misc_maildir.py src/plugins/plugin_misc_quiz.py src/plugins/plugin_misc_room_game.py src/plugins/plugin_misc_tarot.py src/plugins/plugin_xep_0045.py src/plugins/plugin_xep_0050.py src/plugins/plugin_xep_0054.py src/plugins/plugin_xep_0060.py src/plugins/plugin_xep_0077.py src/plugins/plugin_xep_0085.py src/plugins/plugin_xep_0095.py src/plugins/plugin_xep_0096.py src/plugins/plugin_xep_0100.py src/plugins/plugin_xep_0115.py src/plugins/plugin_xep_0163.py src/plugins/plugin_xep_0249.py src/plugins/plugin_xep_0277.py src/tools/utils.py
diffstat 25 files changed, 123 insertions(+), 101 deletions(-) [+]
line wrap: on
line diff
--- a/src/core/constants.py	Fri Mar 21 16:19:46 2014 +0100
+++ b/src/core/constants.py	Fri Mar 21 16:27:09 2014 +0100
@@ -23,3 +23,5 @@
     INDIVIDUAL = "individual"
     GENERAL = "general"
     SAVEFILE_DATABASE = "/sat.db"
+    PROF_KEY_NONE = '@NONE@'
+    PROF_KEY_DEFAULT = '@DEFAULT@'
--- a/src/core/sat_main.py	Fri Mar 21 16:19:46 2014 +0100
+++ b/src/core/sat_main.py	Fri Mar 21 16:27:09 2014 +0100
@@ -219,11 +219,11 @@
             self.plugins[import_name].is_handler = False
         #TODO: test xmppclient presence and register handler parent
 
-    def connect(self, profile_key='@NONE@'):
+    def connect(self, profile_key=C.PROF_KEY_NONE):
         """Connect to jabber server"""
         self.asyncConnect(profile_key)
 
-    def asyncConnect(self, profile_key='@NONE@'):
+    def asyncConnect(self, profile_key=C.PROF_KEY_NONE):
         """Connect to jabber server with asynchronous reply
         @param profile_key: %(doc_profile)s
         """
@@ -392,7 +392,7 @@
             return None
         return self.profiles[profile].getHostJid()
 
-    def registerNewAccount(self, login, password, email, server, port=5222, id_=None, profile_key='@NONE@'):
+    def registerNewAccount(self, login, password, email, server, port=5222, id_=None, profile_key=C.PROF_KEY_NONE):
         """Connect to a server and create a new account using in-band registration"""
         profile = self.memory.getProfileName(profile_key)
         assert(profile)
@@ -469,12 +469,12 @@
             ret.append((conf_id, conf_type, data))
         return ret
 
-    def _sendMessage(self, to_s, msg, subject=None, mess_type='auto', extra={}, profile_key='@NONE@'):
+    def _sendMessage(self, to_s, msg, subject=None, mess_type='auto', extra={}, profile_key=C.PROF_KEY_NONE):
         to_jid = jid.JID(to_s)
         #XXX: we need to use the dictionary comprehension because D-Bus return its own types, and pickle can't manage them. TODO: Need to find a better way
         return self.sendMessage(to_jid, msg, subject, mess_type, {unicode(key): unicode(value) for key, value in extra.items()}, profile_key=profile_key)
 
-    def sendMessage(self, to_jid, msg, subject=None, mess_type='auto', extra={}, no_trigger=False, profile_key='@NONE@'):
+    def sendMessage(self, to_jid, msg, subject=None, mess_type='auto', extra={}, no_trigger=False, profile_key=C.PROF_KEY_NONE):
         #FIXME: check validity of recipient
         profile = self.memory.getProfileName(profile_key)
         assert(profile)
@@ -574,10 +574,10 @@
                                        extra=mess_data['extra'],
                                        profile=profile)
 
-    def _setPresence(self, to="", show="", priority=0, statuses=None, profile_key='@NONE@'):
+    def _setPresence(self, to="", show="", priority=0, statuses=None, profile_key=C.PROF_KEY_NONE):
         return self.setPresence(jid.JID(to) if to else None, show, priority, statuses, profile_key)
 
-    def setPresence(self, to_jid=None, show="", priority=0, statuses=None, profile_key='@NONE@'):
+    def setPresence(self, to_jid=None, show="", priority=0, statuses=None, profile_key=C.PROF_KEY_NONE):
         """Send our presence information"""
         if statuses is None:
             statuses = {}
@@ -866,7 +866,7 @@
         debug("Removing callback [%s]" % callback_id)
         del self._cb_map[callback_id]
 
-    def launchCallback(self, callback_id, data=None, profile_key="@NONE@"):
+    def launchCallback(self, callback_id, data=None, profile_key=C.PROF_KEY_NONE):
         """Launch a specific callback
         @param callback_id: id of the action (callback) to launch
         @param data: optional data
--- a/src/memory/memory.py	Fri Mar 21 16:19:46 2014 +0100
+++ b/src/memory/memory.py	Fri Mar 21 16:27:09 2014 +0100
@@ -241,14 +241,14 @@
         """
         return self.params.asyncDeleteProfile(name, force)
 
-    def addToHistory(self, from_jid, to_jid, message, type_='chat', extra=None, timestamp=None, profile="@NONE@"):
-        assert profile != "@NONE@"
+    def addToHistory(self, from_jid, to_jid, message, type_='chat', extra=None, timestamp=None, profile=C.PROF_KEY_NONE):
+        assert profile != C.PROF_KEY_NONE
         if extra is None:
             extra = {}
         return self.storage.addToHistory(from_jid, to_jid, message, type_, extra, timestamp, profile)
 
-    def getHistory(self, from_jid, to_jid, limit=0, between=True, profile="@NONE@"):
-        assert profile != "@NONE@"
+    def getHistory(self, from_jid, to_jid, limit=0, between=True, profile=C.PROF_KEY_NONE):
+        assert profile != C.PROF_KEY_NONE
         return self.storage.getHistory(jid.JID(from_jid), jid.JID(to_jid), limit, between, profile)
 
     def addServerFeature(self, feature, jid_, profile):
@@ -319,7 +319,7 @@
             entities.update(set_)
         return entities
 
-    def hasServerFeature(self, feature, jid_=None, profile_key="@NONE@"):
+    def hasServerFeature(self, feature, jid_=None, profile_key=C.PROF_KEY_NONE):
         """Tell if the specified server has the required feature
         @param feature: requested feature
         @param jid_: the jid of the target server (None for profile's server)
@@ -387,7 +387,7 @@
         """Set a misc data for an entity
         @param entity_jid: JID of the entity, or '@ALL@' to update all entities)
         @param key: key to set (eg: "type")
-        @param value: value for this key (eg: "chatroom"), or '@NONE@' to delete
+        @param value: value for this key (eg: "chatroom"), or C.PROF_KEY_NONE to delete
         @param profile_key: %(doc_profile_key)s
         """
         profile = self.getProfileName(profile_key)
@@ -403,7 +403,7 @@
             entities_map = {entity: self.entitiesCache[profile][entity]}
         for entity in entities_map:
             entity_map = entities_map[entity]
-            if value == "@NONE@" and key in entity_map:
+            if value == C.PROF_KEY_NONE and key in entity_map:
                 del entity_map[key]
             else:
                 entity_map[key] = value
@@ -473,31 +473,31 @@
 
         return self.subscriptions[profile]
 
-    def getStringParamA(self, name, category, attr="value", profile_key='@NONE@'):
+    def getStringParamA(self, name, category, attr="value", profile_key=C.PROF_KEY_NONE):
         return self.params.getStringParamA(name, category, attr, profile_key)
 
-    def getParamA(self, name, category, attr="value", profile_key='@NONE@'):
+    def getParamA(self, name, category, attr="value", profile_key=C.PROF_KEY_NONE):
         return self.params.getParamA(name, category, attr, profile_key)
 
-    def asyncGetParamA(self, name, category, attr="value", security_limit=C.NO_SECURITY_LIMIT, profile_key='@NONE@'):
+    def asyncGetParamA(self, name, category, attr="value", security_limit=C.NO_SECURITY_LIMIT, profile_key=C.PROF_KEY_NONE):
         return self.params.asyncGetParamA(name, category, attr, security_limit, profile_key)
 
-    def asyncGetStringParamA(self, name, category, attr="value", security_limit=C.NO_SECURITY_LIMIT, profile_key='@NONE@'):
+    def asyncGetStringParamA(self, name, category, attr="value", security_limit=C.NO_SECURITY_LIMIT, profile_key=C.PROF_KEY_NONE):
         return self.params.asyncGetStringParamA(name, category, attr, security_limit, profile_key)
 
-    def getParamsUI(self, security_limit=C.NO_SECURITY_LIMIT, app='', profile_key='@NONE@'):
+    def getParamsUI(self, security_limit=C.NO_SECURITY_LIMIT, app='', profile_key=C.PROF_KEY_NONE):
         return self.params.getParamsUI(security_limit, app, profile_key)
 
-    def getParams(self, security_limit=C.NO_SECURITY_LIMIT, app='', profile_key='@NONE@'):
+    def getParams(self, security_limit=C.NO_SECURITY_LIMIT, app='', profile_key=C.PROF_KEY_NONE):
         return self.params.getParams(security_limit, app, profile_key)
 
-    def getParamsForCategory(self, category, security_limit=C.NO_SECURITY_LIMIT, app='', profile_key='@NONE@'):
+    def getParamsForCategory(self, category, security_limit=C.NO_SECURITY_LIMIT, app='', profile_key=C.PROF_KEY_NONE):
         return self.params.getParamsForCategory(category, security_limit, app, profile_key)
 
     def getParamsCategories(self):
         return self.params.getParamsCategories()
 
-    def setParam(self, name, value, category, security_limit=C.NO_SECURITY_LIMIT, profile_key='@NONE@'):
+    def setParam(self, name, value, category, security_limit=C.NO_SECURITY_LIMIT, profile_key=C.PROF_KEY_NONE):
         return self.params.setParam(name, value, category, security_limit, profile_key)
 
     def updateParams(self, xml):
--- a/src/memory/params.py	Fri Mar 21 16:19:46 2014 +0100
+++ b/src/memory/params.py	Fri Mar 21 16:27:09 2014 +0100
@@ -176,7 +176,7 @@
                     info(_('No profile exist yet'))
                     return ""
             return default  # FIXME: temporary, must use real default value, and fallback to first one if it doesn't exists
-        elif profile_key == '@NONE@':
+        elif profile_key == C.PROF_KEY_NONE:
             raise exceptions.ProfileNotSetError
         elif return_profile_keys and profile_key in ["@ALL@"]:
             return profile_key # this value must be managed by the caller
@@ -323,11 +323,11 @@
             return "true" if result else "false"
         return result
 
-    def getStringParamA(self, name, category, attr="value", profile_key="@NONE@"):
+    def getStringParamA(self, name, category, attr="value", profile_key=C.PROF_KEY_NONE):
         """ Same as getParamA but for bridge: convert non string value to string """
         return self.__type_to_string(self.getParamA(name, category, attr, profile_key))
 
-    def getParamA(self, name, category, attr="value", profile_key="@NONE@"):
+    def getParamA(self, name, category, attr="value", profile_key=C.PROF_KEY_NONE):
         """Helper method to get a specific attribute
            @param name: name of the parameter
            @param category: category of the parameter
@@ -360,12 +360,12 @@
             value = self._getParam(category, name, profile=profile)
             return self._getAttr(node[1], attr, value)
 
-    def asyncGetStringParamA(self, name, category, attr="value", security_limit=C.NO_SECURITY_LIMIT, profile_key="@NONE@"):
+    def asyncGetStringParamA(self, name, category, attr="value", security_limit=C.NO_SECURITY_LIMIT, profile_key=C.PROF_KEY_NONE):
         d = self.asyncGetParamA(name, category, attr, security_limit, profile_key)
         d.addCallback(self.__type_to_string)
         return d
 
-    def asyncGetParamA(self, name, category, attr="value", security_limit=C.NO_SECURITY_LIMIT, profile_key="@NONE@"):
+    def asyncGetParamA(self, name, category, attr="value", security_limit=C.NO_SECURITY_LIMIT, profile_key=C.PROF_KEY_NONE):
         """Helper method to get a specific attribute
            @param name: name of the parameter
            @param category: category of the parameter
@@ -402,7 +402,7 @@
             d = self.storage.getIndParam(category, name, profile)
             return d.addCallback(lambda value: self._getAttr(node[1], attr, value))
 
-    def _getParam(self, category, name, type_=C.INDIVIDUAL, cache=None, profile="@NONE@"):
+    def _getParam(self, category, name, type_=C.INDIVIDUAL, cache=None, profile=C.PROF_KEY_NONE):
         """Return the param, or None if it doesn't exist
         @param category: param category
         @param name: param name
@@ -416,7 +416,7 @@
                 return self.params_gen[(category, name)]
             return None  # This general param has the default value
         assert (type_ == C.INDIVIDUAL)
-        if profile == "@NONE@":
+        if profile == C.PROF_KEY_NONE:
             raise exceptions.ProfileNotSetError
         if profile in self.params:
             cache = self.params[profile]  # if profile is in main cache, we use it,
@@ -608,10 +608,10 @@
                 categories.append(cat.getAttribute("name"))
         return categories
 
-    def setParam(self, name, value, category, security_limit=C.NO_SECURITY_LIMIT, profile_key='@NONE@'):
+    def setParam(self, name, value, category, security_limit=C.NO_SECURITY_LIMIT, profile_key=C.PROF_KEY_NONE):
         """Set a parameter, return None if the parameter is not in param xml"""
         #TODO: use different behaviour depending of the data type (e.g. password encrypted)
-        if profile_key != "@NONE@":
+        if profile_key != C.PROF_KEY_NONE:
             profile = self.getProfileName(profile_key)
             if not profile:
                 error(_('Trying to set parameter for an unknown profile'))
@@ -638,7 +638,7 @@
             return
 
         assert (node[0] == C.INDIVIDUAL)
-        assert (profile_key != "@NONE@")
+        assert (profile_key != C.PROF_KEY_NONE)
 
         type_ = node[1].getAttribute("type")
         if type_ == "button":
--- a/src/plugins/plugin_adhoc_dbus.py	Fri Mar 21 16:19:46 2014 +0100
+++ b/src/plugins/plugin_adhoc_dbus.py	Fri Mar 21 16:27:09 2014 +0100
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from sat.core.i18n import _, D_
+from sat.core.constants import Const as C
 from logging import debug, info, warning, error
 from twisted.words.protocols.jabber import jid
 from twisted.internet import defer, reactor
@@ -120,7 +121,7 @@
         return self.adHocDBusAddAuto(prog_name, allowed_jids, allowed_groups, allowed_magics, forbidden_jids, forbidden_groups, flags, profile_key)
 
     @defer.inlineCallbacks
-    def adHocDBusAddAuto(self, prog_name, allowed_jids=None, allowed_groups=None, allowed_magics=None, forbidden_jids=None, forbidden_groups=None, flags=None, profile_key='@NONE@'):
+    def adHocDBusAddAuto(self, prog_name, allowed_jids=None, allowed_groups=None, allowed_magics=None, forbidden_jids=None, forbidden_groups=None, flags=None, profile_key=C.PROF_KEY_NONE):
         bus_names = yield self._DBusListNames()
         bus_names = [bus_name for bus_name in bus_names if '.' + prog_name in bus_name]
         if not bus_names:
@@ -149,7 +150,7 @@
         defer.returnValue((bus_name, methods))
 
 
-    def _addCommand(self, adhoc_name, bus_name, methods, allowed_jids=None, allowed_groups=None, allowed_magics=None, forbidden_jids=None, forbidden_groups=None, flags=None, profile_key='@NONE@'):
+    def _addCommand(self, adhoc_name, bus_name, methods, allowed_jids=None, allowed_groups=None, allowed_magics=None, forbidden_jids=None, forbidden_groups=None, flags=None, profile_key=C.PROF_KEY_NONE):
         if flags is None:
             flags = set()
 
--- a/src/plugins/plugin_exp_pipe.py	Fri Mar 21 16:19:46 2014 +0100
+++ b/src/plugins/plugin_exp_pipe.py	Fri Mar 21 16:27:09 2014 +0100
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from sat.core.i18n import _
+from sat.core.constants import Const as C
 from logging import debug, info, warning, error
 from twisted.words.xish import domish
 from twisted.words.protocols.jabber import jid
@@ -222,7 +223,7 @@
         else:
             warning(_("Invalid stream method received"))
 
-    def pipeOut(self, to_jid, filepath, data={}, profile_key='@DEFAULT@'):
+    def pipeOut(self, to_jid, filepath, data={}, profile_key=C.PROF_KEY_NONE):
         """send a file using EXP-PIPE
         @to_jid: recipient
         @filepath: absolute path to the named pipe to send
--- a/src/plugins/plugin_misc_groupblog.py	Fri Mar 21 16:19:46 2014 +0100
+++ b/src/plugins/plugin_misc_groupblog.py	Fri Mar 21 16:27:09 2014 +0100
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from sat.core.i18n import _
+from sat.core.constants import Const as C
 from logging import debug, info, warning, error
 from twisted.internet import defer
 from twisted.words.protocols.jabber import jid
@@ -357,7 +358,7 @@
         #TODO
         return failure
 
-    def sendGroupBlog(self, access_type, access_list, message, extra, profile_key='@NONE@'):
+    def sendGroupBlog(self, access_type, access_list, message, extra, profile_key=C.PROF_KEY_NONE):
         """Publish a microblog with given item access
         @param access_type: one of "PUBLIC", "GROUP", "JID"
         @param access_list: list of authorized entity (empty list for PUBLIC ACCESS,
@@ -388,7 +389,7 @@
 
         return self._initialise(profile_key).addCallback(initialised)
 
-    def deleteGroupBlog(self, pub_data, comments, profile_key='@NONE@'):
+    def deleteGroupBlog(self, pub_data, comments, profile_key=C.PROF_KEY_NONE):
         """Delete a microblog item from a node.
         @param pub_data: a tuple (service, node identifier, item identifier)
         @param comments: comments node identifier (for main item) or empty string
@@ -425,7 +426,7 @@
 
         return self._initialise(profile_key).addCallback(initialised).addCallback(notify)
 
-    def updateGroupBlog(self, pub_data, comments, message, extra, profile_key='@NONE@'):
+    def updateGroupBlog(self, pub_data, comments, message, extra, profile_key=C.PROF_KEY_NONE):
         """Modify a microblog node
         @param pub_data: a tuple (service, node identifier, item identifier)
         @param comments: comments node identifier (for main item) or empty string
@@ -462,7 +463,7 @@
 
         return self._initialise(profile_key).addCallback(initialised)
 
-    def sendGroupBlogComment(self, node_url, message, extra, profile_key='@NONE@'):
+    def sendGroupBlogComment(self, node_url, message, extra, profile_key=C.PROF_KEY_NONE):
         """Publish a comment in the given node
         @param node url: link to the comments node as specified in XEP-0277 and given in microblog data's comments key
         @param message: comment
@@ -514,7 +515,7 @@
                     warning("Missing key for comments")
         defer.returnValue(ret)
 
-    def __getGroupBlogs(self, pub_jid_s, max_items=10, item_ids=None, profile_key='@NONE@'):
+    def __getGroupBlogs(self, pub_jid_s, max_items=10, item_ids=None, profile_key=C.PROF_KEY_NONE):
         """Retrieve previously published items from a publish subscribe node.
         @param pub_jid_s: jid of the publisher
         @param max_items: how many microblogs we want to get (see XEP-0060 #6.5.7)
@@ -535,7 +536,7 @@
         #TODO: we need to use the server corresponding the the host of the jid
         return self._initialise(profile_key).addCallback(initialised)
 
-    def getGroupBlogs(self, pub_jid_s, item_ids=None, profile_key='@NONE@'):
+    def getGroupBlogs(self, pub_jid_s, item_ids=None, profile_key=C.PROF_KEY_NONE):
         """Get the published microblogs of the specified IDs. If item_ids is
         None, the result would be the same than calling getLastGroupBlogs
         with the default value for the attribute max_items.
@@ -546,7 +547,7 @@
         """
         return self.__getGroupBlogs(pub_jid_s, item_ids=item_ids, profile_key=profile_key)
 
-    def getGroupBlogsWithComments(self, pub_jid_s, item_ids=None, profile_key='@NONE@'):
+    def getGroupBlogsWithComments(self, pub_jid_s, item_ids=None, profile_key=C.PROF_KEY_NONE):
         """Get the published microblogs of the specified IDs and their comments. If
         item_ids is None, returns the last published microblogs and their comments.
         @param pub_jid_s: jid of the publisher
@@ -572,7 +573,7 @@
         return d
 
 
-    def getLastGroupBlogs(self, pub_jid_s, max_items=10, profile_key='@NONE@'):
+    def getLastGroupBlogs(self, pub_jid_s, max_items=10, profile_key=C.PROF_KEY_NONE):
         """Get the last published microblogs
         @param pub_jid_s: jid of the publisher
         @param max_items: how many microblogs we want to get (see XEP-0060 #6.5.7)
@@ -581,7 +582,7 @@
         """
         return self.__getGroupBlogs(pub_jid_s, max_items=max_items, profile_key=profile_key)
 
-    def getLastGroupBlogsAtom(self, pub_jid_s, max_items=10, profile_key='@NONE@'):
+    def getLastGroupBlogsAtom(self, pub_jid_s, max_items=10, profile_key=C.PROF_KEY_NONE):
         """Get the atom feed of the last published microblogs
         @param pub_jid: jid of the publisher
         @param max_items: how many microblogs we want to get (see XEP-0060 #6.5.7)
@@ -628,7 +629,7 @@
         #TODO: we need to use the server corresponding the the host of the jid
         return self._initialise(profile_key).addCallback(initialised)
 
-    def getGroupBlogComments(self, service_s, node, profile_key='@NONE@'):
+    def getGroupBlogComments(self, service_s, node, profile_key=C.PROF_KEY_NONE):
         """Get all comments of given node
         @param service_s: service hosting the node
         @param node: comments node
@@ -648,14 +649,14 @@
         #TODO: we need to use the server corresponding the the host of the jid
         return self._initialise(profile_key).addCallback(initialised)
 
-    def _getMassiveLastGroupBlogs(self, publishers_type, publishers, max_items=10, profile_key='@NONE@'):
+    def _getMassiveLastGroupBlogs(self, publishers_type, publishers, max_items=10, profile_key=C.PROF_KEY_NONE):
         if publishers_type == 'JID':
             publishers_jids = [jid.JID(publisher) for publisher in publishers]
         else:
             publishers_jids = publishers
         return self.getMassiveLastGroupBlogs(publishers_type, publishers_jids, max_items, profile_key)
 
-    def getMassiveLastGroupBlogs(self, publishers_type, publishers, max_items=10, profile_key='@NONE@'):
+    def getMassiveLastGroupBlogs(self, publishers_type, publishers, max_items=10, profile_key=C.PROF_KEY_NONE):
         """Get the last published microblogs for a list of groups or jids
         @param publishers_type: type of the list of publishers (one of "GROUP" or "JID" or "ALL")
         @param publishers: list of publishers, according to "publishers_type" (list of groups or list of jids)
@@ -715,7 +716,7 @@
         return self._initialise(profile_key).addCallback(initialised)
         #TODO: we need to use the server corresponding the the host of the jid
 
-    def subscribeGroupBlog(self, pub_jid, profile_key='@NONE@'):
+    def subscribeGroupBlog(self, pub_jid, profile_key=C.PROF_KEY_NONE):
         def initialised(result):
             profile, client = result
             d = self.host.plugins["XEP-0060"].subscribe(client.item_access_pubsub, self.getNodeName(jid.JID(pub_jid)),
@@ -725,14 +726,14 @@
         #TODO: we need to use the server corresponding the the host of the jid
         return self._initialise(profile_key).addCallback(initialised)
 
-    def _massiveSubscribeGroupBlogs(self, publishers_type, publishers, profile_key='@NONE@'):
+    def _massiveSubscribeGroupBlogs(self, publishers_type, publishers, profile_key=C.PROF_KEY_NONE):
         if publishers_type == 'JID':
             publishers_jids = [jid.JID(publisher) for publisher in publishers]
         else:
             publishers_jids = publishers
         return self.massiveSubscribeGroupBlogs(publishers_type, publishers_jids, profile_key)
 
-    def massiveSubscribeGroupBlogs(self, publishers_type, publishers, profile_key='@NONE@'):
+    def massiveSubscribeGroupBlogs(self, publishers_type, publishers, profile_key=C.PROF_KEY_NONE):
         """Subscribe microblogs for a list of groups or jids
         @param publishers_type: type of the list of publishers (one of "GROUP" or "JID" or "ALL")
         @param publishers: list of publishers, according to "publishers_type" (list of groups or list of jids)
--- a/src/plugins/plugin_misc_maildir.py	Fri Mar 21 16:19:46 2014 +0100
+++ b/src/plugins/plugin_misc_maildir.py	Fri Mar 21 16:27:09 2014 +0100
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from sat.core.i18n import _
+from sat.core.constants import Const as C
 from logging import debug, info, error
 import warnings
 warnings.filterwarnings('ignore', 'the MimeWriter', DeprecationWarning, 'twisted')  # FIXME: to be removed, see http://twistedmatrix.com/trac/ticket/4038
@@ -100,7 +101,7 @@
                 self.accessMessageBox("INBOX", profile_key=profile).addMessage(message)
                 return False
 
-    def accessMessageBox(self, boxname, observer=None, profile_key='@DEFAULT@'):
+    def accessMessageBox(self, boxname, observer=None, profile_key=C.PROF_KEY_NONE):
         """Create and return a MailboxUser instance
         @param boxname: name of the box
         @param observer: method to call when a NewMessage arrive"""
@@ -327,7 +328,7 @@
                 mail['Subject'] = e.children[0].encode('utf-8')
         return mail.as_string()
 
-    def __init__(self, _maildir, name, observer=None, profile="@NONE@"):
+    def __init__(self, _maildir, name, observer=None, profile=C.PROF_KEY_NONE):
         """@param _maildir: the main MaildirBox instance
            @param name: name of the mailbox
            @param profile: real profile (ie not a profile_key)
--- a/src/plugins/plugin_misc_quiz.py	Fri Mar 21 16:19:46 2014 +0100
+++ b/src/plugins/plugin_misc_quiz.py	Fri Mar 21 16:27:09 2014 +0100
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from sat.core.i18n import _
+from sat.core.constants import Const as C
 from logging import debug, info, warning, error
 from twisted.words.xish import domish
 from twisted.internet import protocol, defer, threads, reactor
@@ -175,7 +176,7 @@
         yourturn_elt = mess.firstChildElement().addElement('your_turn')
         self.host.profiles[profile].xmlstream.send(mess)
 
-    def playerAnswer(self, player, referee, answer, profile_key='@DEFAULT@'):
+    def playerAnswer(self, player, referee, answer, profile_key=C.PROF_KEY_NONE):
         """Called when a player give an answer"""
         profile = self.host.memory.getProfileName(profile_key)
         if not profile:
--- a/src/plugins/plugin_misc_room_game.py	Fri Mar 21 16:19:46 2014 +0100
+++ b/src/plugins/plugin_misc_room_game.py	Fri Mar 21 16:27:09 2014 +0100
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from sat.core.i18n import _
+from sat.core.constants import Const as C
 from logging import debug, warning, error
 from twisted.words.protocols.jabber.jid import JID
 from twisted.words.xish import domish
@@ -382,7 +383,7 @@
             debug(_("Still waiting for %(users)s before starting the game %(game)s in %(room)s") % {'users': result[2], 'game': self.name, 'room': room.occupantJID.userhost()})
         return result
 
-    def getUniqueName(self, muc_service="", profile_key='@DEFAULT@'):
+    def getUniqueName(self, muc_service="", profile_key=C.PROF_KEY_NONE):
         """
         @param muc_service: you can leave empty to autofind the muc service
         @param profile_key
@@ -391,7 +392,7 @@
         room = self.host.plugins["XEP-0045"].getUniqueName(muc_service, profile_key=profile_key)
         return "sat_%s_%s" % (self.name.lower(), room) if room != "" else ""
 
-    def prepareRoom(self, other_players=None, room_jid_s=None, profile_key='@NONE@'):
+    def prepareRoom(self, other_players=None, room_jid_s=None, profile_key=C.PROF_KEY_NONE):
         """Prepare the room for a game: create it if it doesn't exist and invite players.
         @param other_players: list for other players JID userhosts
         @param room_jid_s: JID userhost of the room, or None to generate a unique name
@@ -517,7 +518,7 @@
             self._initGame(room_jid_s, user_nick)
         return True, False
 
-    def createGame(self, room_jid_s, nicks=None, profile_key='@NONE@'):
+    def createGame(self, room_jid_s, nicks=None, profile_key=C.PROF_KEY_NONE):
         """Create a new game - this can be called directly from a frontend
         and skips all the checks and invitation system, but the game must
         not exist and all the players must be in the room already.
@@ -545,7 +546,7 @@
                 # The dict must be COPIED otherwise it is shared between all users
                 self.games[room_jid_s]['players_data'][nick] = copy.deepcopy(self.player_init)
 
-    def playerReady(self, player, referee, profile_key='@NONE@'):
+    def playerReady(self, player, referee, profile_key=C.PROF_KEY_NONE):
         """Must be called when player is ready to start a new game
         @param player: the player nick in the room
         @param referee: referee userhost
--- a/src/plugins/plugin_misc_tarot.py	Fri Mar 21 16:19:46 2014 +0100
+++ b/src/plugins/plugin_misc_tarot.py	Fri Mar 21 16:27:09 2014 +0100
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from sat.core.i18n import _
+from sat.core.constants import Const as C
 from logging import debug, info, warning, error
 from twisted.words.xish import domish
 from twisted.words.protocols.jabber import jid
@@ -426,7 +427,7 @@
         del self._sessions[raw_data["session_id"]]
         return defer.succeed({})
 
-    def play_cards(self, player, referee, cards, profile_key='@NONE@'):
+    def play_cards(self, player, referee, cards, profile_key=C.PROF_KEY_NONE):
         """Must be call by player when the contrat is selected
         @param player: player's name
         @param referee: arbiter jid
--- a/src/plugins/plugin_xep_0045.py	Fri Mar 21 16:19:46 2014 +0100
+++ b/src/plugins/plugin_xep_0045.py	Fri Mar 21 16:27:09 2014 +0100
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from sat.core.i18n import _
+from sat.core.constants import Const as C
 from logging import debug, info, warning, error
 from twisted.internet import defer
 from twisted.words.protocols.jabber import jid
@@ -116,7 +117,7 @@
         self.host.bridge.newAlert(mess, _("Group chat error"), "ERROR", profile)
         raise failure
 
-    def getRoomsJoined(self, profile_key='@DEFAULT@'):
+    def getRoomsJoined(self, profile_key=C.PROF_KEY_NONE):
         """Return room where user is"""
         profile = self.host.memory.getProfileName(profile_key)
         result = []
@@ -126,7 +127,7 @@
             result.append((room.roomJID.userhost(), [user.nick for user in room.roster.values()], room.nick))
         return result
 
-    def getRoomNick(self, room_jid_s, profile_key='@DEFAULT@'):
+    def getRoomNick(self, room_jid_s, profile_key=C.PROF_KEY_NONE):
         """return nick used in room by user
         @param room_jid_s: unicode room id
         @profile_key: profile
@@ -174,12 +175,12 @@
                 nicks.append(nick)
         return nicks, missing
 
-    def _configureRoom(self, room_jid_s, profile_key='@NONE@'):
+    def _configureRoom(self, room_jid_s, profile_key=C.PROF_KEY_NONE):
         d = self.configureRoom(jid.JID(room_jid_s), profile_key)
         d.addCallback(lambda xmlui: xmlui.toXml())
         return d
 
-    def configureRoom(self, room_jid, profile_key='@NONE@'):
+    def configureRoom(self, room_jid, profile_key=C.PROF_KEY_NONE):
         """ return the room configuration form
         @param room: jid of the room to configure
         @param profile_key: %(doc_profile_key)s
@@ -228,7 +229,7 @@
             raise UnknownRoom("This room has not been joined")
         return self.clients[profile].joined_rooms[room_jid.userhost()].inRoster(muc.User(nick))
 
-    def getRoomsSubjects(self, profile_key='@DEFAULT@'):
+    def getRoomsSubjects(self, profile_key=C.PROF_KEY_NONE):
         """Return received subjects of rooms"""
         profile = self.host.memory.getProfileName(profile_key)
         if not self.__check_profile(profile):
@@ -248,7 +249,7 @@
                 break
         return muc_service
 
-    def getUniqueName(self, muc_service="", profile_key='@DEFAULT@'):
+    def getUniqueName(self, muc_service="", profile_key=C.PROF_KEY_NONE):
         """Return unique name for room, avoiding collision
         @param muc_service: leave empty string to use the default service
         @return: unique room userhost, or '' if an error occured.
@@ -268,7 +269,7 @@
             muc_service = muc_service.userhost()
         return "%s@%s" % (room_name, muc_service)
 
-    def join(self, room_jid, nick, options, profile_key='@DEFAULT@'):
+    def join(self, room_jid, nick, options, profile_key=C.PROF_KEY_NONE):
         def _errDeferred(exc_obj=Exception, txt='Error while joining room'):
             d = defer.Deferred()
             d.errback(exc_obj(txt))
@@ -291,7 +292,7 @@
         # > /usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py(480)_startRunCallbacks()
         # -> raise AlreadyCalledError(extra)
 
-    def _join(self, room_jid_s, nick, options={}, profile_key='@DEFAULT@'):
+    def _join(self, room_jid_s, nick, options={}, profile_key=C.PROF_KEY_NONE):
         """join method used by bridge: use the join method, but doesn't return any deferred
         @return the room userhost (given value or unique generated name)
         """
@@ -335,11 +336,11 @@
             raise UnknownRoom("This room has not been joined")
         return self.clients[profile].subject(room_jid, subject)
 
-    def mucNick(self, room_jid_s, nick, profile_key='@DEFAULT@'):
+    def mucNick(self, room_jid_s, nick, profile_key=C.PROF_KEY_NONE):
         """Change nickname in a room"""
         return self.nick(jid.JID(room_jid_s), nick, profile_key)
 
-    def mucLeave(self, room_jid_s, profile_key='@DEFAULT@'):
+    def mucLeave(self, room_jid_s, profile_key=C.PROF_KEY_NONE):
         """Leave a room"""
         return self.leave(jid.JID(room_jid_s), profile_key)
 
--- a/src/plugins/plugin_xep_0050.py	Fri Mar 21 16:19:46 2014 +0100
+++ b/src/plugins/plugin_xep_0050.py	Fri Mar 21 16:27:09 2014 +0100
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from sat.core.i18n import _, D_
+from sat.core.constants import Const as C
 from logging import debug, info, warning, error
 from twisted.words.protocols.jabber import jid
 from twisted.words.protocols.jabber import error as xmpp_error
@@ -396,7 +397,7 @@
         return d
 
     def addAdHocCommand(self, callback, label, node="", features = None, timeout = 600, allowed_jids = None, allowed_groups = None,
-                        allowed_magics = None, forbidden_jids = None, forbidden_groups = None, profile_key="@NONE@"):
+                        allowed_magics = None, forbidden_jids = None, forbidden_groups = None, profile_key=C.PROF_KEY_NONE):
         """
 
         Add an ad-hoc command for the current profile
--- a/src/plugins/plugin_xep_0054.py	Fri Mar 21 16:19:46 2014 +0100
+++ b/src/plugins/plugin_xep_0054.py	Fri Mar 21 16:27:09 2014 +0100
@@ -19,6 +19,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from sat.core.i18n import _
+from sat.core.constants import Const as C
 from logging import debug, info, error
 from twisted.internet import threads
 from twisted.internet.defer import inlineCallbacks, returnValue
@@ -206,7 +207,7 @@
             error(_("Can't find VCard of %s") % failure.value.stanza['from'])
         self.host.bridge.actionResult("SUPPRESS", failure.value.stanza['id'], {}, profile)  # FIXME: maybe an error message would be better
 
-    def getCard(self, target_s, profile_key='@DEFAULT@'):
+    def getCard(self, target_s, profile_key=C.PROF_KEY_NONE):
         """Ask server for VCard
         @param target_s: jid from which we want the VCard
         @result: id to retrieve the profile"""
@@ -253,7 +254,7 @@
         img_hash = sha1(img_buf.getvalue()).hexdigest()
         return (vcard_set, img_hash)
 
-    def setAvatar(self, filepath, profile_key='@DEFAULT@'):
+    def setAvatar(self, filepath, profile_key=C.PROF_KEY_NONE):
         """Set avatar of the profile
         @param filepath: path of the image of the avatar"""
         #TODO: This is a temporary way of setting avatar, as other VCard informations are not managed.
--- a/src/plugins/plugin_xep_0060.py	Fri Mar 21 16:19:46 2014 +0100
+++ b/src/plugins/plugin_xep_0060.py	Fri Mar 21 16:27:09 2014 +0100
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from sat.core.i18n import _
+from sat.core.constants import Const as C
 from logging import debug, info, error
 from wokkel.pubsub import PubSubRequest
 from wokkel import disco, pubsub
@@ -95,35 +96,35 @@
             raise Exception(err_mess)
         return profile, client
 
-    def publish(self, service, nodeIdentifier, items=None, profile_key='@DEFAULT@'):
+    def publish(self, service, nodeIdentifier, items=None, profile_key=C.PROF_KEY_NONE):
         profile, client = self.__getClientNProfile(profile_key, 'publish item')
         return client.publish(service, nodeIdentifier, items, client.parent.jid)
 
-    def getItems(self, service, node, max_items=None, item_ids=None, sub_id=None, profile_key='@DEFAULT@'):
+    def getItems(self, service, node, max_items=None, item_ids=None, sub_id=None, profile_key=C.PROF_KEY_NONE):
         profile, client = self.__getClientNProfile(profile_key, 'get items')
         return client.items(service, node, max_items, item_ids, sub_id, client.parent.jid)
 
-    def getOptions(self, service, nodeIdentifier, subscriber, subscriptionIdentifier=None, profile_key='@DEFAULT@'):
+    def getOptions(self, service, nodeIdentifier, subscriber, subscriptionIdentifier=None, profile_key=C.PROF_KEY_NONE):
         profile, client = self.__getClientNProfile(profile_key, 'get options')
         return client.getOptions(service, nodeIdentifier, subscriber, subscriptionIdentifier)
 
-    def setOptions(self, service, nodeIdentifier, subscriber, options, subscriptionIdentifier=None, profile_key='@DEFAULT@'):
+    def setOptions(self, service, nodeIdentifier, subscriber, options, subscriptionIdentifier=None, profile_key=C.PROF_KEY_NONE):
         profile, client = self.__getClientNProfile(profile_key, 'set options')
         return client.setOptions(service, nodeIdentifier, subscriber, options, subscriptionIdentifier)
 
-    def createNode(self, service, nodeIdentifier, options, profile_key='@DEFAULT@'):
+    def createNode(self, service, nodeIdentifier, options, profile_key=C.PROF_KEY_NONE):
         profile, client = self.__getClientNProfile(profile_key, 'create node')
         return client.createNode(service, nodeIdentifier, options)
 
-    def deleteNode(self, service, nodeIdentifier, profile_key='@DEFAULT@'):
+    def deleteNode(self, service, nodeIdentifier, profile_key=C.PROF_KEY_NONE):
         profile, client = self.__getClientNProfile(profile_key, 'delete node')
         return client.deleteNode(service, nodeIdentifier)
 
-    def retractItems(self, service, nodeIdentifier, itemIdentifiers, profile_key='@DEFAULT@'):
+    def retractItems(self, service, nodeIdentifier, itemIdentifiers, profile_key=C.PROF_KEY_NONE):
         profile, client = self.__getClientNProfile(profile_key, 'retract items')
         return client.retractItems(service, nodeIdentifier, itemIdentifiers)
 
-    def subscribe(self, service, nodeIdentifier, sub_jid=None, options=None, profile_key='@DEFAULT@'):
+    def subscribe(self, service, nodeIdentifier, sub_jid=None, options=None, profile_key=C.PROF_KEY_NONE):
         profile, client = self.__getClientNProfile(profile_key, 'subscribe node')
         return client.subscribe(service, nodeIdentifier, sub_jid or client.parent.jid.userhostJID(), options=options)
 
--- a/src/plugins/plugin_xep_0077.py	Fri Mar 21 16:19:46 2014 +0100
+++ b/src/plugins/plugin_xep_0077.py	Fri Mar 21 16:27:09 2014 +0100
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from sat.core.i18n import _
+from sat.core.constants import Const as C
 from sat.core import exceptions
 from logging import debug, info, warning, error
 from twisted.words.protocols.jabber import jid
@@ -98,10 +99,10 @@
             raise exceptions.ConflictError( _("Username already exists, please choose an other one"))
         raise failure
 
-    def _inBandRegister(self, to_jid_s, profile_key='@NONE@'):
+    def _inBandRegister(self, to_jid_s, profile_key=C.PROF_KEY_NONE):
         return self.inBandRegister, jid.JID(to_jid_s, profile_key)
 
-    def inBandRegister(self, to_jid, post_treat_cb=None, profile_key='@NONE@'):
+    def inBandRegister(self, to_jid, post_treat_cb=None, profile_key=C.PROF_KEY_NONE):
         """register to a target JID"""
         client = self.host.getClient(profile_key)
         if not client:
--- a/src/plugins/plugin_xep_0085.py	Fri Mar 21 16:19:46 2014 +0100
+++ b/src/plugins/plugin_xep_0085.py	Fri Mar 21 16:27:09 2014 +0100
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from sat.core.i18n import _
+from sat.core.constants import Const as C
 from sat.core import exceptions
 from logging import info
 from wokkel import disco, iwokkel
@@ -117,11 +118,11 @@
         Update the entity data of the given profile for one or all contacts.
         Reset the chat state(s) display if the notification has been disabled.
         @param entity_jid: contact's JID, or '@ALL@' to update all contacts.
-        @param value: True, False or '@NONE@' to delete the entity data
+        @param value: True, False or C.PROF_KEY_NONE to delete the entity data
         @param profile: current profile
         """
         self.host.memory.updateEntityData(entity_jid, ENTITY_KEY, value, profile)
-        if not value or value == "@NONE@":
+        if not value or value == C.PROF_KEY_NONE:
             # disable chat state for this or these contact(s)
             self.host.bridge.chatStateReceived(unicode(entity_jid), "", profile)
 
@@ -133,7 +134,7 @@
         @param category: parameter category
         """
         if (category, name) == (PARAM_KEY, PARAM_NAME):
-            self.updateEntityData("@ALL@", True if value == "true" else "@NONE@", profile)
+            self.updateEntityData("@ALL@", True if value == "true" else C.PROF_KEY_NONE, profile)
             return False
         return True
 
--- a/src/plugins/plugin_xep_0095.py	Fri Mar 21 16:19:46 2014 +0100
+++ b/src/plugins/plugin_xep_0095.py	Fri Mar 21 16:27:09 2014 +0100
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from sat.core.i18n import _
+from sat.core.constants import Const as C
 from logging import debug, info, error
 from twisted.words.xish import domish
 from twisted.internet import protocol
@@ -86,7 +87,7 @@
             #We don't know this profile, we send an error
             self.sendBadProfileError(iq_el['id'], iq_el['from'], profile)
 
-    def sendRejectedError(self, iq_id, to_jid, reason='Offer Declined', profile='@NONE@'):
+    def sendRejectedError(self, iq_id, to_jid, reason='Offer Declined', profile=C.PROF_KEY_NONE):
         """Helper method to send when the stream is rejected
         @param iq_id: IQ id
         @param to_jid: recipient
@@ -115,7 +116,7 @@
         @param profile: %(doc_profile)s"""
         self.sendError(iq_id, to_jid, 500, 'cancel', {'custom': 'failed'}, profile=profile)  # as there is no error code for failed transfer, we use 500 (undefined-condition)
 
-    def sendError(self, iq_id, to_jid, err_code, err_type='cancel', data={}, profile='@NONE@'):
+    def sendError(self, iq_id, to_jid, err_code, err_type='cancel', data={}, profile=C.PROF_KEY_NONE):
         """Send IQ error as a result
         @param iq_id: IQ id
         @param to_jid: recipient
@@ -150,7 +151,7 @@
 
         _client.xmlstream.send(result)
 
-    def acceptStream(self, iq_id, to_jid, feature_elt, misc_elts=[], profile='@NONE@'):
+    def acceptStream(self, iq_id, to_jid, feature_elt, misc_elts=[], profile=C.PROF_KEY_NONE):
         """Send the accept stream initiation answer
         @param iq_id: IQ id
         @param feature_elt: domish element 'feature' containing stream method to use
@@ -169,7 +170,7 @@
             si.addChild(elt)
         _client.xmlstream.send(result)
 
-    def proposeStream(self, to_jid, si_profile, feature_elt, misc_elts, mime_type='application/octet-stream', profile_key='@NONE@'):
+    def proposeStream(self, to_jid, si_profile, feature_elt, misc_elts, mime_type='application/octet-stream', profile_key=C.PROF_KEY_NONE):
         """Propose a stream initiation
         @param to_jid: recipient (JID)
         @param si_profile: Stream initiation profile (XEP-0095)
--- a/src/plugins/plugin_xep_0096.py	Fri Mar 21 16:19:46 2014 +0100
+++ b/src/plugins/plugin_xep_0096.py	Fri Mar 21 16:27:09 2014 +0100
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from sat.core.i18n import _
+from sat.core.constants import Const as C
 from logging import debug, info, warning, error
 from twisted.words.xish import domish
 from twisted.words.protocols.jabber import jid
@@ -266,7 +267,7 @@
         else:
             warning(_("Invalid stream method received"))
 
-    def sendFile(self, to_jid, filepath, data={}, profile_key='@NONE@'):
+    def sendFile(self, to_jid, filepath, data={}, profile_key=C.PROF_KEY_NONE):
         """send a file using XEP-0096
         @to_jid: recipient
         @filepath: absolute path to the file to send
--- a/src/plugins/plugin_xep_0100.py	Fri Mar 21 16:19:46 2014 +0100
+++ b/src/plugins/plugin_xep_0100.py	Fri Mar 21 16:27:09 2014 +0100
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from sat.core.i18n import _, D_
+from sat.core.constants import Const as C
 from sat.core import exceptions
 from sat.tools import xml_tools
 from logging import debug, info, warning, error
@@ -137,12 +138,12 @@
         self.host.addContact(jid_, profile_key=profile)
         self.host.setPresence(jid_, profile_key=profile)
 
-    def _gatewayRegister(self, target_jid_s, profile_key='@NONE@'):
+    def _gatewayRegister(self, target_jid_s, profile_key=C.PROF_KEY_NONE):
         d = self.gatewayRegister(jid.JID(target_jid_s), profile_key)
         d.addCallback(lambda xmlui: xmlui.toXml())
         return d
 
-    def gatewayRegister(self, target_jid, profile_key='@NONE@'):
+    def gatewayRegister(self, target_jid, profile_key=C.PROF_KEY_NONE):
         """Register gateway using in-band registration, then log-in to gateway"""
         profile = self.host.memory.getProfileName(profile_key)
         assert(profile)
--- a/src/plugins/plugin_xep_0115.py	Fri Mar 21 16:19:46 2014 +0100
+++ b/src/plugins/plugin_xep_0115.py	Fri Mar 21 16:27:09 2014 +0100
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from sat.core.i18n import _
+from sat.core.constants import Const as C
 from logging import debug, info, error, warning
 from twisted.words.xish import domish
 from twisted.words.protocols.jabber import client, jid, xmlstream
@@ -116,7 +117,7 @@
         presenceInst._legacy_send = presenceInst.send
         presenceInst.send = new_send
 
-    def generateHash(self, profile_key="@DEFAULT@"):
+    def generateHash(self, profile_key=C.PROF_KEY_NONE):
         """This method generate a sha1 hash as explained in xep-0115 #5.1
         it then store it in XEP_0115.cap_hash"""
         profile = self.host.memory.getProfileName(profile_key)
--- a/src/plugins/plugin_xep_0163.py	Fri Mar 21 16:19:46 2014 +0100
+++ b/src/plugins/plugin_xep_0163.py	Fri Mar 21 16:27:09 2014 +0100
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from sat.core.i18n import _
+from sat.core.constants import Const as C
 from logging import debug, info, error
 from twisted.internet import protocol
 from twisted.words.protocols.jabber import client, jid
@@ -86,7 +87,7 @@
         item = pubsub.Item(payload=data)
         return self.host.plugins["XEP-0060"].publish(None, namespace, [item], profile_key=profile)
 
-    def sendPersonalEvent(self, event_type, data, profile_key='@DEFAULT@'):
+    def sendPersonalEvent(self, event_type, data, profile_key=C.PROF_KEY_NONE):
         """Send personal event after checking the data is alright
         @param event_type: type of event (eg: MOOD, TUNE), must be in self.pep_out_cb.keys()
         @param data: dict of {string:string} of event_type dependant data
--- a/src/plugins/plugin_xep_0249.py	Fri Mar 21 16:19:46 2014 +0100
+++ b/src/plugins/plugin_xep_0249.py	Fri Mar 21 16:27:09 2014 +0100
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from sat.core.i18n import _
+from sat.core.constants import Const as C
 from logging import debug, info, warning, error
 from twisted.words.xish import domish
 from twisted.internet import protocol, defer
@@ -82,7 +83,7 @@
     def getHandler(self, profile):
         return XEP_0249_handler(self)
 
-    def invite(self, target, room, options={}, profile_key='@DEFAULT@'):
+    def invite(self, target, room, options={}, profile_key=C.PROF_KEY_NONE):
         """
         Invite a user to a room
         @param target: jid of the user to invite
@@ -102,7 +103,7 @@
             x_elt[opt] = options[opt]
         self.host.profiles[profile].xmlstream.send(message)
 
-    def _invite(self, target, service, roomId, options={}, profile_key='@DEFAULT@'):
+    def _invite(self, target, service, roomId, options={}, profile_key=C.PROF_KEY_NONE):
         """
         Invite an user to a room
         @param target: jid of the user to invite
@@ -113,7 +114,7 @@
         #TODO: check parameters validity
         self.invite(jid.JID(target), jid.JID("%s@%s" % (roomId, service)), options, profile_key)
 
-    def _accept(self, room, profile_key='@DEFAULT@'):
+    def _accept(self, room, profile_key=C.PROF_KEY_NONE):
         """
         Accept the invitation to join a MUC
         @param room: room jid as string
--- a/src/plugins/plugin_xep_0277.py	Fri Mar 21 16:19:46 2014 +0100
+++ b/src/plugins/plugin_xep_0277.py	Fri Mar 21 16:27:09 2014 +0100
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from sat.core.i18n import _
+from sat.core.constants import Const as C
 from logging import debug, info, warning, error
 from twisted.words.protocols.jabber import jid
 from twisted.internet import defer
@@ -309,7 +310,7 @@
         ret = yield self.host.plugins["XEP-0060"].publish(None, NS_MICROBLOG, [item], profile_key=profile)
         defer.returnValue(ret)
 
-    def getLastMicroblogs(self, pub_jid, max_items=10, profile_key='@DEFAULT@'):
+    def getLastMicroblogs(self, pub_jid, max_items=10, profile_key=C.PROF_KEY_NONE):
         """Get the last published microblogs
         @param pub_jid: jid of the publisher
         @param max_items: how many microblogs we want to get
@@ -329,7 +330,7 @@
         d.addCallback(resultToArray)
         return d
 
-    def setMicroblogAccess(self, access="presence", profile_key='@DEFAULT@'):
+    def setMicroblogAccess(self, access="presence", profile_key=C.PROF_KEY_NONE):
         """Create a microblog node on PEP with given access
         If the node already exists, it change options
         @param access: Node access model, according to xep-0060 #4.5
--- a/src/tools/utils.py	Fri Mar 21 16:19:46 2014 +0100
+++ b/src/tools/utils.py	Fri Mar 21 16:27:09 2014 +0100
@@ -20,8 +20,8 @@
 """ various useful methods """
 
 import unicodedata
-    
-    
+
+
 def clean_ustr(ustr):
     """Clean unicode string
     remove special characters from unicode string"""