If a room was not joined (e.g., due to failure), `is_room` was wrongly returning `False`.
Disco identity is now used as fallback to detect correctly is an entity is a room or not.
This changes makes `is_room` async, and by extension `get_bare_or_full` too.
If empty string is used for nick in `join` (e.g., due to a bridge call), take use part of
the JID. This fix the use of empty resource, which was resulting in rejection by the
server.
5s timeout is too short, if the server is overloaded or connection is slow, it makes the
identity retrieval fail. 15s is more reasonable and matches timeout used for disco.
We now use `client.is_message_printable` to check if message is printable. If it's not, we
block storage in DB and sending to bridge. The previous code could let message pass if
metadata were stored in `extra`.
Podman can be used as a drop-in replacement for Docker, and it doesn't need root
permissions. The plugin now has a settings to use Podman, and use `auto` by default which
will choose the first found on the device (Podman is tested first).
New `serverless` commands. For now only `discover` and `info` are implemented:
- `discover` find other peers on LAN
- `info` get various infos on serverless status (for now, our own device ID,
advertised service name, and the number of found peers)
rel 479
Implement peer discovery on LAN using mDNS (via `zeroconf`).
A Peer ID is generated (via `libP2P`) per instance, and announced on backend startup.
Meanwhile, other peers are discovered on LAN. A signal is send on peer found and another
on peer lost.
There a bridge methods to find already discovered peers, and to get infos on serverless
(our own ID, adverised service name, and number of peers found).
`Zeroconf` runs in background in its own thread.
rel 479
Cleaning methods per-profile (`profile_disconnected`) and per-plugin (`unload`) were not
called correctly. They are now called on shutdown with the `before/shutdown` Twisted
event.
With this event, it's still possible to call Deferred and do cleaning requiring async
calls.
rel 479
Due to the yielding, `_node_cb` could be modified during node event management, resulting
in an exception. The items are now shallow copied to avoid issue.
`libp2p` will used for implementing serverless features, `zeroconf` for LAN discovery.
Lock file has been updated.
Note: `libp2p` is currently not compatible with Python 3.14 (cf.
https://github.com/libp2p/py-libp2p/issues/1100 )
rel 479
Normally the backend is made to have a singleton instance, and handle all profiles.
However, it may be useful to run instances independently (e.g., for development, to run
components in independent processes, for testing, etc).
This was previously possible by using a specific configuration files at backend's root.
This patch introduce a cleaner way by using an isolation mode.
Isolation mode is activated by settings the `LIBERVIA_ISOLATION` environment variable to
the name of the isolated instance. `LIBERVIA_ISOLATION_MODE` can be used to specify one of
the following mode:
- normal (default): config and shared files are in XDG in a `isolated/<name>` subdirectory
(usually `~/.local/share/libervia/isolated/<name>` and
`~/.config/libervia/isolated/<name>`). Runtime files and other instance specific data
(such as D-Bus name) are also isolated. Config uses cascade as usual.
- full: same as above, but config isn't cascading, it's using only its own isolated config
file.
- tmp: same as normal but the local directory is put in a temporary directory, and deleted
on backend startup. It stays on termination, so data can be checked if necessary (this mode is
usually used for development).
This feature will notably be useful to test severless mode on a single machine.
rel 479
- Hash (SHA-256) is now automacally computed when a file is uploaded via XEP-0363, and
used if no hash has been specified by frontend already.
- Use named tuples (`UploadTracking` and `UploadResult`) to handle callback values.
- upload: fix a bug (missing variable) in `unregister` (which is not used yet anyway).
- usual docstring/type hints improvements
XEP-0447 allow to send sources after the original message. Dino is doing that, and thus we
can't display attachment immediately with only the original message.
This patch handle that by updating the original message once the sources are received, and
emitting a `message_update` signal to notify frontends.
- Fix the wrong encoding of the hash hex string value instead of the binary value.
- Use a `StrEnum` for model, use models specified in XEP-0414.
- Minor typing hint/docstring improvments.
- multiple-files support now that the XEP has them. The legacy message compatibility layer
is implemented too, with the new `message_sent` trigger for 1:1, and with follow-up
messages sent on message echo for MUC.
- usual modernisation (type hints, `get_plugin_data`)
- (core) new `message_sent` trigger point
JPEG doesn't support transparency, which was resulting in exception if a preview of an
image with transparency was made. This is now checked, and the image is converted if
necessary.
- Async coroutines, type hints
- Use client plugin data instead of per-profile dict
- Detect chat state availability with disco queries
- Better spec compliance
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.
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).
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.
`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.
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