Mercurial > libervia-backend
comparison src/bridge/dbus_bridge.py @ 2144:1d3f73e065e1
core, jp: component handling + client handling refactoring:
- SàT can now handle components
- plugin have now a "modes" key in PLUGIN_INFO where they declare if they can be used with clients and or components. They default to be client only.
- components are really similar to clients, but with some changes in behaviour:
* component has "entry point", which is a special plugin with a componentStart method, which is called just after component is connected
* trigger end with a different suffixes (e.g. profileConnected vs profileConnectedComponent), so a plugin which manage both clients and components can have different workflow
* for clients, only triggers of plugins handling client mode are launched
* for components, only triggers of plugins needed in dependencies are launched. They all must handle component mode.
* component have a sendHistory attribute (False by default) which can be set to True to allow saving sent messages into history
* for convenience, "client" is still used in method even if it can now be a component
* a new "component" boolean attribute tells if we have a component or a client
* components have to add themselve Message protocol
* roster and presence protocols are not added for components
* component default port is 5347 (which is Prosody's default port)
- asyncCreateProfile has been renamed for profileCreate, both to follow new naming convention and to prepare the transition to fully asynchronous bridge
- createProfile has a new "component" attribute. When used to create a component, it must be set to a component entry point
- jp: added --component argument to profile/create
- disconnect bridge method is now asynchronous, this way frontends can know when disconnection is finished
- new PI_* constants for PLUGIN_INFO values (not used everywhere yet)
- client/component connection workflow has been moved to their classes instead of being a host methods
- host.messageSend is now client.sendMessage, and former client.sendMessage is now client.sendMessageData.
- identities are now handled in client.identities list, so it can be updated dynamically by plugins (in the future, frontends should be able to update them too through bridge)
- profileConnecting* profileConnected* profileDisconnected* and getHandler now all use client instead of profile
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 12 Feb 2017 17:55:43 +0100 |
parents | be96beb7ca14 |
children | 1bb9bf1b4150 |
comparison
equal
deleted
inserted
replaced
2143:c3cac21157d4 | 2144:1d3f73e065e1 |
---|---|
202 async_callbacks=None) | 202 async_callbacks=None) |
203 def addContact(self, entity_jid, profile_key="@DEFAULT@"): | 203 def addContact(self, entity_jid, profile_key="@DEFAULT@"): |
204 return self._callback("addContact", unicode(entity_jid), unicode(profile_key)) | 204 return self._callback("addContact", unicode(entity_jid), unicode(profile_key)) |
205 | 205 |
206 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, | 206 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
207 in_signature='ss', out_signature='', | |
208 async_callbacks=('callback', 'errback')) | |
209 def asyncCreateProfile(self, profile, password='', callback=None, errback=None): | |
210 return self._callback("asyncCreateProfile", unicode(profile), unicode(password), callback=callback, errback=errback) | |
211 | |
212 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, | |
213 in_signature='s', out_signature='', | 207 in_signature='s', out_signature='', |
214 async_callbacks=('callback', 'errback')) | 208 async_callbacks=('callback', 'errback')) |
215 def asyncDeleteProfile(self, profile, callback=None, errback=None): | 209 def asyncDeleteProfile(self, profile, callback=None, errback=None): |
216 return self._callback("asyncDeleteProfile", unicode(profile), callback=callback, errback=errback) | 210 return self._callback("asyncDeleteProfile", unicode(profile), callback=callback, errback=errback) |
217 | 211 |
251 def discoItems(self, entity_jid, profile_key, callback=None, errback=None): | 245 def discoItems(self, entity_jid, profile_key, callback=None, errback=None): |
252 return self._callback("discoItems", unicode(entity_jid), unicode(profile_key), callback=callback, errback=errback) | 246 return self._callback("discoItems", unicode(entity_jid), unicode(profile_key), callback=callback, errback=errback) |
253 | 247 |
254 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, | 248 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
255 in_signature='s', out_signature='', | 249 in_signature='s', out_signature='', |
256 async_callbacks=None) | 250 async_callbacks=('callback', 'errback')) |
257 def disconnect(self, profile_key="@DEFAULT@"): | 251 def disconnect(self, profile_key="@DEFAULT@", callback=None, errback=None): |
258 return self._callback("disconnect", unicode(profile_key)) | 252 return self._callback("disconnect", unicode(profile_key), callback=callback, errback=errback) |
259 | 253 |
260 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, | 254 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
261 in_signature='ss', out_signature='s', | 255 in_signature='ss', out_signature='s', |
262 async_callbacks=None) | 256 async_callbacks=None) |
263 def getConfig(self, section, name): | 257 def getConfig(self, section, name): |
404 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, | 398 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
405 in_signature='sis', out_signature='', | 399 in_signature='sis', out_signature='', |
406 async_callbacks=None) | 400 async_callbacks=None) |
407 def paramsRegisterApp(self, xml, security_limit=-1, app=''): | 401 def paramsRegisterApp(self, xml, security_limit=-1, app=''): |
408 return self._callback("paramsRegisterApp", unicode(xml), security_limit, unicode(app)) | 402 return self._callback("paramsRegisterApp", unicode(xml), security_limit, unicode(app)) |
403 | |
404 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, | |
405 in_signature='sss', out_signature='', | |
406 async_callbacks=('callback', 'errback')) | |
407 def profileCreate(self, profile, password='', component='', callback=None, errback=None): | |
408 return self._callback("profileCreate", unicode(profile), unicode(password), unicode(component), callback=callback, errback=errback) | |
409 | 409 |
410 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, | 410 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
411 in_signature='s', out_signature='b', | 411 in_signature='s', out_signature='b', |
412 async_callbacks=None) | 412 async_callbacks=None) |
413 def profileIsSessionStarted(self, profile_key="@DEFAULT@"): | 413 def profileIsSessionStarted(self, profile_key="@DEFAULT@"): |