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`.
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.
- 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.
`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).
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.
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.
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.
"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.
When `prepare_for_profile` is called during connection init, an infinite loop could happen
with 'get_session_manager` calling `prepare_for_profile`. A check is added to early exit
if the profile is already being prepared, avoiding this issue.
In case of dead server/component with lot of contacts, we may receive a lot of
`<presence>` error with `remote-server-not-found` conditions. This patch use this to mark
the server as unreachable and avoid to do disco queries there.
When a `remote-server-not-found` stanza error is received, cache the whole server, so all
queries to a entity from this server will be blocked by the cache, avoiding unnecessary
network requests.
During cache check, full entity JID is checked first, then its server.
When many queries are run in parallel (e.g. during initial sync on startup), the same
entity may be disco queries several times in parallel. To avoid network request
duplication, we now track pending queries, and re-use them in this case.
- When we want to disco a bare JID, disco its server instead, to avoid many uncached
requests. In most case, the server disco is enough to discover JID origin.
- Avoid exception on `exceptions.ExternalRequestError`, print a warning instead.
- Add sync status tracking with bridge signals (`mam_sync_started`, `mam_sync_completed`,
`mam_sync_error`), `mam_sync_statuses_get` method and helper methods that are called
from `plugin_xep_0045`.
- Update "resume" workflow:
- fix settings of last stanza ID, so it's always set (was not set for our own messages)
- own message now use `onMessage` full workflow instead of just store and signal.
- add `flush_archive_batch` at the end of the process.
- Sync status are sent during resumt
- Modernisation (type hints, use of `get_plugin_data`)
- Join method is completely refactored so a room is now joined immediately, and MAM
synchronisation happens in background.
- Legacy history is not used anymore to simplify code.
- Global simplification of the plugin, not more complicated states handling or message
caching.
A `profile_ready` signal is now sent, so all frontends can know when a profile is
connected, and we don't have to wait for `connect` bridge method and risk a timeout.
- Add `wal_checkpoint()` method to manually checkpoint Write-Ahead logs.
- Do the checkpoint on startup to start clean and avoid delay on first login.
- Add an `unload` method to clean DB on exit, and do a checkpoint there.
In some cases (e.g. inherited env values in a wrapping tool), the background detection
code can be validated but hangs. This patch avoids that by adding a timeout with a
`SIGALRM`.
We sometimes to need to call another method in asyncio context when we already are in this
context. With the `@aio` decorator which makes the method return a `Deferred`, it was
necessary to use a ping pong between `Deferred` and `Future`.
This patch adds a `aio_func` attribute which directly returns the wrapped asyncio method,
so it can now be awaited directly.
- Fix data types, and use quotes data type to avoid immediate evaluation on Python < 3.14
- Better error catching folling change in `get_infos` in `memory.disco`.
- Some code modernisation (async coroutine).
- Error raised by `disco_info` where not properly handler, resulting in an exception
instead of appropriate logging and return value.
- `async` coroutines, type hints
Messages are now queued per conversation (i.e. one-to-one chats, or MUCs). This allows
messages to be treated in parallel instead of waiting sequentially for each one to be
processed.
- the XEP-0115 implementation has been completed with validation, caps node handling in
disco requests, hash generation fixes, and real support for xml:lang.
- the `generate_hash` method has been moved from disco where it's not used anymore to
XEP-0115.
- Disco doesn't hash systematically, it nos use a per-jid cache for non XEP-0115
supporting client.
- code modernisation, with use of `get_plugin_data` for Client data in XEP-0115, type
hints, etc.
- More comments have been added to link algorithms steps to the relevant part in
specification.
Tx-XMPP 0.12 has beaking change in `discoFeature.identities` because it now supports
`xml:lang` attribute, so this update implies updating the code everywhere were this is
used.
- work around a deprecated behaviour in `asyncio.get_event_loop` until the fix is
integrated in a released Twisted.
- update dependencies to have versions compatible with Python 3.14
- disable `term-image` which is bounded to incompatible Pillow version. It is unmaintained
for 1 year, and will probably be removed soon in favor of `textual-image`.
The secrets were loaded for all items in `_items_trigger` instead of exiting early when
there is nothing to decrypt, this was inefficient, and showing annoying warnings.