Mercurial > libervia-backend
changeset 611:d722778b152c
core: added Priority management
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 10 Mar 2013 20:55:29 +0100 |
parents | c8c07c920e30 |
children | dfb9b01b09db |
files | src/core/xmpp.py src/memory/memory.py |
diffstat | 2 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/core/xmpp.py Sun Mar 10 20:54:45 2013 +0100 +++ b/src/core/xmpp.py Sun Mar 10 20:55:29 2013 +0100 @@ -295,7 +295,13 @@ # 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
--- a/src/memory/memory.py Sun Mar 10 20:54:45 2013 +0100 +++ b/src/memory/memory.py Sun Mar 10 20:55:29 2013 +0100 @@ -40,6 +40,8 @@ ### 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""" <params> <general> @@ -48,6 +50,7 @@ <category name="Connection" label="%(category_connection)s"> <param name="JabberID" value="name@example.org/SàT" type="string" /> <param name="Password" value="" type="password" /> + <param name="Priority" value="50" type="string" /> <param name="Server" value="example.org" type="string" /> <param name="Port" value="5222" type="string" /> <param name="NewAccount" value="%(label_NewAccount)s" type="button" callback_id="registerNewAccount"/>