Commit graph libervia-backend/sat/plugins
Author SHA1 Message Date
Goffi
f7fb2dd238 plugin text commands: handles coroutines + better command parsing:
- async coroutine can now be used for text commands (in addition to Deferred and regular
  callbacks)
- isidentifier is now used to detect a command, allowing to use "_" in command names
- if message starts with a single `/`, it is never sent (previously it could be sent is
  some corner cases)
- don't use OrderedDict anymore as dict now keep insertion order by default
2020-03-13 17:50:08 +01:00
Goffi
1faa5e82da plugin XEP-0384: use "max_items=1" for devices and bundles nodes:
- max_items = 1 is requested with publish-options when publishing the bundle or the
  devices list. If the constraint is failed, a warning will be shown, and the publication
  will be done without this option
- fixed return values when devices list is badly formed
2020-03-11 20:44:49 +01:00
Goffi
d1abda6ddb plugin XEP-0060: async sendItems + precondition-not-met policy:
- sendItems is now an "async" coroutine, and sendItem use it instead of duplicating
  publication logic
- policy to use when a precondition is not met (with publish-options) can now be
  specified, for now it's either raise the exception (default policy), or try to publish
  without the options
- constants have been added to handle "extra" keys
2020-03-11 19:15:48 +01:00
Goffi
0ce6d6d841 plugin download: clean unfinished files and re-raise exception in case of download error 2020-03-06 18:19:03 +01:00
Goffi
1883dbd3ab plugin download, aesgcm: disable TLS check if check_certificate setting is disabled 2020-03-06 18:19:03 +01:00
Goffi
4c474efb3d plugin attachment: remove "path" from attachment once used:
"path" refers to a local path of a file, we don't want to store it in database as the file
may be in a temporary location, or even be a temporary file. So once the file has been
uploaded, we remove it.
2020-03-06 18:19:03 +01:00
Goffi
143dd9bc0a plugin XEP-0054: fixed use of current dir instead of empty string 2020-03-01 18:33:16 +01:00
Goffi
7924b601ab core (constants): renamed MESS_KEY_MEDIA_TYPE to MESS_KEY_ATTACHMENTS_MEDIA_TYPE 2020-02-29 16:55:22 +01:00
Goffi
5a9886d390 plugin attach: disable TLS check if "check_certificate" is disabled 2020-02-28 10:06:23 +01:00
Goffi
f71b40f86f plugin download: use cache if dest_path is empty:
if dest_path is not set, the file will be downloaded in cache. A new name will be
generated using a hash of the uri. If the file is already downloded in cache, it won't be
downloaded again (in this case returned progress_id is an empty string).
2020-02-26 22:03:11 +01:00
Goffi
c16dd25fc9 plugin download, aesgcm: fixed handling of HTTP errors 2020-02-26 15:54:43 +01:00
Goffi
12fc57062d memory (cache): purge + pathlib:
- cache is now purged on backend startup (every file which has passed EOL will be deleted)
- use of pathlib, getPath now returns a Path
2020-02-26 15:54:43 +01:00
Goffi
c5915d1dcb plugin attach, XEP-0363: progress id can now be specified:
progress id can be specified in options, using the "progress_id" option, this can be
more handy for frontends to keep track of attachments progresses.
2020-02-23 17:48:26 +01:00
Goffi
3b730721eb plugin attach: first draft:
this plugin handles the uploading of files attached in message data.
2020-02-23 17:48:26 +01:00
Goffi
a194874638 bridge: messageSend's extra is now serialised 2020-02-21 12:17:38 +01:00
Goffi
74a60a2e5b plugin aesgcm: use 12 bytes Initialisation Vector:
SàT was using 16 bytes IV when sending files withr AES-GCM, due to ChatSecure being only
compatible with that. Monal, an other iOS client is only compatible with 12 bytes IV, and
ChatSecure has fixed its code to also handle 12 bytes IV, so there is not reason anymore
to use 16 bytes, and SàT now uses 12 bytes.
2020-02-18 18:17:18 +01:00
Goffi
5538b52f25 plugin aesgcm: look for "aesgcm" links in body to use them as attachments 2020-02-18 18:17:18 +01:00
Goffi
3b64263f3b core: renamed "MessageReceived" trigger to "messageReceived" for consistency. 2020-02-18 18:13:19 +01:00
Goffi
104902f076 core (xmpp), plugin android: fixed DNS, SRV handling on Android:
Android doesn't have a "/etc/resolv.conf" that Twisted expect. As a result, SRV records
can't be checked correctly on connection.

To work around that, DNS servers used on Android are checked when necessary (on Android
plugin startup and on connectivity change), using some hacks, and Twisted is patched to
use them.
2020-02-09 23:56:42 +01:00
Goffi
d0741de2ad core (memory/crypto): replaced PyCrypto by cryptography:
`PyCrypto` is unmaintained for years but was used in SàT for password hashing. This patch
fixes that by replacing `PyCrypto` by the reference `cryptography` module which is well
maintained.

The behaviour stays the same (except that previously async `hash`, `encrypt` and `decrypt`
methods are now synchronous, as they are quick and using a deferToThread may actually be
more resource intensive than using blocking methods).

It is planed to improve `memory.crypto` by using more up-to-date cryptography/hashing
algorithms in the future.

PyCrypto is no more a dependency of SàT
2020-02-09 23:50:26 +01:00
Goffi
d75bbaec4c core (memory/disco): fixed checkFeature return Failure:
it seems that instanciating a Failure with a class name is not working anymore, so the
exceptions.FeatureNotFound is instanciated now.
2020-02-04 19:59:42 +01:00
Goffi
ef1cd09c14 plugin XEP-0363: fixed errback args in fileHTTPUpload 2020-02-04 18:24:15 +01:00
Goffi
120289f08f plugin android: attach an action dict to notification:
instead of calling plyer's generic notify, AndroidNotification is now inherited to add a
SàT specific behaviour: a "sat_action" dictionary is now attached, to indicate to the
frontend what to do when the notification is opened.
2020-02-03 13:49:45 +01:00
Goffi
c00fe7f1e6 plugin XEP-0384: fixed exception catching on getItems 2020-01-29 18:31:47 +01:00
Goffi
8937201eed plugin XEP-0280: handle CCed messages without "to" 2020-01-29 17:39:00 +01:00
Goffi
53cc1f1bac core: fixed findByFeatures:
jids where not correctly put in `found_own` and `found_roster` lists.
2020-01-29 12:38:48 +01:00
Goffi
b1edf2198c plugin XEP-0198: minor log formatting 2020-01-29 11:19:47 +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
4eeb1ef3e8 plugin manhole: added d to namespace as shortcut for defer.ensureDeferred 2020-01-28 22:27:42 +01:00
Goffi
8252c15beb plugin XEP-0198: don't crash when xmlstream has been closed 2020-01-28 22:26:12 +01:00
Goffi
655361db1b plugin ip: fixed IP detection with external website 2020-01-27 19:53:31 +01:00
Goffi
b5303be035 plugin XEP-0184: show a warning and the message XML on missing id 2020-01-27 19:53:31 +01:00
Goffi
764e247a0a plugin manhole: added "C" to namespace 2020-01-26 18:08:10 +01:00
Goffi
c951c67698 plugin android: reconnect profiles with autoconnect if network is activated:
if network is activated, we check that all profiles with autoconnect are indeed connected,
and reconnect them if necesssary.
2020-01-26 18:08:09 +01:00
Goffi
a485709173 plugin android: added a profileAutoconnectGet method:
this method will be called by frontend to know which profile to connect automatically
(when the frontend has been closed and is reopened, this will avoid to have to go through
the profileManager again).
2020-01-25 21:08:41 +01:00
Goffi
1d91db6f2c core: backend autoconnection:
A new Connection/autoconnect_backend param can be set for a profile or component to be
started automatically with backend. This is specially useful for components, but can be
useful for client profile too (e.g. on Android we need to start profile with backend to
get notifications, this part will come with following commits).

The new Sqlite.getIndParamValues method allows to retrieve the same parameters for all
profiles.
2020-01-25 21:08:32 +01:00
Goffi
9dc875550c quick frontend (app): call getReady once connected to bridge:
namespaces and encryption plugins are only retrieved once backend is ready, else they may
not yet be available (can happen notably when the backend is start at the same time as the
frontend, e.g. on Android).
2020-01-25 21:08:26 +01:00
Goffi
2555649dfb plugin android: sound notification + change settings:
- new notification sound
- vibration and notification sound are now activated depending on ringer mode (normal,
  vibrate or silent)
- notification sound/vibration can be configured in settings.
2020-01-03 13:21:27 +01:00
Goffi
b5af781b82 plugin XEP-0384: OMEMO for MUC implementation:
- encryption is now allowed for group chats
- when an encryption is requested for a MUC, real jids or all occupants are used to
  encrypt the message
- a cache for plain text message sent to MUC is used, because for security reason we can't
  encrypt message for our own device with OMEMO (that would prevent ratchet and break the
  prefect forward secrecy). Thus, message sent in MUC are cached for 5 min, and the
  decrypted version is used when found. We don't send immediately the plain text message
  to frontends and history because we want to keep the same MUC behaviour as for plain
  text, and receiving a message means that it was received and sent back by MUC service
- <origin-id> is used to identify messages sent by our device
- a feedback_jid is now use to use correct entity for feedback message in case of problem:
  with a room we have to send feedback message to the room and not the the emitter
- encryptMessage now only accepts list in the renamed "entity_bare_jids" argument
2019-12-30 20:59:46 +01:00
Goffi
a1ee6fedc1 plugin XEP-0359: handle origin-id 2019-12-30 20:44:05 +01:00
Goffi
efe52d755d plugin XEP-0045: added room statuses to metadata:
room statuses are now sent with other metadata on bridge signals, and saved in Room
instance. They give useful data on the room, for instance they can be used to know if a
full jid is used in this room.
2019-12-30 20:44:02 +01:00
Goffi
b7a74d5034 plugin XEP-0060, jp (pubsub/set): publish-options implementation:
- publishing options (XEP-0060 §7.1.5) implementation.
- jp pubsub/set can specify publish-options using `-f` and `-F`
- doc has been updated to explain that
- psItemSend and psItemsSend now use serialisation for "extra"
- publish-options can be specified in extra['publish-options'] with those methods
2019-12-28 20:02:18 +01:00
Goffi
bca7453ee1 plugin XEP-0384: typo 2019-12-20 14:26:05 +01:00
Goffi
3e07cd6c01 plugin android: removed comment on vibrator bug as it is fixed in dev version of plyer 2019-12-20 12:28:04 +01:00
Goffi
f9a034509c plugin sec aesgcm: new plugin handling aesgcm: scheme for e2e encrypted media sharing:
The scheme is register with download meta plugin, and it is activated with HTTP Upload
(XEP-0363) when `encryption` is used in `options` with the value of C.ENC_AES_GCM.
This is also known as `OMEMO Media Sharing` even if this method is not directly linked to
OMEMO and can be used independently.
2019-12-20 12:28:04 +01:00
Goffi
edbee4d719 plugin upload, XEP-0363: code modernisation + preparation for extension:
- use of async/await syntax
- fileUpload's options are now serialised, allowing non string values
- (XEP-0363) Slot is now a dataclass, so it can be modified by other plugins
- (XEP-0363) Moved SSL related code to the new tools.web module
- (XEP-0363) added `XEP-0363_upload_size` and `XEP-0363_upload` trigger points
- a Deferred is not used anymore for `progress_id`, the value is directly returned
2019-12-20 12:28:04 +01:00
Goffi
dfed376f62 plugin file download: meta plugin to handle file download:
- first code in backend to use async/await Python syntax \o/
- plugin with file upload
- URL schemes can be registered
- `http` and `https` schemes are handled by default
2019-12-20 12:28:04 +01:00
Goffi
26c01ca4dc plugin XEP-0045: show join error even if it's not a StanzaError, log it with warning instead of error 2019-12-20 12:28:04 +01:00
Goffi
a300181a01 plugin XEP-0384: update to latest python-omemo + better trust management:
- python-omemo minimal version is now 0.11.0
- `undecided` devices are now handled, fixing the "accept all or none" issue: if a device
  is `undecided`, the trust manager will be shown with the missing devices before sending
  the message.
- `untrusted` devices are discarded
2019-12-20 12:28:01 +01:00