From e7d83b8d275de92bd08a5cf57fcd5a75f70d6e5e Mon Sep 17 00:00:00 2001 From: Goffi Date: Sun, 10 Mar 2013 20:55:29 +0100 Subject: [PATCH] core: added Priority management --- src/core/xmpp.py | 8 +++++++- src/memory/memory.py | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/core/xmpp.py b/src/core/xmpp.py index 12420141..000c8e1c 100644 --- a/src/core/xmpp.py +++ b/src/core/xmpp.py @@ -295,7 +295,13 @@ class SatPresenceProtocol(xmppim.PresenceClientProtocol): # now it's time to notify frontends self.host.bridge.presenceUpdate(entity.full(), "unavailable", 0, statuses, self.parent.profile) - def available(self, entity=None, show=None, statuses=None, priority=0): + def available(self, entity=None, show=None, statuses=None, priority=None): + if priority is None: + try: + priority = int(self.host.memory.getParamA("Priority", "Connection", profile_key=self.parent.profile)) + except ValueError: + priority = 0 + if not statuses: statuses = {} # default for us is None for wokkel diff --git a/src/memory/memory.py b/src/memory/memory.py index 1f24fbdf..7603dd3c 100644 --- a/src/memory/memory.py +++ b/src/memory/memory.py @@ -40,6 +40,8 @@ class Params(object): ### TODO: add desciption in params #TODO: move Watched in a plugin + #TODO: when priority is changed, a new presence stanza must be emitted + #TODO: int type (Priority should be int instead of string) default_xml = u""" @@ -48,6 +50,7 @@ class Params(object): +