Mercurial > libervia-backend
comparison sat/bridge/dbus_bridge.py @ 3254:6cf4bd6972c2
core, frontends: avatar refactoring:
/!\ huge commit
Avatar logic has been reworked around the IDENTITY plugin: plugins able to handle avatar
or other identity related metadata (like nicknames) register to IDENTITY plugin in the
same way as for other features like download/upload. Once registered, IDENTITY plugin will
call them when suitable in order of priority, and handle caching.
Methods to manage those metadata from frontend now use serialised data.
For now `avatar` and `nicknames` are handled:
- `avatar` is now a dict with `path` + metadata like `media_type`, instead of just a string
path
- `nicknames` is now a list of nicknames in order of priority. This list is never empty,
and `nicknames[0]` should be the preferred nickname to use by frontends in most cases.
In addition to contact specified nicknames, user set nickname (the one set in roster) is
used in priority when available.
Among the side changes done with this commit, there are:
- a new `contactGet` bridge method to get roster metadata for a single contact
- SatPresenceProtocol.send returns a Deferred to check when it has actually been sent
- memory's methods to handle entities data now use `client` as first argument
- metadata filter can be specified with `getIdentity`
- `getAvatar` and `setAvatar` are now part of the IDENTITY plugin instead of XEP-0054 (and
there signature has changed)
- `isRoom` and `getBareOrFull` are now part of XEP-0045 plugin
- jp avatar/get command uses `xdg-open` first when available for `--show` flag
- `--no-cache` has been added to jp avatar/get and identity/get
- jp identity/set has been simplified, explicit options (`--nickname` only for now) are
used instead of `--field`. `--field` may come back in the future if necessary for extra
data.
- QuickContactList `SetContact` now handle None as a value, and doesn't use it to delete the
metadata anymore
- improved cache handling for `metadata` and `nicknames` in quick frontend
- new `default` argument in QuickContactList `getCache`
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 14 Apr 2020 21:00:33 +0200 |
parents | ae09989e9feb |
children | f300d78f08f3 |
comparison
equal
deleted
inserted
replaced
3253:1af840e84af7 | 3254:6cf4bd6972c2 |
---|---|
251 async_callbacks=('callback', 'errback')) | 251 async_callbacks=('callback', 'errback')) |
252 def connect(self, profile_key="@DEFAULT@", password='', options={}, callback=None, errback=None): | 252 def connect(self, profile_key="@DEFAULT@", password='', options={}, callback=None, errback=None): |
253 return self._callback("connect", str(profile_key), str(password), options, callback=callback, errback=errback) | 253 return self._callback("connect", str(profile_key), str(password), options, callback=callback, errback=errback) |
254 | 254 |
255 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, | 255 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
256 in_signature='ss', out_signature='(a{ss}as)', | |
257 async_callbacks=('callback', 'errback')) | |
258 def contactGet(self, arg_0, profile_key="@DEFAULT@", callback=None, errback=None): | |
259 return self._callback("contactGet", str(arg_0), str(profile_key), callback=callback, errback=errback) | |
260 | |
261 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, | |
256 in_signature='ss', out_signature='', | 262 in_signature='ss', out_signature='', |
257 async_callbacks=('callback', 'errback')) | 263 async_callbacks=('callback', 'errback')) |
258 def delContact(self, entity_jid, profile_key="@DEFAULT@", callback=None, errback=None): | 264 def delContact(self, entity_jid, profile_key="@DEFAULT@", callback=None, errback=None): |
259 return self._callback("delContact", str(entity_jid), str(profile_key), callback=callback, errback=errback) | 265 return self._callback("delContact", str(entity_jid), str(profile_key), callback=callback, errback=errback) |
260 | 266 |
594 def subscription(self, sub_type, entity, profile_key="@DEFAULT@"): | 600 def subscription(self, sub_type, entity, profile_key="@DEFAULT@"): |
595 return self._callback("subscription", str(sub_type), str(entity), str(profile_key)) | 601 return self._callback("subscription", str(sub_type), str(entity), str(profile_key)) |
596 | 602 |
597 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, | 603 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
598 in_signature='ssass', out_signature='', | 604 in_signature='ssass', out_signature='', |
599 async_callbacks=('callback', 'errback')) | 605 async_callbacks=None) |
600 def updateContact(self, entity_jid, name, groups, profile_key="@DEFAULT@", callback=None, errback=None): | 606 def updateContact(self, entity_jid, name, groups, profile_key="@DEFAULT@"): |
601 return self._callback("updateContact", str(entity_jid), str(name), groups, str(profile_key), callback=callback, errback=errback) | 607 return self._callback("updateContact", str(entity_jid), str(name), groups, str(profile_key)) |
602 | 608 |
603 def __attributes(self, in_sign): | 609 def __attributes(self, in_sign): |
604 """Return arguments to user given a in_sign | 610 """Return arguments to user given a in_sign |
605 @param in_sign: in_sign in the short form (using s,a,i,b etc) | 611 @param in_sign: in_sign in the short form (using s,a,i,b etc) |
606 @return: list of arguments that correspond to a in_sign (e.g.: "sss" return "arg1, arg2, arg3")""" | 612 @return: list of arguments that correspond to a in_sign (e.g.: "sss" return "arg1, arg2, arg3")""" |