Commit graph libervia-backend/sat/bridge/bridge_constructor
Author SHA1 Message Date
Goffi
47ec15cc46 core: image convertion + SVG support:
/!\ new optional dependency: CairoSVG (with installed `[SVG]` extra)

- new `convert` method in `tools.image` to save an image in an other format, with support
  for SVG (when CairoSVG is available)
- new `imageConvert` method is available for frontends
2020-04-19 16:53:44 +02:00
Goffi
88072e0453 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`
2020-04-14 21:00:33 +02:00
Goffi
81de80348b bridge (pb): fixed conversions of Failure to BridgeException in non-AIO bridge 2020-04-01 15:40:29 +02:00
Goffi
5e4e10e690 bridge (constructor/dbus): typo 2020-03-06 18:19:03 +01:00
Goffi
5a467b15d5 core, bridge: new devicesInfosGet method to get infos on known devices of an entity 2020-03-06 18:19:03 +01:00
Goffi
3686d7e036 core, bridge: new imageGeneratePreview helped method to generate a thumbnail 2020-03-01 18:48:06 +01:00
Goffi
a194874638 bridge: messageSend's extra is now serialised 2020-02-21 12:17:38 +01:00
Goffi
6a7d247754 core: use serialised dict for extra in messageNew and historyGet 2020-02-18 18:13:17 +01:00
Goffi
13a4177c08 bridge constructor: replaced deprecated readfp 2020-02-14 15:18:52 +01:00
Goffi
d684685e24 bridge: added methods to let frontends store/retrieve/delete private data 2020-02-10 22:01:53 +01:00
Goffi
4cb56362ec bridge (dbus): new bridge_dbus_int_prefix option (in [DEFAULT] settings) to change interface prefix 2020-01-29 18:54:40 +01:00
Goffi
e1a44cf4e4 fixed shebangs 2020-01-29 10:07:00 +01:00
Goffi
a39349fe64 dates update 2020-01-29 09:50:54 +01:00
Goffi
87659cf0f0 core (memory/params): added extra argument to filter out params notably in getParamsUI:
In some case, it may be desirable for a frontend to not expose some parameters to user
(e.g. it is the case on Android with the `autoconnect_backend` parameter). An new `extra`
parameter has been added to a couple of parameters method for that: it can contain the
`ignore` key with a list of [category, name] of parameters to skip.
2020-01-25 21:08:40 +01:00
Goffi
7dd0df7f41 core, bridge: encryptionPluginsGet now returns a serialised list + added "directed" in metadata 2019-12-30 20:44:04 +01:00
Goffi
3ccd27de87 core (memory/sqlite): added before_uid filter to retrieve history before a message UID 2019-12-05 22:58:06 +01:00
Goffi
dbe0f1f012 bridge (embedded): typo 2019-11-15 17:57:49 +01:00
Goffi
93a4e488ea core: added imageCheck and imageResize methods:
imageCheck will give a report on image, notably it will tell if it's too big and needs to
be resized before a transfer.

imageResize will create a new image with the requested size and return a path to it.
2019-10-29 20:38:39 +01:00
Goffi
24aa7d2e38 bridge (pb): added missing _generic_errback 2019-10-21 23:06:30 +02:00
Goffi
92cb7ed130 bridge (dbus): AsyncIO version of D-Bus bridge:
The frontends D-Bus bridge has now an AIOBridge version which can be instantiated to use asyncio (the loop must be managed by frontends).
2019-10-01 22:49:10 +02:00
Goffi
5cee4fbab7 bridge (pb): implemented an asyncio compatible bridge:
`pb` bridge can now be used with asyncio by instantiating AIOBridge.
2019-09-25 08:53:38 +02:00
Goffi
fbfe96c505 Python 3 port:
/!\ this is a huge commit
/!\ starting from this commit, SàT is needs Python 3.6+
/!\ SàT maybe be instable or some feature may not work anymore, this will improve with time

This patch port backend, bridge and frontends to Python 3.

Roughly this has been done this way:

- 2to3 tools has been applied (with python 3.7)
- all references to python2 have been replaced with python3 (notably shebangs)
- fixed files not handled by 2to3 (notably the shell script)
- several manual fixes
- fixed issues reported by Python 3 that where not handled in Python 2
- replaced "async" with "async_" when needed (it's a reserved word from Python 3.7)
- replaced zope's "implements" with @implementer decorator
- temporary hack to handle data pickled in database, as str or bytes may be returned,
  to be checked later
- fixed hash comparison for password
- removed some code which is not needed anymore with Python 3
- deactivated some code which needs to be checked (notably certificate validation)
- tested with jp, fixed reported issues until some basic commands worked
- ported Primitivus (after porting dependencies like urwid satext)
- more manual fixes
2019-08-13 19:08:41 +02:00
Goffi
5a90f9d407 core, quick_frontend(app): fixed connected signal handling 2019-04-07 20:55:27 +02:00
Goffi
f51e924eb6 core: added a rosterResync method to bridge:
rosterResync do a full resynchronisation of roster with server. This should not be needed, but may be useful if user suspect a sync issue for whatever reason.
2019-04-07 18:49:41 +02:00
Goffi
3eeeb8040c core: added a "_debug" signal:
this signal is a generic debugging signal which can be implemented in frontends to do specific actions, like printing data dumps.
2019-03-10 18:04:01 +01:00
Goffi
a9311c530f bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
those methods stop and restart signals propagation, they are used on mobile OS when the frontend is paused.
2019-03-09 16:23:00 +01:00
Goffi
c90e0a7e6a bridge (pb): minor import order change 2019-02-28 18:57:28 +01:00
Goffi
8e338bf913 date update 2019-01-12 12:25:31 +01:00
Goffi
7a9ee35cfc misc: replaced all "dummy" by the more conventional and readable "__" ("_" being used for gettext) 2019-01-11 11:13:15 +01:00
Goffi
09020b7108 core (memory/encryption), plugin OTR: finished OTR integration in encryption:
- messageEncryptionStart and messageEncryptionStop are now async
- an encryption plugin can now have a startEncryption and endEncryption method, which are called automatically when suitable
- trust is now put in "trusted" key of message_data, and markAsTrusted has been added, it is used in OTR
- getTrustUI implemented for OTR, using legacy authenticate code
- catch potr.crypt.InvalidParameterError on decryption
- fixed some service OTR messages which were not correctly marked as not for storing, and thus were added to MAM archive/carbon copied
- other bug fixes
2019-01-03 21:00:00 +01:00
Goffi
24468a9138 core (memory/encryption): new encryptionNamespaceGet and encryptionTrustUIGet methods:
- encryptionNamespaceGet retrieves algorithm namespace from its short name
- encryptionTrustUIGet retrieves trust mangement XMLUI from encryption plugin
- new markAsUntrusted internal helper method, to add untrusted flag to message data
2019-01-02 18:22:30 +01:00
Goffi
a29893ac1f core: minor style/typos fixes 2018-12-01 10:04:17 +01:00
Goffi
e4bda681b8 core (memore/encryption): new methods and checks:
Following methods are now available though bridge:
    - messageEncryptionStop
    - messageEncryptionGet: retrieve encryption data for a message session
    - encryptionPluginsGet: retrieve all registered encryption plugin

Following methods are available for internal use:
    - getPlugins: retrieve registerd plugins
    - getNSFromName: retrieve namespace from plugin name
    - getBridgeData: serialise session data (to be used with bridge)
    - markAsEncrypted: mark message data as encrypted (to be set by encryption plugin in MessageReceived trigger)

Behaviours improvments:
    - start and stop send messageEncryptionStarted and messageEncryptionStopped signals, and a message feedback
    - new "replace" arguments in start allows to replace a plugin if one is already running (instead of raising a ConflictError)
    - plugins declare themselves as "directed" (i.e. working with only one device at a time) or not.
      This is checked while dealing with jids, an exception is raised when a full jid is received for a non directed encryption.
    - use of new data_format (de)serialise
2018-08-11 18:24:55 +02:00
Goffi
64d502958f core (bridge): new messageEncryptionStarted and messageEncryptionStopped signals (not used yet) 2018-08-11 18:24:55 +02:00
Goffi
32b4db60c9 core: new EncryptionHandler class which manage encrypted session as a core feature:
Plugin handling encryption can now register using host.registerEncryptionPlugin, and an encryption session can now be started using messageEncryptionStart bridge method.

This will make encryption handling more easy, as we now know if a session is clear or e2e encrypted, and which plugin handle it.
2018-07-29 19:22:56 +02:00
Goffi
f2b1398a9f core, frontends: replaced org\.goffi namespaces by org.salutatoi + fixed generation:
generation of D-Bus bridge has been broken by black formatting tool, this patch fixes this.
2018-07-01 20:37:58 +02:00
Goffi
744cb0c503 code style reformatting using black 2018-06-27 20:14:46 +02:00
Goffi
b0a63edd9c core: added local_device argument to discoFindByFeatures 2018-05-25 10:52:01 +02:00
Goffi
80ef13612b core, setup: huge cleaning:
- moved directories from src and frontends/src to sat and sat_frontends, which is the recommanded naming convention
- move twisted directory to root
- removed all hacks from setup.py, and added missing dependencies, it is now clean
- use https URL for website in setup.py
- removed "Environment :: X11 Applications :: GTK", as wix is deprecated and removed
- renamed sat.sh to sat and fixed its installation
- added python_requires to specify Python version needed
- replaced glib2reactor which use deprecated code by gtk3reactor

sat can now be installed directly from virtualenv without using --system-site-packages anymore \o/
2018-04-02 19:44:50 +02:00