Mercurial > libervia-backend
diff sat_bridge/DBus.py @ 65:d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
/!\ profiles not managed yet for dbus signals
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 31 Jan 2010 15:57:03 +1100 |
parents | 58d49fc19639 |
children | 8147b4f40809 |
line wrap: on
line diff
--- a/sat_bridge/DBus.py Sat Jan 30 16:17:33 2010 +1100 +++ b/sat_bridge/DBus.py Sun Jan 31 15:57:03 2010 +1100 @@ -124,76 +124,76 @@ return self.cb["registerNewAccount"](login, password, host, port) @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, - in_signature='', out_signature='') - def connect(self): + in_signature='s', out_signature='') + def connect(self, profile_key='@DEFAULT@'): info ("Connection asked") return self.cb["connect"]() @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, - in_signature='', out_signature='') - def disconnect(self): + in_signature='s', out_signature='') + def disconnect(self, profile_key='@DEFAULT@'): info ("Disconnection asked") - return self.cb["disconnect"]() + return self.cb["disconnect"](profile_key) @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, in_signature='', out_signature='b') - def isConnected(self): + def isConnected(self, profile_key='@DEFAULT@'): info ("Connection status asked") - return self.cb["isConnected"]() + return self.cb["isConnected"](profile_key) @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, - in_signature='', out_signature='a(sa{ss}as)') - def getContacts(self): + in_signature='s', out_signature='a(sa{ss}as)') + def getContacts(self, profile_key='@DEFAULT@'): debug("getContacts...") - return self.cb["getContacts"]() - - @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, - in_signature='', out_signature='a{sa{s(sia{ss})}}') - def getPresenceStatus(self): - debug("getPresenceStatus...") - return self.cb["getPresenceStatus"]() + return self.cb["getContacts"](profile_key) @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, - in_signature='', out_signature='a{ss}') - def getWaitingSub(self): - debug("getWaitingSub...") - return self.cb["getWaitingSub"]() + in_signature='s', out_signature='a{sa{s(sia{ss})}}') + def getPresenceStatus(self, profile_key='@DEFAULT@'): + debug("getPresenceStatus...") + return self.cb["getPresenceStatus"](profile_key) @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, - in_signature='ss', out_signature='') - def sendMessage(self, to, message): - debug("sendMessage...") - self.cb["sendMessage"](to, message) - - @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, - in_signature='ssia{ss}', out_signature='') - def setPresence(self, to="", show="", priority=0, statuses={}): - self.cb["setPresence"](to, show, priority, statuses) - - @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, - in_signature='ss', out_signature='') - def subscription(self, type, entity): - self.cb["subscription"](type, entity) + in_signature='s', out_signature='a{ss}') + def getWaitingSub(self, profile_key='@DEFAULT@'): + debug("getWaitingSub...") + return self.cb["getWaitingSub"](profile_key) @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, in_signature='sss', out_signature='') - def setParam(self, name, value, category): - self.cb["setParam"](str(name), str(value), str(category)) + def sendMessage(self, to, message, profile_key='@DEFAULT@'): + debug("sendMessage...") + self.cb["sendMessage"](to, message, profile_key) + + @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, + in_signature='ssia{ss}s', out_signature='') + def setPresence(self, to="", show="", priority=0, statuses={}, profile_key='@DEFAULT@'): + self.cb["setPresence"](to, show, priority, statuses, profile_key) + + @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, + in_signature='sss', out_signature='') + def subscription(self, type, entity, profile_key='@DEFAULT@'): + self.cb["subscription"](type, entity, profile_key) + + @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, + in_signature='ssss', out_signature='') + def setParam(self, name, value, category, profile_key='@DEFAULT@'): + self.cb["setParam"](str(name), str(value), str(category), profile_key) @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, - in_signature='ss', out_signature='s') - def getParamA(self, name, category="default"): - return self.cb["getParamA"](name, category) - - @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, - in_signature='', out_signature='s') - def getParams(self): - return self.cb["getParams"]() + in_signature='sss', out_signature='s') + def getParamA(self, name, category="default", profile_key='@DEFAULT@'): + return self.cb["getParamA"](name, category, profile_key = profile_key) @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, in_signature='s', out_signature='s') - def getParamsForCategory(self, category): - return self.cb["getParamsForCategory"](category) + def getParams(self, profile_key='@DEFAULT@'): + return self.cb["getParams"](profile_key) + + @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, + in_signature='ss', out_signature='s') + def getParamsForCategory(self, category, profile_key='@DEFAULT@'): + return self.cb["getParamsForCategory"](category, profile_key) @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, in_signature='', out_signature='as') @@ -207,16 +207,16 @@ return self.cb["getHistory"](from_jid, to_jid, size) @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, - in_signature='s', out_signature='') - def addContact(self, entity): - debug("Subscription asked for %s", entity) - return self.cb["addContact"](entity) + in_signature='ss', out_signature='') + def addContact(self, entity, profile_key='@DEFAULT@'): + debug("Subscription asked for %s (profile %s)", entity, profile_key) + return self.cb["addContact"](entity, profile_key) @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, - in_signature='s', out_signature='') - def delContact(self, entity): - debug("Unsubscription asked for %s", entity) - return self.cb["delContact"](entity) + in_signature='ss', out_signature='') + def delContact(self, entity, profile_key='@DEFAULT@'): + debug("Unsubscription asked for %s (profile %s)", entity, profile_key) + return self.cb["delContact"](entity, profile_key) @dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX, in_signature='sa{ss}', out_signature='s')