DBus bridge improvment:
- new method to notice clients of updated values - presence update refactored - subscriptions management are now separated from presence
This commit is contained in:
parent
952b684a46
commit
c5295f4c98
1 changed files with 49 additions and 21 deletions
|
|
@ -54,10 +54,15 @@ class DbusObject(dbus.service.Object):
|
|||
debug("new message signal (from:%s msg:%s type:%s to:%s) sended", from_jid, msg, type, to)
|
||||
|
||||
@dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
signature='ssssi')
|
||||
def presenceUpdate(self, jid, type, show, status, priority):
|
||||
debug("presence update signal (from:%s type: %s show:%s status:\"%s\" priority:%d) sended" , jid, type, show, status, priority)
|
||||
signature='ssia{ss}')
|
||||
def presenceUpdate(self, entity, show, priority, statuses):
|
||||
debug("presence update signal (from:%s show:%s priority:%d statuses:%s) sended" , entity, show, priority, statuses)
|
||||
|
||||
@dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
signature='ss')
|
||||
def subscribe(self, type, entity):
|
||||
debug("subscribe (type: [%s] from:[%s])" , type, entity)
|
||||
|
||||
@dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
signature='sss')
|
||||
def paramUpdate(self, name, value, category):
|
||||
|
|
@ -65,8 +70,8 @@ class DbusObject(dbus.service.Object):
|
|||
|
||||
@dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
signature='s')
|
||||
def contactDeleted(self, jid):
|
||||
debug("contact deleted signal: %s", jid)
|
||||
def contactDeleted(self, entity):
|
||||
debug("contact deleted signal: %s", entity)
|
||||
|
||||
@dbus.service.signal(const_INT_PREFIX+const_REQ_SUFFIX,
|
||||
signature='ssa{ss}')
|
||||
|
|
@ -83,6 +88,11 @@ class DbusObject(dbus.service.Object):
|
|||
def actionResultExt(self, type, id, data):
|
||||
debug("extended result of action: id = [%s] type = %s data = %s", id, type, data)
|
||||
|
||||
@dbus.service.signal(const_INT_PREFIX+const_REQ_SUFFIX,
|
||||
signature='sa{ss}')
|
||||
def updatedValue(self, name, value):
|
||||
debug("updated value: %s = %s", name, value)
|
||||
|
||||
### methods ###
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
|
|
@ -110,11 +120,17 @@ class DbusObject(dbus.service.Object):
|
|||
return self.cb["getContacts"]()
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
in_signature='', out_signature='a(ssssi)')
|
||||
in_signature='', out_signature='a{sa{s(sia{ss})}}')
|
||||
def getPresenceStatus(self):
|
||||
debug("getPresenceStatus...")
|
||||
return self.cb["getPresenceStatus"]()
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
in_signature='', out_signature='a{ss}')
|
||||
def getWaitingSub(self):
|
||||
debug("getWaitingSub...")
|
||||
return self.cb["getWaitingSub"]()
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
in_signature='ss', out_signature='')
|
||||
def sendMessage(self, to, message):
|
||||
|
|
@ -122,9 +138,14 @@ class DbusObject(dbus.service.Object):
|
|||
self.cb["sendMessage"](to, message)
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
in_signature='ssssi', out_signature='')
|
||||
def setPresence(self, to="", type="", show="", status="", priority=0):
|
||||
self.cb["setPresence"](to, type, show, status, priority)
|
||||
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)
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
in_signature='sss', out_signature='')
|
||||
|
|
@ -159,15 +180,15 @@ class DbusObject(dbus.service.Object):
|
|||
|
||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
in_signature='s', out_signature='')
|
||||
def addContact(self, jid):
|
||||
debug("Subscription asked for %s", jid)
|
||||
return self.cb["addContact"](jid)
|
||||
def addContact(self, entity):
|
||||
debug("Subscription asked for %s", entity)
|
||||
return self.cb["addContact"](entity)
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
in_signature='s', out_signature='')
|
||||
def delContact(self, jid):
|
||||
debug("Unsubscription asked for %s", jid)
|
||||
return self.cb["delContact"](jid)
|
||||
def delContact(self, entity):
|
||||
debug("Unsubscription asked for %s", entity)
|
||||
return self.cb["delContact"](entity)
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
in_signature='', out_signature='b')
|
||||
|
|
@ -243,17 +264,21 @@ class DBusBridge(Bridge):
|
|||
debug("sending message...")
|
||||
self.dbus_bridge.newMessage(from_jid, msg, type, to)
|
||||
|
||||
def presenceUpdate(self, jid, type, show, status, priority):
|
||||
debug("updating presence for %s",jid)
|
||||
self.dbus_bridge.presenceUpdate(jid, type, show, status, priority)
|
||||
def presenceUpdate(self, entity, show, priority, statuses):
|
||||
debug("updating presence for %s",entity)
|
||||
self.dbus_bridge.presenceUpdate(entity, show, priority, statuses)
|
||||
|
||||
def subscribe(self, type, entity):
|
||||
debug("subscribe request for %s",entity)
|
||||
self.dbus_bridge.subscribe(type, entity)
|
||||
|
||||
def paramUpdate(self, name, value, category):
|
||||
debug("updating param [%s] %s ", category, name)
|
||||
self.dbus_bridge.paramUpdate(name, value, category)
|
||||
|
||||
def contactDeleted(self, jid):
|
||||
debug("sending contact deleted signal %s ", jid)
|
||||
self.dbus_bridge.contactDeleted(jid)
|
||||
def contactDeleted(self, entity):
|
||||
debug("sending contact deleted signal %s ", entity)
|
||||
self.dbus_bridge.contactDeleted(entity)
|
||||
|
||||
def askConfirmation(self, type, id, data):
|
||||
self.dbus_bridge.askConfirmation(type, id, data)
|
||||
|
|
@ -264,6 +289,9 @@ class DBusBridge(Bridge):
|
|||
def actionResultExt(self, type, id, data):
|
||||
self.dbus_bridge.actionResultExt(type, id, data)
|
||||
|
||||
def updatedValue(self, name, value):
|
||||
self.dbus_bridge.updatedValue(name, value)
|
||||
|
||||
def register(self, name, callback):
|
||||
debug("registering DBus bridge method [%s]",name)
|
||||
self.dbus_bridge.register(name, callback)
|
||||
|
|
|
|||
Loading…
Reference in a new issue