core: use of Const for profile_key + replaced '@DEFAULT@' default profile_key by '@NONE@'

This commit is contained in:
Goffi 2014-03-21 16:27:09 +01:00
commit 005ec59a8a

View file

@ -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 @@ class XEP_0085(object):
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 @@ class XEP_0085(object):
@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