Commit graph

4,648 commits

Author SHA1 Message Date
Goffi
7d2d97fa75 plugin XEP-0045: Notification on mention:
If a mention is detected in a MUC (`groupchat`, not DM), a notification is sent.
2026-06-26 23:03:24 +02:00
Goffi
b65325c1d6 plugin XEP-0084: Support multiple images format:
XEP-0084 implementation was only supporting PNG, but some client (notably Conversations)
don't publish PNG, so we have to handle a few other formats.
2026-06-21 12:52:57 +02:00
Goffi
e241075a34 core: Unseen message counter:
This patches add handling for unseen messages counter, and last message received. The
counters are retrieved from DB on startup, they updated in-memory. Frontend are expected
to have their own in-memory counter too, the backend one is used for re-sync (e.g.; on page
reload).

Bridge methods are added to retrieve the state, and indicate which message has been seen
last by user. A signal is sent on counter reset to all frontends can synchronise.

This is currently local only, but it should be compatible with a future XEP-0490 (Message
Displayed Synchronization) implementation.
2026-06-20 15:11:06 +02:00
Goffi
a909d99fa9 plugin XEP-0374, XEP-0384: use debug instead of warning logs:
Those cases are expected on semi-anonymous rooms, thus a warning is inappropriate.
2026-06-20 15:06:55 +02:00
Goffi
09848498cd plugin XEP-0373: Fix local exceptions shadowing core.exceptions 2026-06-20 10:48:16 +02:00
Goffi
7107d64a5b sqla (mapping): fix missing PEP constraint:
A constraint name was missing on the `PubsubNode.pep` column, resulting in a crash when
trying to generate the initial database on launch with an empty `local_dir`.

Migration script introducing the column (f4cb5fc600c7_add_missing_pep_check_constraint.py)
has been updated too. Another migration script has been made to add the constraint to
existing DB (only if they are missing).
2026-06-20 10:27:51 +02:00
Goffi
de13f16791 plugin XEP-0045: fix early return in availableReceived blocking room join:
On room join, the room object is created before the server's self-presence arrives.
`_getRoomUser()` thus returns `user=None` for the initial presence, which led to
`super().availableReceived(presence)` not being called, resulting in wrong typing of the
room and the room not really being joined.
2026-06-19 14:12:42 +02:00
Goffi
8bc3b4156a doc (component): the section use a . now 2026-06-19 12:14:54 +02:00
Goffi
cf225eee83 core (constants): fix XDG config path:
The config path was using `APP_NAME` instead of `APP_NAME_FILE`, resulting in `Libervia`
(with uppercase `L`) used instead of `libervia`.
2026-06-19 12:10:14 +02:00
Goffi
34ecf8b22e plugin XEP-0084: refactor get_avatar:
`get_avatar()` was checking the cache directly, bypassing `plugin_misc_identity`'s
`use_cache` flag. As a result, cache disabling was ineffective. It now fetches from the
PEP node and doesn't handle the cache anymore.

`_parse_metadata_info()` has been added to factorize the metadata parsing.
2026-06-09 16:12:39 +02:00
Syndace
5d9f2d2da9 plugin XEP-0384: code cleanup and failure tracking 2026-06-08 14:26:15 +02:00
Goffi
0f9bfc38ac plugin XEP-0115: minor reformatting 2026-06-08 14:26:15 +02:00
Goffi
67eea35d4e plugin XEP-0115: use the new raw_values from Tx-XMPP:
Libervia calls Tx-XMPP `typeCheck` on disco info reception to check and normalize values.
In the case of XEP-0115 this cause trouve as the normalization is lossy, and change the
type of some fields (booleans, JIDs). The new `raw_values` property has been added in
Tx-XMPP v0.15 to retrieve original `str` value, so this now used to build the hash.

fix 486
2026-06-08 10:44:53 +02:00
Goffi
7c3333c20d install: lock file update. 2026-06-08 10:44:53 +02:00
Goffi
8b095c1989 install: tx-xmpp dependency update:
New version of `tx-xmpp` will be needed to properly generate XEP-0115 hash.

rel 486
2026-06-08 10:44:53 +02:00
Goffi
7ecd4d8a87 install: Change urwid-satext source URL:
`uv` starts complaining about `tar.bz2` archive, so `tar.gz` is now used for
`urwid-satext`.
2026-06-08 10:44:32 +02:00
Goffi
29a39b771b plugin XEP-0115: Fix race condition on disco creation:
This patch chains disco query to `conn_deferred` to be sure that `client.disco` is set.

fix #484
2026-06-07 21:20:05 +02:00
Goffi
84e92f9a98 doc (cli): Document xid commands:
fix 477
2026-06-06 12:36:14 +02:00
Goffi
a8ba049d6a cli (xid): Set of commands to handle XMPP Decentralized ID (XID):
Implement commands to get, create, revoke, verify, import/export XID, and sign/verify a
file or inline data.

rel 477
2026-06-06 12:34:00 +02:00
Goffi
be203cc73a tests (unit): Plugin XID tests:
rel 477
2026-06-06 12:33:46 +02:00
Goffi
9d4c2bace9 plugin misc XID: XMPP Decentralized ID implementation:
XMPP Decentralized ID (XID) implementation. All the spec but private key synchronisation
is implemented, and private key can be synchronised with import/export method which
through a URI usable with QR Code as explained in the spec.

rel 477
2026-06-06 12:23:39 +02:00
Goffi
836a9c962e tools (common/uri): Modernization + more flexible URIs:
- Remove Python < 3.9 workaround
- Type hints + docstring update
- Accept `kwargs` when `type_` is `None`.

rel 477
2026-06-06 12:23:06 +02:00
Goffi
6aba4c6686 plugin XEP-0045: Fix variable used in logs. 2026-06-06 12:23:06 +02:00
Goffi
ed462a661b core (memory): Modernize methods signature/docstrings of encrypt_value and decrypt_value:
- Use `client` instead of `profile`
- Add `decrypt_value_by_profile` which is notably useful on client startup, when the
  encrypted password needs to be retrieved, and the `SatXMPPEntity` instance is not yet
  created.
- Add type hints/update docstrings

rel 477
2026-06-06 12:23:06 +02:00
Goffi
e0064e0372 component pubsub: Set default access model for PEP to presence 2026-05-27 15:28:11 +02:00
Goffi
23cbd8ff9d memory (sqla), bridge: New history_last_messages_metadata_get method:
This method is used to retrieve last messages and their timestamps. It's useful on frontend
startup to display data on last discussions.
2026-05-25 17:52:26 +02:00
Goffi
ac315a4300 plugin XEP-0402: log a warning instead of an exception on TimeoutError. 2026-05-25 17:41:53 +02:00
Goffi
e257600ad5 core (launcher): Separate add_subparsers for exensibility:
`add_subparsers` is now in its own method to it can be extended by a subclass. Notably
needed by web frontend to add its `local` command.
2026-05-22 18:27:46 +02:00
Goffi
00c7f1b1a3 plugin XEP-402: log a warning instead of an exception on NotFound error. 2026-05-21 21:10:30 +02:00
Goffi
f5e065b56a plugin XEP-0465: Remove duplicate ps_public_subscriptions_get bridge method. 2026-05-21 21:10:30 +02:00
Goffi
a722464238 bridge (embedded): Update and fix:
Fix embedded bridge and adapt to changes in core code:

- Add `EmbeddedBridgeSettings` so it can be used in settings.
- Add `AIOBridge` and `TwistedBridge` wrappers.
- Fix callbacks, instead of logging them (and breaking the errback chain), they are now
  raised using `BridgeException` like in other bridges.
- Ensure that a singleton `Bridge` is used between backend and frontend.
- Init backend on first call to `bridge_connect`.
- Add Python 3.14 fix (as it is normally done in Launcher which is not run with with
`embedded`, we have to do it there).
- Track generated files.
2026-05-21 21:09:43 +02:00
Goffi
15ad700b22 plugin XEP-0402: Fetch bookmarks on startup and handle autojoin. 2026-05-14 11:49:02 +02:00
Goffi
dce577bf3a plugin XEP-0163: type hints 2026-05-14 11:49:02 +02:00
Goffi
502d9aad19 plugin XEP-0313: Fix elements dump in the warning:
The use of `pp_elt` was printing the element instead of showing them in the warning
message.
2026-05-14 11:49:02 +02:00
Goffi
d8b083cdb0 plugin XEP-0384: Regenerate key on corrupted data. 2026-05-14 11:49:02 +02:00
Goffi
45395c729a core (xmpp): Return as soon as possible once connection is establied:
To improve connection time and UX in frontends, the `start_connection` returns immediately
after the connection is established (authentication successful), and the rest of
initialisation is now done in background. The `profile_ready` and
`profile_connection_error` signals can be used to track the end of the full connection
process.
Roster retrieval is now also done in background for the same reason.
`LiberviaRosterProtocol.got_roster` Deferred can be used to track roster retrieval.
2026-05-14 11:49:02 +02:00
Goffi
8780d2133f bridge: Add profile_connection_error signal 2026-05-14 11:49:02 +02:00
Goffi
2b0f4bd192 plugin XEP-0033: Fix validation error when only metadata address are used:
XEP-0033 may be used as a simple metadata marker when sending messages (e.g. to indicate a
`replyto`). The validation was failing on that due to missing `to`, `cc` and `bcc`.
2026-05-14 11:49:02 +02:00
Goffi
2c5713b486 memory (disco): Fix pending queries isolation and cancellation:
When returning pending queries `Deferred`, a caller could add its own callbacks/errbacks
and modify the result. When another caller was reusing the `Deferred`, it got the modified
result (which could be `None`) instead of the expected `DiscoInfo`.

This has been fixed by creating and new `Deferred` on each request, and chaining it to the
original pending queries using the new `fork_deferred` helper method, so each caller get
its own isolated `Deferred`.

In `fork_deferred`, `cancel` method is used to call the parent Deferred `cancel`, to avoid
a wrong Exception propagation and the chained Deferred to be eventually called twice
(triggering `AlreadyCalledError`).

`cleanup_query` has been moved above `infos_cb` callback, as it should be the first
callback called.
2026-05-14 11:43:59 +02:00
Goffi
709366fe13 plugin XEP-0084: fix avatar retrieval and disabling:
- Avatar disabling was not correctly handled for all cases, this should now be fixed.
- Avatar retrieval is now down only on PEP events, no directly anymore. `get_avatar` only
  returns cached version.
2026-05-04 16:49:07 +02:00
Goffi
89c23c8a4c plugin XEP-0084: Fix double feature advertising:
`NS_AVATAR_METADATA` is already advertised by `add_pep_event`, adding it to `getDiscoInfo`
too was resulting in double advertising, making the disco infos invalid for caching
(resulting in other devices repeatedly requesting disco#info).
2026-05-04 16:47:42 +02:00
Goffi
a750154c2f bridge (D-Bus): fix BridgeException wrapping 2026-05-04 16:44:39 +02:00
Goffi
c3906da781 cli (base): Flush output on self.disp:
When `li` stdout was redirected (e.g. with a pipe), the buffer was preventing to display
immediately data, which is a problem when we need it immediately (like when monitoring
with `li debug monitor`). Flushing is now done immediately to avoid that.
2026-05-04 16:44:39 +02:00
Goffi
1c6ca838b5 plugin XEP-0473: Don't try do load secrets if there is not encrypted elements:
The plugin was trying to decrypt all pubsub events, without checking if there is
"encrypted" element first, resulting in warning for all clear events.

This patch fixes it by detecting <encrypted> element and exiting early if none is found.
2026-05-04 16:44:39 +02:00
Goffi
351b7e2140 plugin XEP-0356: Fix incorrect _on_presence definition 2026-05-04 16:44:39 +02:00
Goffi
18d3f0167f plugin XEP-0115: Fix disco duplicate on caps node query + check own generation:
When caps node was requested, disco infos was returned from cache + infos from normal
disco gathering, resulting in doubled items and other entities rejecting the disco info.

This is fixed by subclassing the disco handler to add a trigger. This trigger is used by
XEP-0115 to short circuit the disco gathering and returned its cached data instead.

Our own hash is re-generated on each connection, and validated, so if there is a bug, this
helps see and catch it.
2026-05-04 16:44:39 +02:00
Goffi
58834f15ae tools (trigger): Type hint + dead code removal:
- Remove `is_available` which uncomplete and not used at all.
- Add/fix type hints and docstrings.
2026-05-04 15:08:13 +02:00
Goffi
d2fd11df13 plugin XEP-215: Use bare JID instead of raising an exception on full jid. 2026-05-04 15:04:04 +02:00
Goffi
1613554018 memory (disco): ensure that we don't cache None in disco hashes:
Add a guard to avoid mapping `None` to a hash.
2026-05-04 15:04:04 +02:00
Goffi
779d58d5ff core (xmpp/messages): only send "origin" request for printable messages:
"Origin" request are disco requests to know if a message sender is a bot or coming from a
gateway. It was sending request on every message, including pubsub/PEP events, resulting
in requests done to many entities, including ones not cacheables (bare entities or third
party servers, without caps mechanisms).

To avoid that, the requests is now done only for printable messages. To use
`client.is_message_printable` correctly, origin check has be moved to the end, after
`message_parse` trigger, so attachments are added to data.
2026-05-04 15:04:04 +02:00