bridge refactoring: categories are now core and plugin instead of communication and request
This commit is contained in:
parent
ee98769ddf
commit
b3322dabae
5 changed files with 161 additions and 142 deletions
|
|
@ -28,8 +28,8 @@ from logging import debug, info
|
|||
|
||||
const_INT_PREFIX = "org.goffi.SAT" #Interface prefix
|
||||
const_OBJ_PATH = '/org/goffi/SAT/bridge'
|
||||
const_COMM_SUFFIX = ".communication"
|
||||
const_REQ_SUFFIX = ".request"
|
||||
const_CORE_SUFFIX = ".core"
|
||||
const_PLUGIN_SUFFIX = ".plugin"
|
||||
|
||||
class DbusObject(dbus.service.Object):
|
||||
|
||||
|
|
@ -43,272 +43,280 @@ class DbusObject(dbus.service.Object):
|
|||
|
||||
### signals ###
|
||||
|
||||
@dbus.service.signal(const_INT_PREFIX+const_REQ_SUFFIX,
|
||||
@dbus.service.signal(const_INT_PREFIX+const_PLUGIN_SUFFIX,
|
||||
signature='')
|
||||
def dummySignal(self):
|
||||
#FIXME: workaround for addSignal (doesn't work if one method doensn't
|
||||
# already exist for plugins), probably missing some initialisation, need
|
||||
# further investigations
|
||||
pass
|
||||
|
||||
@dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
signature='ssa{ss}')
|
||||
def actionResult(self, answer_type, id, data):
|
||||
pass
|
||||
|
||||
@dbus.service.signal(const_INT_PREFIX+const_REQ_SUFFIX,
|
||||
@dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
signature='ssa{sa{ss}}')
|
||||
def actionResultExt(self, answer_type, id, data):
|
||||
pass
|
||||
|
||||
@dbus.service.signal(const_INT_PREFIX+const_REQ_SUFFIX,
|
||||
@dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
signature='ssa{ss}')
|
||||
def askConfirmation(self, conf_type, id, data):
|
||||
pass
|
||||
|
||||
@dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
@dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
signature='s')
|
||||
def connected(self, profile):
|
||||
pass
|
||||
|
||||
@dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
@dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
signature='ss')
|
||||
def connectionError(self, error_type, profile):
|
||||
pass
|
||||
|
||||
@dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
@dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
signature='ss')
|
||||
def contactDeleted(self, entity, profile):
|
||||
pass
|
||||
|
||||
@dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
@dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
signature='s')
|
||||
def disconnected(self, profile):
|
||||
pass
|
||||
|
||||
@dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
@dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
signature='ssss')
|
||||
def newAlert(self, message, title, alert_type, profile):
|
||||
pass
|
||||
|
||||
@dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
@dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
signature='sa{ss}ass')
|
||||
def newContact(self, contact, attributes, groups, profile):
|
||||
pass
|
||||
|
||||
@dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
@dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
signature='sssss')
|
||||
def newMessage(self, from_jid, message, mess_type, to_jid, profile):
|
||||
pass
|
||||
|
||||
@dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
@dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
signature='ssss')
|
||||
def paramUpdate(self, name, value, category, profile):
|
||||
pass
|
||||
|
||||
@dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
@dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
signature='ssia{ss}s')
|
||||
def presenceUpdate(self, entity, show, priority, statuses, profile):
|
||||
pass
|
||||
|
||||
@dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
@dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
signature='sss')
|
||||
def subscribe(self, sub_type, entity, profile):
|
||||
pass
|
||||
|
||||
@dbus.service.signal(const_INT_PREFIX+const_REQ_SUFFIX,
|
||||
signature='sa{ss}')
|
||||
def updatedValue(self, name, value):
|
||||
@dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
signature='sa{ss}s')
|
||||
def updatedValue(self, name, value, profile):
|
||||
pass
|
||||
|
||||
|
||||
### methods ###
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
in_signature='ss', out_signature='',
|
||||
async_callbacks=None)
|
||||
def addContact(self, entity, profile_key="@DEFAULT@"):
|
||||
return self.cb["addContact"](unicode(entity), unicode(profile_key))
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
in_signature='s', out_signature='',
|
||||
async_callbacks=('callback', 'errback'))
|
||||
def asyncConnect(self, profile_key="@DEFAULT@", callback=None, errback=None):
|
||||
return self.cb["asyncConnect"](unicode(profile_key), callback, errback)
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
|
||||
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
in_signature='ssss', out_signature='s',
|
||||
async_callbacks=None)
|
||||
def callMenu(self, category, name, menu_type, profile_key):
|
||||
return self.cb["callMenu"](unicode(category), unicode(name), unicode(menu_type), unicode(profile_key))
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
|
||||
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
in_signature='sba{ss}', out_signature='',
|
||||
async_callbacks=None)
|
||||
def confirmationAnswer(self, id, accepted, data):
|
||||
return self.cb["confirmationAnswer"](unicode(id), accepted, data)
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
in_signature='s', out_signature='',
|
||||
async_callbacks=None)
|
||||
def connect(self, profile_key="@DEFAULT@"):
|
||||
return self.cb["connect"](unicode(profile_key))
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
|
||||
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
in_signature='s', out_signature='i',
|
||||
async_callbacks=None)
|
||||
def createProfile(self, profile):
|
||||
return self.cb["createProfile"](unicode(profile))
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
in_signature='ss', out_signature='',
|
||||
async_callbacks=None)
|
||||
def delContact(self, entity, profile_key="@DEFAULT@"):
|
||||
return self.cb["delContact"](unicode(entity), unicode(profile_key))
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
|
||||
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
in_signature='s', out_signature='i',
|
||||
async_callbacks=None)
|
||||
def deleteProfile(self, profile):
|
||||
return self.cb["deleteProfile"](unicode(profile))
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
in_signature='s', out_signature='',
|
||||
async_callbacks=None)
|
||||
def disconnect(self, profile_key="@DEFAULT@"):
|
||||
return self.cb["disconnect"](unicode(profile_key))
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
in_signature='ss', out_signature='s',
|
||||
async_callbacks=None)
|
||||
def getConfig(self, section, name):
|
||||
return self.cb["getConfig"](unicode(section), unicode(name))
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
in_signature='s', out_signature='a(sa{ss}as)',
|
||||
async_callbacks=None)
|
||||
def getContacts(self, profile_key="@DEFAULT@"):
|
||||
return self.cb["getContacts"](unicode(profile_key))
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
in_signature='ssi', out_signature='a{i(ss)}',
|
||||
async_callbacks=None)
|
||||
def getHistory(self, from_jid, to_jid, size):
|
||||
return self.cb["getHistory"](unicode(from_jid), unicode(to_jid), size)
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
|
||||
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
in_signature='sss', out_signature='s',
|
||||
async_callbacks=None)
|
||||
def getMenuHelp(self, category, name, menu_type):
|
||||
return self.cb["getMenuHelp"](unicode(category), unicode(name), unicode(menu_type))
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
|
||||
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
in_signature='', out_signature='a(sss)',
|
||||
async_callbacks=None)
|
||||
def getMenus(self, ):
|
||||
return self.cb["getMenus"]()
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
in_signature='ssss', out_signature='s',
|
||||
async_callbacks=None)
|
||||
def getParamA(self, name, category, attribute="value", profile_key="@DEFAULT@"):
|
||||
return self.cb["getParamA"](unicode(name), unicode(category), unicode(attribute), unicode(profile_key))
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
in_signature='s', out_signature='s',
|
||||
async_callbacks=None)
|
||||
def getParams(self, profile_key="@DEFAULT@"):
|
||||
return self.cb["getParams"](unicode(profile_key))
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
in_signature='', out_signature='as',
|
||||
async_callbacks=None)
|
||||
def getParamsCategories(self, ):
|
||||
return self.cb["getParamsCategories"]()
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
in_signature='ss', out_signature='s',
|
||||
async_callbacks=None)
|
||||
def getParamsForCategory(self, category, profile_key="@DEFAULT@"):
|
||||
return self.cb["getParamsForCategory"](unicode(category), unicode(profile_key))
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
in_signature='s', out_signature='s',
|
||||
async_callbacks=None)
|
||||
def getParamsUI(self, profile_key="@DEFAULT@"):
|
||||
return self.cb["getParamsUI"](unicode(profile_key))
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
in_signature='s', out_signature='a{sa{s(sia{ss})}}',
|
||||
async_callbacks=None)
|
||||
def getPresenceStatus(self, profile_key="@DEFAULT@"):
|
||||
return self.cb["getPresenceStatus"](unicode(profile_key))
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
|
||||
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
in_signature='s', out_signature='s',
|
||||
async_callbacks=None)
|
||||
def getProfileName(self, profile_key="@DEFAULT@"):
|
||||
return self.cb["getProfileName"](unicode(profile_key))
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
|
||||
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
in_signature='', out_signature='as',
|
||||
async_callbacks=None)
|
||||
def getProfilesList(self, ):
|
||||
return self.cb["getProfilesList"]()
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
|
||||
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
in_signature='s', out_signature='a{ss}',
|
||||
async_callbacks=None)
|
||||
def getProgress(self, id):
|
||||
return self.cb["getProgress"](unicode(id))
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
|
||||
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
in_signature='', out_signature='s',
|
||||
async_callbacks=None)
|
||||
def getVersion(self, ):
|
||||
return self.cb["getVersion"]()
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
in_signature='s', out_signature='a{ss}',
|
||||
async_callbacks=None)
|
||||
def getWaitingSub(self, profile_key="@DEFAULT@"):
|
||||
return self.cb["getWaitingSub"](unicode(profile_key))
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
in_signature='s', out_signature='b',
|
||||
async_callbacks=None)
|
||||
def isConnected(self, profile_key="@DEFAULT@"):
|
||||
return self.cb["isConnected"](unicode(profile_key))
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
|
||||
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
in_signature='sa{ss}s', out_signature='s',
|
||||
async_callbacks=None)
|
||||
def launchAction(self, action_type, data, profile_key="@DEFAULT@"):
|
||||
return self.cb["launchAction"](unicode(action_type), data, unicode(profile_key))
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
in_signature='ssssi', out_signature='s',
|
||||
async_callbacks=None)
|
||||
def registerNewAccount(self, login, password, email, host, port=5222):
|
||||
return self.cb["registerNewAccount"](unicode(login), unicode(password), unicode(email), unicode(host), port)
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
in_signature='sssss', out_signature='',
|
||||
async_callbacks=None)
|
||||
def sendMessage(self, to_jid, message, subject='', mess_type="chat", profile_key="@DEFAULT@"):
|
||||
return self.cb["sendMessage"](unicode(to_jid), unicode(message), unicode(subject), unicode(mess_type), unicode(profile_key))
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
in_signature='ssss', out_signature='',
|
||||
async_callbacks=None)
|
||||
def setParam(self, name, value, category, profile_key="@DEFAULT@"):
|
||||
return self.cb["setParam"](unicode(name), unicode(value), unicode(category), unicode(profile_key))
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
in_signature='ssia{ss}s', out_signature='',
|
||||
async_callbacks=None)
|
||||
def setPresence(self, to_jid='', show='', priority=0, statuses={}, profile_key="@DEFAULT@"):
|
||||
return self.cb["setPresence"](unicode(to_jid), unicode(show), priority, statuses, unicode(profile_key))
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
in_signature='sss', out_signature='',
|
||||
async_callbacks=None)
|
||||
def subscription(self, sub_type, entity, profile_key="@DEFAULT@"):
|
||||
return self.cb["subscription"](unicode(sub_type), unicode(entity), unicode(profile_key))
|
||||
|
||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
in_signature='ssass', out_signature='',
|
||||
async_callbacks=None)
|
||||
def updateContact(self, entity, name, groups, profile_key="@DEFAULT@"):
|
||||
|
|
@ -433,8 +441,8 @@ class DBusBridge(Bridge):
|
|||
def subscribe(self, sub_type, entity, profile):
|
||||
self.dbus_bridge.subscribe(sub_type, entity, profile)
|
||||
|
||||
def updatedValue(self, name, value):
|
||||
self.dbus_bridge.updatedValue(name, value)
|
||||
def updatedValue(self, name, value, profile):
|
||||
self.dbus_bridge.updatedValue(name, value, profile)
|
||||
|
||||
|
||||
def register(self, name, callback):
|
||||
|
|
|
|||
|
|
@ -344,7 +344,7 @@ class DbusConstructor(Constructor):
|
|||
completion = {
|
||||
'sig_in':function['sig_in'] or '',
|
||||
'sig_out':function['sig_out'] or '',
|
||||
'category':'REQ' if function['category'] == 'request' else 'COMM',
|
||||
'category':'PLUGIN' if function['category'] == 'plugin' else 'CORE',
|
||||
'name':section,
|
||||
'args':self.getArguments(function['sig_in'], name=arg_doc, default=default )
|
||||
}
|
||||
|
|
@ -419,7 +419,7 @@ class DbusConstructor(Constructor):
|
|||
completion = {
|
||||
'sig_in':function['sig_in'] or '',
|
||||
'sig_out':function['sig_out'] or '',
|
||||
'category':'req' if function['category'] == 'request' else 'comm',
|
||||
'category':'plugin' if function['category'] == 'plugin' else 'core',
|
||||
'name':section,
|
||||
'args':self.getArguments(function['sig_in'], name=arg_doc, default=default)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,21 +6,21 @@ doc_profile_key=profile_key: Profile key which can be either a magic (eg: @DEFAU
|
|||
|
||||
[connected]
|
||||
type=signal
|
||||
category=communication
|
||||
category=core
|
||||
sig_in=s
|
||||
doc=Connection is done
|
||||
doc_param_0=%(doc_profile)s
|
||||
|
||||
[disconnected]
|
||||
type=signal
|
||||
category=communication
|
||||
category=core
|
||||
sig_in=s
|
||||
doc=Connection is finished or lost
|
||||
doc_param_0=%(doc_profile)s
|
||||
|
||||
[connectionError]
|
||||
type=signal
|
||||
category=communication
|
||||
category=core
|
||||
sig_in=ss
|
||||
doc=Something went wront with the connection
|
||||
doc_param_0=error_type: Why the connection got wrong, can be
|
||||
|
|
@ -29,7 +29,7 @@ doc_param_1=%(doc_profile)s
|
|||
|
||||
[newContact]
|
||||
type=signal
|
||||
category=communication
|
||||
category=core
|
||||
sig_in=sa{ss}ass
|
||||
doc=New contact received in roster
|
||||
doc_param_0=contact: JID from who the message is comming
|
||||
|
|
@ -43,7 +43,7 @@ doc_param_3=%(doc_profile)s
|
|||
|
||||
[newMessage]
|
||||
type=signal
|
||||
category=communication
|
||||
category=core
|
||||
sig_in=sssss
|
||||
doc=A message has been received
|
||||
doc_param_0=from_jid: JID where the message is comming from
|
||||
|
|
@ -54,7 +54,7 @@ doc_param_4=%(doc_profile)s
|
|||
|
||||
[newAlert]
|
||||
type=signal
|
||||
category=communication
|
||||
category=core
|
||||
sig_in=ssss
|
||||
doc=A new alert happened
|
||||
doc_param_0=message: Body of the alert
|
||||
|
|
@ -66,7 +66,7 @@ doc_param_3=%(doc_profile)s
|
|||
|
||||
[presenceUpdate]
|
||||
type=signal
|
||||
category=communication
|
||||
category=core
|
||||
sig_in=ssia{ss}s
|
||||
doc=Somebody changed his presence informations.
|
||||
doc_param_0=entity: JID from which we have presence informations
|
||||
|
|
@ -77,7 +77,7 @@ doc_param_4=%(doc_profile)s
|
|||
|
||||
[subscribe]
|
||||
type=signal
|
||||
category=communication
|
||||
category=core
|
||||
sig_in=sss
|
||||
doc=Somebody wants to be added in roster
|
||||
doc_param_0=sub_type: Subscription states (see RFC 3921 #9)
|
||||
|
|
@ -86,7 +86,7 @@ doc_param_2=%(doc_profile)s
|
|||
|
||||
[paramUpdate]
|
||||
type=signal
|
||||
category=communication
|
||||
category=core
|
||||
sig_in=ssss
|
||||
doc=A parameter has been changed
|
||||
doc_param_0=name: Name of the updated parameter
|
||||
|
|
@ -96,7 +96,7 @@ doc_param_3=%(doc_profile)s
|
|||
|
||||
[contactDeleted]
|
||||
type=signal
|
||||
category=communication
|
||||
category=core
|
||||
sig_in=ss
|
||||
doc=A contact has been supressed from roster
|
||||
doc_param_0=entity: JID of the contact removed from roster
|
||||
|
|
@ -104,7 +104,7 @@ doc_param_1=%(doc_profile)s
|
|||
|
||||
[askConfirmation]
|
||||
type=signal
|
||||
category=request
|
||||
category=core
|
||||
sig_in=ssa{ss}
|
||||
doc=A confirmation is needed for an action
|
||||
doc_param_0=conf_type: Type of the confirmation, can be:
|
||||
|
|
@ -115,7 +115,7 @@ doc_param_2=data: conf_type dependent data
|
|||
|
||||
[actionResult]
|
||||
type=signal
|
||||
category=request
|
||||
category=core
|
||||
sig_in=ssa{ss}
|
||||
doc=Requested result of an action
|
||||
doc_param_0=answer_type: Type of the answer, can be:
|
||||
|
|
@ -128,7 +128,7 @@ doc_param_2=data: answer_type specific data
|
|||
|
||||
[actionResultExt]
|
||||
type=signal
|
||||
category=request
|
||||
category=core
|
||||
sig_in=ssa{sa{ss}}
|
||||
doc=Requested result of an action (Extended)
|
||||
doc_param_0=answer_type: Same as for [actionResult] but with the following additional one:
|
||||
|
|
@ -138,24 +138,25 @@ doc_param_2=data: answer_type specific data
|
|||
|
||||
[updatedValue]
|
||||
type=signal
|
||||
category=request
|
||||
sig_in=sa{ss}
|
||||
category=core
|
||||
sig_in=sa{ss}s
|
||||
doc=A value has been updated
|
||||
doc_param_0=name: Name of the updated value
|
||||
doc_param_1=value: New value
|
||||
doc_param_2=%(doc_profile)s
|
||||
|
||||
;methods
|
||||
|
||||
[getVersion]
|
||||
type=method
|
||||
category=request
|
||||
category=core
|
||||
sig_in=
|
||||
sig_out=s
|
||||
doc=Get "Salut à Toi" version
|
||||
|
||||
[getProfileName]
|
||||
type=method
|
||||
category=request
|
||||
category=core
|
||||
sig_in=s
|
||||
sig_out=s
|
||||
param_0_default="@DEFAULT@"
|
||||
|
|
@ -165,14 +166,14 @@ doc_return=Real profile name, or empty string if the profile doesn't exist
|
|||
|
||||
[getProfilesList]
|
||||
type=method
|
||||
category=request
|
||||
category=core
|
||||
sig_in=
|
||||
sig_out=as
|
||||
doc=Get all profiles
|
||||
|
||||
[createProfile]
|
||||
type=method
|
||||
category=request
|
||||
category=core
|
||||
sig_in=s
|
||||
sig_out=i
|
||||
doc=Create a new profile
|
||||
|
|
@ -183,7 +184,7 @@ doc_return=status of the creation:
|
|||
|
||||
[deleteProfile]
|
||||
type=method
|
||||
category=request
|
||||
category=core
|
||||
sig_in=s
|
||||
sig_out=i
|
||||
doc=Delete a profile
|
||||
|
|
@ -195,7 +196,7 @@ doc_return=status of the deletion:
|
|||
[registerNewAccount]
|
||||
deprecated=
|
||||
type=method
|
||||
category=communication
|
||||
category=core
|
||||
sig_in=ssssi
|
||||
sig_out=s
|
||||
param_4_default=5222
|
||||
|
|
@ -208,7 +209,7 @@ doc_param_4=port: port of the server to register to
|
|||
|
||||
[connect]
|
||||
type=method
|
||||
category=communication
|
||||
category=core
|
||||
sig_in=s
|
||||
sig_out=
|
||||
param_0_default="@DEFAULT@"
|
||||
|
|
@ -218,7 +219,7 @@ doc_param_0=%(doc_profile_key)s
|
|||
[asyncConnect]
|
||||
async=
|
||||
type=method
|
||||
category=communication
|
||||
category=core
|
||||
sig_in=s
|
||||
sig_out=
|
||||
param_0_default="@DEFAULT@"
|
||||
|
|
@ -227,7 +228,7 @@ doc_param_0=%(doc_profile_key)s
|
|||
|
||||
[disconnect]
|
||||
type=method
|
||||
category=communication
|
||||
category=core
|
||||
sig_in=s
|
||||
sig_out=
|
||||
param_0_default="@DEFAULT@"
|
||||
|
|
@ -236,7 +237,7 @@ doc_param_0=%(doc_profile_key)s
|
|||
|
||||
[isConnected]
|
||||
type=method
|
||||
category=communication
|
||||
category=core
|
||||
sig_in=s
|
||||
sig_out=b
|
||||
param_0_default="@DEFAULT@"
|
||||
|
|
@ -245,7 +246,7 @@ doc_param_0=%(doc_profile_key)s
|
|||
|
||||
[getContacts]
|
||||
type=method
|
||||
category=communication
|
||||
category=core
|
||||
sig_in=s
|
||||
sig_out=a(sa{ss}as)
|
||||
param_0_default="@DEFAULT@"
|
||||
|
|
@ -258,7 +259,7 @@ doc_return=array of tuples with the following values:
|
|||
|
||||
[getPresenceStatus]
|
||||
type=method
|
||||
category=communication
|
||||
category=core
|
||||
sig_in=s
|
||||
sig_out=a{sa{s(sia{ss})}}
|
||||
param_0_default="@DEFAULT@"
|
||||
|
|
@ -269,7 +270,7 @@ doc_return=Dict of presence with bare JID of contact as key, and value as follow
|
|||
|
||||
[getWaitingSub]
|
||||
type=method
|
||||
category=communication
|
||||
category=core
|
||||
sig_in=s
|
||||
sig_out=a{ss}
|
||||
param_0_default="@DEFAULT@"
|
||||
|
|
@ -279,7 +280,7 @@ doc_return=Dict where contact JID is the key, and value is the subscription type
|
|||
|
||||
[sendMessage]
|
||||
type=method
|
||||
category=communication
|
||||
category=core
|
||||
sig_in=sssss
|
||||
sig_out=
|
||||
param_2_default=''
|
||||
|
|
@ -294,7 +295,7 @@ doc_param_4=%(doc_profile_key)s
|
|||
|
||||
[setPresence]
|
||||
type=method
|
||||
category=communication
|
||||
category=core
|
||||
sig_in=ssia{ss}s
|
||||
sig_out=
|
||||
param_0_default=''
|
||||
|
|
@ -311,7 +312,7 @@ doc_param_4=%(doc_profile_key)s
|
|||
|
||||
[subscription]
|
||||
type=method
|
||||
category=communication
|
||||
category=core
|
||||
sig_in=sss
|
||||
sig_out=
|
||||
param_2_default="@DEFAULT@"
|
||||
|
|
@ -322,7 +323,7 @@ doc_param_2=%(doc_profile_key)s
|
|||
|
||||
[getConfig]
|
||||
type=method
|
||||
category=communication
|
||||
category=core
|
||||
sig_in=ss
|
||||
sig_out=s
|
||||
doc=get main configuration option
|
||||
|
|
@ -331,7 +332,7 @@ doc_param_1=name: name of the option
|
|||
|
||||
[setParam]
|
||||
type=method
|
||||
category=communication
|
||||
category=core
|
||||
sig_in=ssss
|
||||
sig_out=
|
||||
param_3_default="@DEFAULT@"
|
||||
|
|
@ -343,7 +344,7 @@ doc_param_3=%(doc_profile_key)s
|
|||
|
||||
[getParamA]
|
||||
type=method
|
||||
category=communication
|
||||
category=core
|
||||
sig_in=ssss
|
||||
sig_out=s
|
||||
param_2_default="value"
|
||||
|
|
@ -356,7 +357,7 @@ doc_param_3=%(doc_profile_key)s
|
|||
|
||||
[getParamsUI]
|
||||
type=method
|
||||
category=communication
|
||||
category=core
|
||||
sig_in=s
|
||||
sig_out=s
|
||||
param_0_default="@DEFAULT@"
|
||||
|
|
@ -365,7 +366,7 @@ doc_param_0=%(doc_profile_key)s
|
|||
|
||||
[getParams]
|
||||
type=method
|
||||
category=communication
|
||||
category=core
|
||||
sig_in=s
|
||||
sig_out=s
|
||||
param_0_default="@DEFAULT@"
|
||||
|
|
@ -374,7 +375,7 @@ doc_param_0=%(doc_profile_key)s
|
|||
|
||||
[getParamsForCategory]
|
||||
type=method
|
||||
category=communication
|
||||
category=core
|
||||
sig_in=ss
|
||||
sig_out=s
|
||||
param_1_default="@DEFAULT@"
|
||||
|
|
@ -384,7 +385,7 @@ doc_param_1=%(doc_profile_key)s
|
|||
|
||||
[getParamsCategories]
|
||||
type=method
|
||||
category=communication
|
||||
category=core
|
||||
sig_in=
|
||||
sig_out=as
|
||||
doc=Get all categories currently existing in parameters
|
||||
|
|
@ -392,7 +393,7 @@ doc_return=list of categories
|
|||
|
||||
[getHistory]
|
||||
type=method
|
||||
category=communication
|
||||
category=core
|
||||
sig_in=ssi
|
||||
sig_out=a{i(ss)}
|
||||
doc=Get history of a communication between two entities
|
||||
|
|
@ -403,7 +404,7 @@ doc_return=Dict where key is timestamp (seconds this the Epoch), and value is a
|
|||
|
||||
[addContact]
|
||||
type=method
|
||||
category=communication
|
||||
category=core
|
||||
sig_in=ss
|
||||
sig_out=
|
||||
param_1_default="@DEFAULT@"
|
||||
|
|
@ -413,7 +414,7 @@ doc_param_1=%(doc_profile_key)s
|
|||
|
||||
[updateContact]
|
||||
type=method
|
||||
category=communication
|
||||
category=core
|
||||
sig_in=ssass
|
||||
sig_out=
|
||||
param_3_default="@DEFAULT@"
|
||||
|
|
@ -425,7 +426,7 @@ doc_param_3=%(doc_profile_key)s
|
|||
|
||||
[delContact]
|
||||
type=method
|
||||
category=communication
|
||||
category=core
|
||||
sig_in=ss
|
||||
sig_out=
|
||||
param_1_default="@DEFAULT@"
|
||||
|
|
@ -435,7 +436,7 @@ doc_param_1=%(doc_profile_key)s
|
|||
|
||||
[launchAction]
|
||||
type=method
|
||||
category=request
|
||||
category=core
|
||||
sig_in=sa{ss}s
|
||||
sig_out=s
|
||||
param_2_default="@DEFAULT@"
|
||||
|
|
@ -447,7 +448,7 @@ doc_param_2=%(doc_profile_key)s
|
|||
|
||||
[confirmationAnswer]
|
||||
type=method
|
||||
category=request
|
||||
category=core
|
||||
sig_in=sba{ss}
|
||||
sig_out=
|
||||
doc=Give answer to a confirmation request
|
||||
|
|
@ -457,7 +458,7 @@ doc_param_2=data: action specific data
|
|||
|
||||
[getProgress]
|
||||
type=method
|
||||
category=request
|
||||
category=core
|
||||
sig_in=s
|
||||
sig_out=a{ss}
|
||||
doc=Get progress information for an action
|
||||
|
|
@ -468,7 +469,7 @@ doc_return=dict with progress information:
|
|||
|
||||
[getMenus]
|
||||
type=method
|
||||
category=request
|
||||
category=core
|
||||
sig_in=
|
||||
sig_out=a(sss)
|
||||
doc=Get all additional menus
|
||||
|
|
@ -480,7 +481,7 @@ doc_return=list of tuple with the following value:
|
|||
|
||||
[getMenuHelp]
|
||||
type=method
|
||||
category=request
|
||||
category=core
|
||||
sig_in=sss
|
||||
sig_out=s
|
||||
param_2="NORMAL"
|
||||
|
|
@ -492,7 +493,7 @@ doc_return=Help string
|
|||
|
||||
[callMenu]
|
||||
type=method
|
||||
category=request
|
||||
category=core
|
||||
sig_in=ssss
|
||||
sig_out=s
|
||||
doc=Execute action associated with a menu
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ from logging import debug, info
|
|||
|
||||
const_INT_PREFIX = "org.goffi.SAT" #Interface prefix
|
||||
const_OBJ_PATH = '/org/goffi/SAT/bridge'
|
||||
const_COMM_SUFFIX = ".communication"
|
||||
const_REQ_SUFFIX = ".request"
|
||||
const_CORE_SUFFIX = ".core"
|
||||
const_PLUGIN_SUFFIX = ".plugin"
|
||||
|
||||
class DbusObject(dbus.service.Object):
|
||||
|
||||
|
|
@ -43,6 +43,14 @@ class DbusObject(dbus.service.Object):
|
|||
|
||||
### signals ###
|
||||
|
||||
@dbus.service.signal(const_INT_PREFIX+const_PLUGIN_SUFFIX,
|
||||
signature='')
|
||||
def dummySignal(self):
|
||||
#FIXME: workaround for addSignal (doesn't work if one method doensn't
|
||||
# already exist for plugins), probably missing some initialisation, need
|
||||
# further investigations
|
||||
pass
|
||||
|
||||
##SIGNALS_PART##
|
||||
|
||||
### methods ###
|
||||
|
|
|
|||
|
|
@ -21,12 +21,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
from bridge_frontend import BridgeFrontend
|
||||
import dbus, dbus.glib
|
||||
from logging import debug
|
||||
from logging import debug, error
|
||||
|
||||
const_INT_PREFIX = "org.goffi.SAT" #Interface prefix
|
||||
const_OBJ_PATH = '/org/goffi/SAT/bridge'
|
||||
const_COMM_SUFFIX = ".communication"
|
||||
const_REQ_SUFFIX = ".request"
|
||||
const_CORE_SUFFIX = ".core"
|
||||
const_PLUGIN_SUFFIX = ".plugin"
|
||||
|
||||
class BridgeExceptionNoService(Exception):
|
||||
pass
|
||||
|
|
@ -37,97 +37,99 @@ class DBusBridgeFrontend(BridgeFrontend):
|
|||
self.sessions_bus = dbus.SessionBus()
|
||||
self.db_object = self.sessions_bus.get_object(const_INT_PREFIX,
|
||||
const_OBJ_PATH)
|
||||
self.db_comm_iface = dbus.Interface(self.db_object,
|
||||
dbus_interface=const_INT_PREFIX + const_COMM_SUFFIX)
|
||||
self.db_req_iface = dbus.Interface(self.db_object,
|
||||
dbus_interface=const_INT_PREFIX + const_REQ_SUFFIX)
|
||||
self.db_core_iface = dbus.Interface(self.db_object,
|
||||
dbus_interface=const_INT_PREFIX + const_CORE_SUFFIX)
|
||||
self.db_plugin_iface = dbus.Interface(self.db_object,
|
||||
dbus_interface=const_INT_PREFIX + const_PLUGIN_SUFFIX)
|
||||
except dbus.exceptions.DBusException,e:
|
||||
if e._dbus_error_name=='org.freedesktop.DBus.Error.ServiceUnknown':
|
||||
raise BridgeExceptionNoService
|
||||
else:
|
||||
raise e
|
||||
#props = self.db_comm_iface.getProperties()
|
||||
#props = self.db_core_iface.getProperties()
|
||||
|
||||
def register(self, functionName, handler, iface="communication"):
|
||||
if iface == "communication":
|
||||
self.db_comm_iface.connect_to_signal(functionName, handler)
|
||||
elif iface == "request":
|
||||
self.db_req_iface.connect_to_signal(functionName, handler)
|
||||
def register(self, functionName, handler, iface="core"):
|
||||
if iface == "core":
|
||||
self.db_core_iface.connect_to_signal(functionName, handler)
|
||||
elif iface == "plugin":
|
||||
self.db_plugin_iface.connect_to_signal(functionName, handler)
|
||||
else:
|
||||
error(_('Unknown interface'))
|
||||
|
||||
##METHODS_PART##
|
||||
|
||||
#methods from plugins
|
||||
def getRoomJoined(self, profile_key='@DEFAULT@'):
|
||||
return self.db_comm_iface.getRoomJoined(profile_key)
|
||||
return self.db_plugin_iface.getRoomJoined(profile_key)
|
||||
|
||||
def getRoomSubjects(self, profile_key='@DEFAULT@'):
|
||||
return self.db_comm_iface.getRoomSubjects(profile_key)
|
||||
return self.db_plugin_iface.getRoomSubjects(profile_key)
|
||||
|
||||
def joinMUC(self, service, roomId, nick, profile_key='@DEFAULT@'):
|
||||
return self.db_comm_iface.joinMUC(service, roomId, nick, profile_key)
|
||||
return self.db_plugin_iface.joinMUC(service, roomId, nick, profile_key)
|
||||
|
||||
def tarotGameLaunch(self, players, profile_key='@DEFAULT@'):
|
||||
return self.db_comm_iface.tarotGameLaunch(players, profile_key)
|
||||
return self.db_plugin_iface.tarotGameLaunch(players, profile_key)
|
||||
|
||||
def tarotGameCreate(self, room_jid, players, profile_key='@DEFAULT@'):
|
||||
return self.db_comm_iface.tarotGameCreate(room_jid, players, profile_key)
|
||||
return self.db_plugin_iface.tarotGameCreate(room_jid, players, profile_key)
|
||||
|
||||
def tarotGameReady(self, player, referee, profile_key='@DEFAULT@'):
|
||||
return self.db_comm_iface.tarotGameReady(player, referee, profile_key)
|
||||
return self.db_plugin_iface.tarotGameReady(player, referee, profile_key)
|
||||
|
||||
def tarotGameContratChoosed(self, player, referee, contrat, profile_key='@DEFAULT@'):
|
||||
return self.db_comm_iface.tarotGameContratChoosed(player, referee, contrat, profile_key)
|
||||
return self.db_plugin_iface.tarotGameContratChoosed(player, referee, contrat, profile_key)
|
||||
|
||||
def tarotGamePlayCards(self, player, referee, cards, profile_key='@DEFAULT@'):
|
||||
return self.db_comm_iface.tarotGamePlayCards(player, referee, cards, profile_key)
|
||||
return self.db_plugin_iface.tarotGamePlayCards(player, referee, cards, profile_key)
|
||||
|
||||
def quizGameLaunch(self, players, profile_key='@DEFAULT@'):
|
||||
return self.db_comm_iface.quizGameLaunch(players, profile_key)
|
||||
return self.db_plugin_iface.quizGameLaunch(players, profile_key)
|
||||
|
||||
def quizGameCreate(self, room_jid, players, profile_key='@DEFAULT@'):
|
||||
return self.db_comm_iface.quizGameCreate(room_jid, players, profile_key)
|
||||
return self.db_plugin_iface.quizGameCreate(room_jid, players, profile_key)
|
||||
|
||||
def quizGameReady(self, player, referee, profile_key='@DEFAULT@'):
|
||||
return self.db_comm_iface.quizGameReady(player, referee, profile_key)
|
||||
return self.db_plugin_iface.quizGameReady(player, referee, profile_key)
|
||||
|
||||
def quizGameAnswer(self, player, referee, answer, profile_key='@DEFAULT@'):
|
||||
return self.db_comm_iface.quizGameAnswer(player, referee, answer, profile_key)
|
||||
return self.db_plugin_iface.quizGameAnswer(player, referee, answer, profile_key)
|
||||
|
||||
def sendFile(self, to, path, profile_key='@DEFAULT@'):
|
||||
return self.db_comm_iface.sendFile(to, path, profile_key)
|
||||
return self.db_plugin_iface.sendFile(to, path, profile_key)
|
||||
|
||||
def findGateways(self, target, profile_key='@DEFAULT@'):
|
||||
return self.db_comm_iface.findGateways(target, profile_key)
|
||||
return self.db_plugin_iface.findGateways(target, profile_key)
|
||||
|
||||
def getCard(self, target, profile_key='@DEFAULT@'):
|
||||
return self.db_comm_iface.getCard(target, profile_key)
|
||||
return self.db_plugin_iface.getCard(target, profile_key)
|
||||
|
||||
def getCardCache(self, target):
|
||||
return self.db_comm_iface.getCardCache(target)
|
||||
return self.db_plugin_iface.getCardCache(target)
|
||||
|
||||
def getAvatarFile(self, hash):
|
||||
return self.db_comm_iface.getAvatarFile(hash)
|
||||
return self.db_plugin_iface.getAvatarFile(hash)
|
||||
|
||||
def in_band_register(self, target, profile_key='@DEFAULT@'):
|
||||
return self.db_comm_iface.in_band_register(target, profile_key)
|
||||
return self.db_plugin_iface.in_band_register(target, profile_key)
|
||||
|
||||
def gatewayRegister(self, action, target, data, profile_key='@DEFAULT@'):
|
||||
if data == None:
|
||||
data = [('', '')] #XXX: we have to do this awful hack because python dbus need to guess the signature
|
||||
return self.db_req_iface.gatewayRegister(action, target, data, profile_key)
|
||||
return self.db_plugin_iface.gatewayRegister(action, target, data, profile_key)
|
||||
|
||||
def getLastMicroblogs(self, jid, max_items, profile_key='@DEFAULT@', callback=None, errback=None):
|
||||
return self.db_comm_iface.getLastMicroblogs(jid, max_items, profile_key, reply_handler=callback, error_handler=errback)
|
||||
return self.db_plugin_iface.getLastMicroblogs(jid, max_items, profile_key, reply_handler=callback, error_handler=errback)
|
||||
|
||||
def getMblogNodes(self, profile_key='@DEFAULT@', callback=None, errback=None):
|
||||
return self.db_comm_iface.getMblogNodes(profile_key, reply_handler=callback, error_handler=errback)
|
||||
return self.db_plugin_iface.getMblogNodes(profile_key, reply_handler=callback, error_handler=errback)
|
||||
|
||||
def sendGroupBlog(self, groups, message, profile_key='@DEFAULT@'):
|
||||
return self.db_comm_iface.sendGroupBlog(groups, message, profile_key)
|
||||
return self.db_plugin_iface.sendGroupBlog(groups, message, profile_key)
|
||||
|
||||
def sendPersonalEvent(self, event_type, data, profile_key='@DEFAULT@'):
|
||||
return self.db_comm_iface.sendPersonalEvent(event_type, data, profile_key)
|
||||
return self.db_plugin_iface.sendPersonalEvent(event_type, data, profile_key)
|
||||
|
||||
def setMicroblogAccess(self, access="presence", profile_key='@DEFAULT@', callback=None, errback=None):
|
||||
return self.db_comm_iface.setMicroblogAccess(access, profile_key, reply_handler=callback, error_handler=errback)
|
||||
return self.db_plugin_iface.setMicroblogAccess(access, profile_key, reply_handler=callback, error_handler=errback)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue