Commit graph

3,231 commits

Author SHA1 Message Date
Goffi
2f8902e0d6 core (memory/encryption): automatic start encryption if peer send encrypted message:
If peer sends encrypted message and we have no encryption activated, we automatically
start encryption to avoid sending plain text message when answering.

markAsEncrypted now needs the encryption algorithm namespace as mandatory argument.
2020-03-23 17:52:18 +01:00
Goffi
a6e4d1d33f changelog: update 2020-03-23 16:55:15 +01:00
Goffi
741bd88a19 quick frontend (chat): added encrypted property 2020-03-23 16:53:29 +01:00
Goffi
8e9905363e core (memory/encryption): set encrypted flag also for outgoing messages and put it in extra:
- `encrypted` flag is now put directly in extra, so that there is nothing to change when
  sending the message to bridge for frontends to be aware of it.
- this flag is now also set when markAsEncrypted is used, so frontend can display
  appropriate indicator to show that outgoing message is encrypted or not.
2020-03-23 16:53:03 +01:00
Goffi
70600d62f3 changelog: update 2020-03-22 18:47:59 +01:00
Goffi
900daa7ad9 core (memory/encryption): encryption session are now restored on client connection 2020-03-22 18:39:12 +01:00
Goffi
e754d16000 core (memory/persistent): implemented aset and adel:
those methods are async variants of __setitem__ and __delitem__, they return a Deferred
fired when the value is actually set/removed from storage.
2020-03-22 18:35:22 +01:00
Goffi
f7b91d3d91 core (xmpp): use async corouting for startConnection 2020-03-22 14:31:48 +01:00
Goffi
ddf8cf6ea7 plugin attach: handle large images resizing:
if `C.MESS_KEY_ATTACHMENTS_RESIZE` flag is set for an attachment, it will be checked, and
if it is a large image, a resized copy will be uploaded.
2020-03-22 14:04:16 +01:00
Goffi
cdf468a7c1 plugin aesgcm: wait for each splitted message to be sent before sending next one 2020-03-22 14:01:47 +01:00
Goffi
be95a78a7c core (xmpp): fixed workflow with post_xml_treatments in sendMessage:
post_xml_treatments was incorrectly added to workflow using chainDeferred (which only
add the callback, so post_xml_treatments own callbacks were not waited). As a result,
plugins callback could not be waited as expected before a message was sent.

This patch fixes it by not using chainDeferred anymore.
2020-03-22 13:59:19 +01:00
Goffi
8a0aba8511 tools (images): methods renaming 2020-03-22 12:52:43 +01:00
Goffi
06516eeb1d plugin attach, aesgcm: attachments refactoring:
attachment handling has been simplified, and now use a "register" method similar as the
ones used for download or upload.
A default method (for unencrypted messages) will try a simple upload and will copy the
links to body.

AESGCM plugin has been adapted to be used for encrypted files. If more than one file is
sent with AESGCM plugin, they will be split in several messages as current de-facto
standard (OMEMO media sharing) doesn't support several files per message.
2020-03-18 20:25:02 +01:00
Goffi
4ccd859b62 plugin XEP-0384: added "/omemo_reset" text command:
this command will delete all sessions with peer entity, and send empty message to trigger
a new key exchange.
2020-03-18 19:56:05 +01:00
Goffi
a56fc64ea5 core (memory/encryption): namespace can now be specified to test a specific algorithm in isEncryptionRequested 2020-03-18 19:54:07 +01:00
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
31e9cc7cbf core (tools/utils): new asDeferred function:
asDeferred is similar to defer.maybeCoroutine, and also handles coroutine.
2020-03-13 17:46:27 +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
e0a5e96b16 jp (xmlui): added missing disp method in XMLUIPanel 2020-03-06 18:51:04 +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
46a8728d7c core (memory/cache): new removeFromCache method 2020-03-06 18:19:03 +01:00
Goffi
4b69d89138 core (memory/cache): purge cache metadata when the referenced file doesn't exist 2020-03-06 18:19:03 +01:00
Goffi
5e4e10e690 bridge (constructor/dbus): typo 2020-03-06 18:19:03 +01:00
Goffi
dced27f328 jp(info): devices command first draft:
this command gather data on known devices of an entity.
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
1883dbd3ab plugin download, aesgcm: disable TLS check if check_certificate setting is disabled 2020-03-06 18:19:03 +01:00
Goffi
d0df1d8aeb quick frontend(app): new QuickApp.profileConnected method 2020-03-06 18:19:03 +01:00
Goffi
f7360d31e2 core (xmpp): isConnected now returns True when full connection is done:
isConnected was returning True as soon as transport was connected. It is now returning
True only if full connection is done (i.e. transport is connected + all plugins have been
initialised).
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
3686d7e036 core, bridge: new imageGeneratePreview helped method to generate a thumbnail 2020-03-01 18:48:06 +01:00
Goffi
8777bd07cb tools (images): max_size can now be manually specified in checkImage and dest in resizeImage:
`context` has been removed as it is not used and doesn't seem that useful.
2020-03-01 18:47:05 +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
dfbdf8e455 core (memory/cache): added some metadata:
- creation/last_access are now set
- use filename to guess MIME type when suitable
2020-03-01 18:31:45 +01:00
Goffi
e2a5f7394e core (xmpp): check that entity_jid is actually a jid in SatRosterProtocol.isJidInRoster 2020-03-01 18:29:46 +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
fd1cc3dd40 changelog: update 2020-02-28 18:10:58 +01:00
Goffi
a1dc5a5c06 core (memory/disco): minor log message change 2020-02-28 10:06:38 +01:00
Goffi
94fccd1176 quick frontend (app): avoid crash when a listener is removed while being called 2020-02-28 10:06:38 +01:00
Goffi
5a9886d390 plugin attach: disable TLS check if "check_certificate" is disabled 2020-02-28 10:06:23 +01:00
Goffi
9de55ff588 memory (sqlite): don't store empty messages 2020-02-26 22:03:15 +01:00
Goffi
bd490c1d19 primitivus (chat) Q&D way to see attachments 2020-02-26 22:03:15 +01:00
Goffi
65dd411a2b quick frontend(contact list): new "isInRoster" method 2020-02-26 22:03:15 +01:00
Goffi
48c56ee57e memory(cache): extend EOL when a file metadata is retrieved 2020-02-26 22:03:15 +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
b0c3d4d8ac core (xmpp): use pathlib.Path to complete attachments names, and use name to guess type 2020-02-26 15:54:34 +01:00
Goffi
1ba18cc1fa core (xmpp): complete attachments for sent attachments:
sent attachments are stored and sent back to frontends, so it is necessary to complete
them in the same way as incoming attachments.
2020-02-23 17:49:21 +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