core: added Priority management

This commit is contained in:
Goffi 2013-03-10 20:55:29 +01:00
commit e7d83b8d27
2 changed files with 10 additions and 1 deletions

View file

@ -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

View file

@ -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"""
<params>
<general>
@ -48,6 +50,7 @@ class Params(object):
<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"/>