Commit graph libervia-backend/sat/core
Author SHA1 Message Date
Goffi
e85c55f7a0 core (config): if flatpak is detected, config is also looked after in /app 2019-06-23 17:40:19 +02:00
Goffi
a090b76afd core (constants): added generic constants for "info", "warning" and "error" levels 2019-05-26 22:22:01 +02:00
Goffi
a782b6e6e0 core (constants): "on" can now be used as True value in bool method. 2019-05-26 22:22:00 +02:00
Goffi
c3fcfb3d64 core: fixed component connexion:
presence announcement has been moved to startConnection, but component don't have presence. This patch fixes it by moving presence announcement to clients only.
2019-04-14 08:21:51 +02:00
Goffi
553ebe5ab8 core: added getNamespace method to retrieve a namespace from short name. 2019-04-14 08:21:51 +02:00
Goffi
1f7d5bfd94 constants: added KEY_LANG which is the key/name used in templates to change language/locale. 2019-04-10 21:04:51 +02:00
Goffi
4d64efcda9 code (xmpp): store version after roster item update + fix item removal:
roster version is now stored after roster item has been added or removed. This way if something interrupting the process happens, former item update will be received and roster should be updated correctly.

Roster item removal was crashing because `load()` is not used (local PersistentDict cache is then not updated, and the key to remove is missing there). The exception is now catched and ignored to avoid loading the data only to remove an item.
2019-04-10 21:04: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
5ceffc1491 core (xmpp): implemented roster versioning 2019-04-07 18:47:17 +02:00
Goffi
c2c7dbddfe core (xmpp): new networkEnabled() and networkDisabled() methods:
those methods can be called by platform specific plugins when network is known to be (un)available. This way, connection attempts can be cancelled when no network is available, saving resources (notably battery on mobile devices), or attempts can be restarted immediately when network is known to be available again.
2019-04-06 19:05:57 +02:00
Goffi
5b3aa5c60f core (xmpp): advanced handling of connection termination
factory's clientConnectionFailed and clientConnectionLost methods are monkey patched to allow client to tune termination:
    - a warning when connection is lost in an unclean way
    - connector is saved to allow to disable automatic reconnection and retry manually later
    - new triggers connection_failed and connection_lost allow plugins to tune connection termination workflow
2019-04-06 18:51:20 +02:00
Goffi
9186fd1a3c core (xmpp): use the cleaner stopTrying() instead of setting continueTrying = 0 when connection is not possible due to invalid certificate. 2019-04-05 21:22:05 +02:00
Goffi
1a958d8744 core: minor style improvments 2019-03-27 21:15:25 +01:00
Goffi
e89135b8ae plugin XEP-0384: give feedback to client when encryption failed 2019-03-20 09:08:47 +01:00
Goffi
04f485057b core (log): add traceback when "exc_info" is set 2019-03-03 12:04:55 +01:00
Goffi
6033a0a0cb core: renamed presenceReceived to presence_reveiced + use "client" as first arguments instead of "profile" 2019-03-01 12:12:50 +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
2e4f4069c5 core (patches): partially fixed jid caching:
jid caching in Twisted use a dict (__internJIDs) which associate a jid as string to its jid.JID instance.
But this caching doesn't handle mutability of the objects, resulting wrong jid returned when a modification is done (e.g. if resource is changed).
This is a temporary workaround until the patch is proposed and merged upstream.

note: this is a partial fix because the caching is also leaking memory (cf. https://twistedmatrix.com/trac/ticket/5122)
2019-02-24 14:09:44 +01:00
Goffi
198db6c2ca plugin XEP-0045: fixed crash when <delay> is used at an unexpected time. 2019-01-26 20:07:45 +01:00
Goffi
8a59034935 plugin mr mercurial, tools(common/utils): moved command protocol to a new module 2019-01-25 09:06:29 +01:00
Goffi
51cd3ce52a core (findByFeatures): fixed services discovery 2019-01-20 18:20:55 +01:00
Goffi
e2ab5e33c8 core, XEP-0315: move XML element handling to sat_tmp:
XML Element is now implemented in sat_tmp, so it can be available also for SàT Pubsub.
The XEP-0315 is thus not needed anymore and have been removed, XEP-0315 namespace has been added to base disco features.
Use the new install() function of sat_tmp to do the patching.
2019-01-16 09:18:16 +01:00
Goffi
8e338bf913 date update 2019-01-12 12:25:31 +01:00
Goffi
c5a17cc9ef core: findByFeatures speed improvments:
- DeferredList are used instead of waiting for each disco individually
- a Timeout of 10 s is set for jids, to avoid waiting for minutes when some entity is unreachable (which leads to terrible user experience while waiting for a discovery page)
2019-01-11 19:44:46 +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
3e63d54e3d plugins XEP-0060, XEP-0313: implemented Order-By protoXEP:
new "order_by" key can be used in extra data, value can be, for now, "creation" or "modification".
2019-01-06 17:36:51 +01:00
Goffi
02dc38762e core (constants): added a constant for "encrypted" 2019-01-04 18:46:02 +01:00
Goffi
ed0312261e core (xmpp): don't add to history a message if there is no message and no subject. 2019-01-04 18:44:43 +01:00
Goffi
1307adcd71 core (xmpp): added "extra" argument to client.feedback 2019-01-04 11:13:31 +01:00
Goffi
e5e0913aec core (xmpp): implemented human friendly __unicode__ for client 2019-01-03 20:51:08 +01:00
Goffi
c2a1ba3793 core (xmpp): don't send message without message or subject to bridge (and log a warning in frontends if such a message is received) 2019-01-02 18:28:30 +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
93a73aec45 core (log): fixed double call to ansiColors 2018-12-27 11:40:04 +01:00
Goffi
97d655682c core (xmpp): set "to" attribute to <message> element when it's missing:
when missing, profile's full jid is used as "to" attribute. This way, "to" attribute can be retrieved later without having to check if it has been set or not.
2018-12-27 11:40:04 +01:00
Goffi
35e15c664c plugin XEP-0045: MAM implementation for MUC 2018-12-07 19:13:28 +01:00
Goffi
7e79203fa0 core (xmpp): check <message> namespace in parseMessage, and accept empty namespace (happen with Wokkel) 2018-12-07 17:46:50 +01:00
Goffi
39d2409273 plugin XEP-0313: implementation of MAM for messages:
- (core/xmpp): new messageGetBridgeArgs to easily retrieve arguments used in bridge from message data
-            : parseMessage is not static anymore
-            : new "message_parse" trigger point
- (xep-0313) : new "MAMGet" bridge method to retrieve history from MAM instead of local one
-            : on profileConnected, if previous MAM message is found (i.e. message with a stanza_id), message received while offline are retrieved and injected in message workflow.
               In other words, one2one history is synchronised on connection.
-            : new "parseExtra" method which parse MAM (and optionally RSM) option from extra dictionary used in bridge.
2018-12-01 10:33:43 +01:00
Goffi
ed049c7a9d core: removed whitespace ping (not needed anymore as we handle XMPP ping) 2018-11-19 21:08:25 +01:00
Goffi
a8922b0e46 core (xmpp): added NS_X_DATA to disco features 2018-11-18 15:49:59 +01:00
Goffi
05b59775d0 plugin XEP-0198: Stream Management implementation:
- hooks can now be set in stream onElement and send methods
- xmllog refactored to use new hooks
- client.isConnected now uses transport.connected method
- fixed reconnection, SàT will now try to reconnect indefinitely until it success, unresolvable failure happen (e.g. invalid certificate), or explicit disconnection is requested (or a plugin change this behaviour)
- new triggers: "stream_hooks", "disconnecting", "disconnected", and "xml_init" (replace "XML Initialized")
2018-11-18 15:49:46 +01:00
Goffi
3a07122da9 plugin XEP-0199: implementation of XMPP Ping 2018-11-10 10:16:38 +01:00
Goffi
d590de6373 core (xmpp): added missing disco#info namespace to disco info result. 2018-11-10 10:16:38 +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
18a4d3d544 core: fixed package name for Android 2018-10-05 13:42:06 +02:00
Goffi
da424c4440 core (exceptions): new ConfigError exception 2018-09-18 20:53:50 +02:00
Goffi
e70405cfc2 tools (common/template), jp: refactoring to handle multiple sites:
- site can now be specified in template header before theme, for instance: (some_site/some_theme)path/to/template.ext
- absolute template paths are now implemented, but Renderer must be instanciated with trusted to True for security reason (it's the case for jp)
- a new "front_url_filter" callable can be given to Renderer, which will convert template path to URL seen by end-user (default to real path).
- the "front_url_filter" can be used in templates with… "front_url" filter
- template_data is a new named tuple available in templates, which give site, theme and template relative URL
- search order is site/theme, site/default_theme, and default/default_theme where default link to sat_pubsub templates
- when loading CSS files, files with _noscript suffixes are now loaded, and used when javascript is not available
- "styles_extra.css" is also loaded before "styles.css", useful when a theme want to reuse default style, and just override some rules
- new site can be specified in sat.conf [DEFAULT] section, using sites_path_public_dict or sites_path_private_dict (where sites_path_private_dict won't be used in public frontends, like Libervia)
- "private" argument of Renderer tells the renderer to load private sites or not
- templates are now loaded from "templates" subdirectory, to differenciate them from other data like i18n
- jp template output has been updated to handle those changes, and to manage absolute templates
2018-09-10 08:58:18 +02:00
Goffi
8792a16337 core: findByFeatures fixes 2018-08-31 15:29:25 +02:00
Goffi
f1cbf0659e core (xmpp): send initial presence only after all profileConnected have been treated:
presence is now sent after profileConnected methods are done, this avoid to have to deal with synchronisation in connection event.
For instance, PEP events should not be sent before presence is sent, so profileConnected methods can assume PEP events are not
done yet, and do needed initialisation using async method if necessary.

This has been done to avoid overcomplicated synchronisation in XEP-0384 plugin (network calls are needed to initialise session,
but PEP events need an initialised session to be treated).
2018-08-11 18:24:55 +02: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