Commit graph libervia-backend/sat/memory
Author SHA1 Message Date
Goffi
5e43c6c98c core, plugin XEP-0045: fixed message type autodetection + ENTITY_TYPE_MUC constant:
an old hardcoded value was used in several places to detect if an entity is a MUC, but this
value was not valid anymore. This has been fixed, and ENTITY_TYPE_MUC constant is now used
instead. This fixes message type autodetection for "groupchat" messages.

fixes 300
2019-07-09 09:06:45 +02:00
Goffi
59faac55fe memory (sqlite): fixed order for last_stanza_id:
"last_stanza_id" filter was ordered by "received_timestamp" instead of "timestamp", resulting in wrong message being used (and a bad MAM request).
2019-07-06 15:50:55 +02:00
Goffi
c05c65b1b3 memory (sqlite): exit with an error if current db version is higher than version expected in current code 2019-06-21 12:59:36 +02:00
Goffi
80da9a6591 core (memory, memory/sqlite): implemented fileDelete 2019-04-28 08:55:13 +02:00
Goffi
cad0d4b0e2 core (memory): raise PermissionError directly instead of using failureFailure, as it could not be catched correctly in every case. 2019-04-28 08:55:13 +02:00
Goffi
a46dda1e12 memory: minor style change 2019-04-26 11:57:26 +02:00
Goffi
98098105e7 memory (sqlite): minor log improvment 2019-04-26 11:57:26 +02:00
Goffi
621c6b3ffa memory (sqlite): fixed fileUpdate when original value is not set (NULL) 2019-04-26 11:57:26 +02:00
Goffi
5e2426c065 core (memory), plugin XEP-0329, plugin invitation: minor style improvments 2019-04-14 08:21:51 +02:00
Goffi
4701027950 memory (sqlite): cast timestamp_start filter to float instead of int 2019-04-07 20:57:13 +02:00
Goffi
8adba38036 core (memory/persistent): added clear method + initialise with a dict:
A "clear" method has been added to delete all data for a specific namespace (and profile).
Internal cache (self._cache) is not initialised with an empty dict instead of None to allow using methods like __setitem__ or clear without having to do a potentially expansive `load()` before. The only counterpart is that we won't have an exception anymore if developer forget to load() data before using them, which can make debugging a bit more difficult.
2019-04-07 18:44:57 +02:00
Goffi
aac5e58ec6 core (memory/sqlite): display arguments in logs in case of too many db/interaction tries 2019-04-07 18:38:18 +02:00
Goffi
8830a7c1d5 core (memory/sqlite): added a "timestamp_start" filter to retrieve history from a specific point in time 2019-03-09 16:24:15 +01:00
Goffi
8ae596600d core (disco): added missing disco extensions when generating the cap hash. 2019-03-01 19:28:11 +01:00
Goffi
d8f6620d00 core: added a base menu allowing to set encryption session or show the trust management UI. 2019-02-24 14:11:08 +01:00
Goffi
d159b9fb49 memory (sqlite): optimizations
indexes were missing on foreign keys for "message", "subject" and "thread" tables, seriously impacting performances.
In addition to those indexes, two indexes have been added to speed ordering by timestamp on "history", and one on "files" table.
history.rowid is not used anymore as there is an index on (profile_id, received_timestamp) which will speed up the query.
Primary keys order has been changed to use automatic index in most common cases (filtering by profile_id then namespace).
2019-01-19 22:49:32 +01:00
Goffi
8e338bf913 date update 2019-01-12 12:25:31 +01:00
Goffi
180b4790bf core (disco): client.disco.requestInfo failure are re-raised:
so far, requestInfo failure where logged as a warning, and an empty disco was returned.
This prevented the requesting entity to know about the error, so now the error is logged and re-raised.
CancelError are converted to TimeoutError (requestInfo is only cancelled on timeout).
An empty disco is still cached in case of failure, to avoid re-waiting for the entity on next request.
2019-01-11 19:48:20 +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
02dc38762e core (constants): added a constant for "encrypted" 2019-01-04 18:46:02 +01:00
Goffi
9ad238b884 core (memory/encryption): added getNamespaces method to retrieve all plugins namespaces 2019-01-04 11:14:17 +01:00
Goffi
ccfdb695bc memory (sqlite): minor comment move 2019-01-04 09:26:57 +01:00
Goffi
610e88841a memory (sqlite): retry _runInteraction in the same way as for _runQuery, this improve reliability 2019-01-04 09:21:16 +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
6e38be1dab core (memory/sqlite): new delPrivateNamespace method to delete all data of a specific namespace for a profile. 2019-01-02 18:25:55 +01:00
Goffi
c87e9a23e3 core (memory/persistent): new LazyPersistentBinaryDict.remove method 2019-01-02 18:24:14 +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
0e70587857 core (memory/sqlite): further improvments in update_v7:
- "info" messages deletion is now done by deactivating foreign keys. This seriously boost performances.
- "VACUUM" is done at the end to reduce database size.
2018-12-12 00:53:14 +01:00
Goffi
82d16029b8 core (memory/sqlite): fixed v7 update performance issue:
Performance issue was due to bad ordering in table dropping, this has been fixed.
"infos" message are also deleted by this update as they are containing only presence data and take a lot of space for a barely useful data.
A config option may be available in the future to store presence data in logs.
2018-12-11 23:53:27 +01:00
Goffi
51bc3411ba core (memory/sqlite): do not call commitStatements if there is nothing to commit in checkUpdates 2018-12-10 21:06:20 +01:00
Goffi
c2d7c3e69e core (memory/sqlite): changed history constraint
/!\ Database schema change /!\
History was using a unique constraint on `profile_id, timestamp, source, dest, source_res, dest_res`, which can cause trouble because several messages send quickly by the same person can have a common timestamp (specially with delayed messages where precision is second), resulting in message loss.
The new constraint use `profile_id, stanza_id, source, dest` where `stanza_id` is XEP-0359 stanza_id, so it's unique by definition, and no message should be lost anymore.
Because sqlite doesn't support altering table with a constraint change, we have to create new tables and copy old data to new one, which can be pretty long.
Sqlite update mechanism with "specifics" has been fixed when several updates are applied (e.g. moving from v5 to v7) and a specific is in the workflow.
2018-12-09 14:07:26 +01:00
Goffi
35e15c664c plugin XEP-0045: MAM implementation for MUC 2018-12-07 19:13:28 +01:00
Goffi
13cfba0f8a core (memory/disco): normalise booleans in extensions 2018-12-01 14:40:32 +01:00
Goffi
a245e32391 core (memory/sqlite): skip a line before debug log showing statements 2018-12-01 14:39:35 +01:00
Goffi
0b8e750956 core (memory/sqlite): added stanza_id:
/!\ database schema change /!\
stanza_id is a new field in history added to prepare the implementation of MAM for messages.
A new "last_stanza_id" can be used in filters to retrieve last message with a know stanza id (useful for history synchronisation).
2018-12-01 10:08:17 +01:00
Goffi
a29893ac1f core: minor style/typos fixes 2018-12-01 10:04:17 +01:00
Goffi
1b8345f4af core (xmpp): server certificate validation:
XMPP server certificate is now checked, and connection is refused (by default) if it's not valid.
Certificate check can be disabled in the new parameter "Configuration/check_certificate".
If certificate checking is disabled, a warning note is sent on every new connection.
Twisted and Wokkel are temporarly monkey patched in sat.core.tls_patches module, until modifications are merged upstream.
2018-11-10 10:16:35 +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
48427e3bdd core (memory/encryption): start improvments, stop and getSession:
- "start" won't do anything if session is already encrypted with requested algorithm, and will raise a ConflictError if it's already encrypted but with an other algorithm
- implemented "stop", with an optional namespace to check we are stopping the expected algorithm
- "getSession" retrieve the current encryption session of a jid, if any
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
34a6d18475 core (memory/persistent): better default value handling in LazyPersistentBinaryDict (don't jump to debugger in debug mode if value is not found) 2018-07-29 18:44:49 +02:00
Goffi
744cb0c503 code style reformatting using black 2018-06-27 20:14:46 +02:00
Goffi
4d4d594c60 core: discoFindByFeatures now return only available resources 2018-05-25 10:52:01 +02:00
Goffi
c0e2a4f84b core (disco): fixed disco capabilities (empty disco was used) 2018-05-22 09:59:58 +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