101 Commits

Author SHA1 Message Date
Kévin Commaille
ae3897cad8 identifiers: Allow to validate KeyId with any key name type
Use new trait bounds for KeyId to only allow specific types.
Change the KeyId validation to be generic over the key name type.
Remove the KeyName type and replace it with the more specific
ServerSigningKeyVersion.
2024-11-08 12:49:53 -05:00
Kévin Commaille
f753a2f326 events: Improve markdown parsing code
Loop through the events only once to detect both whether there is
markdown and whether the markdown is inline.
Fix more cases of false negatives in markdown detection, like
whitespaces that are removed or the string beginning by a backslash
escape.
2024-11-07 18:59:47 -05:00
Kévin Commaille
278a45aec8 events: Remove p tag around inline markdown
As recommended by the spec.
2024-11-07 18:52:56 -05:00
Neek
1c4eeb4c41 events: Add relates_to field on StickerEventContent 2024-10-19 14:59:29 -04:00
Doug
4a5d7d0e7a events: Add filename helper methods for audio, file, image and video messages. 2024-10-19 14:58:49 -04:00
Doug
e0db68241d events: Add helpers for media captions to audio, file, image and video messages 2024-10-19 14:58:46 -04:00
Kévin Commaille
8f288cc1f2 events: Replace deprecated lint in UI test 2024-09-07 17:11:13 +02:00
Kévin Commaille
dac38e4e17 events: Improve markdown syntax detection
We also detect backslash escapes and entity references.
2024-09-06 09:59:47 +02:00
Kévin Commaille
04654f8833 chore: Fix new clippy warnings 2024-07-29 20:03:44 +02:00
Kévin Commaille
f17de39ed4 events: More relation serde fixes
It seems that we cant count on serde_json::to_value to detect
duplicates,
because it swallows them instead of returning an error.
The only solution then is to serialize to string and try to deserialize
again.
2024-06-25 14:10:11 +02:00
Benjamin Bouvier
e5a370f7e5 events: don't serialize the rel_type twice for Thread relationships 2024-06-25 11:00:38 +02:00
Benjamin Bouvier
fec2152d87
events: allow deserializing an event content with a type (#1850)
This allows deserializing all the `*EventContent` types into a parent `Any{...}EventContent`, assuming we know the type of the underlying event.

Required for serializing/deserializing the content of events we'd like to send, across application restarts, as in https://github.com/matrix-org/matrix-rust-sdk/issues/3361 for the Rust SDK.

---

* events: add deserialize_with_type to all the *EventContent types

* events: add smoke test for deserializing an event content with a type

* events: add a test for deserializing a secret storage key event content

* events: add fix for correctly matching events with a type fragment

* Address review comments.
2024-06-24 10:55:12 +02:00
Timo
c218174369
events: Support new matrixRTC membership format 2024-06-13 10:58:50 +02:00
torrybr
f60c79727a
events: Unstable support for MSC 3489 live location sharing 2024-06-10 23:45:42 +02:00
Marco Antonio Alvarez
6cd3af9b86
events: Add support for encrypted stickers 2024-05-23 15:49:15 +02:00
Kévin Commaille
0f38daacef
events: Handle existing mentions in make_replacement
Allows to use add_mentions before calling it.
Deprecates set_mentions.
2024-05-13 15:07:26 +02:00
Kévin Commaille
22e89bde2b events: Make some fields of Candidate optional
For compatiblity with the WebRTC spec.

Notably the last Candidate should only contain the `candidate` field
with an empty string.
2024-03-08 15:12:02 +01:00
Timo
8fc12b0324
events: Add CallNotify event as described by MSC4075
https://github.com/matrix-org/matrix-spec-proposals/pull/4075
2023-11-27 15:49:36 +01:00
Jonas Platte
740f357e97
events: Don't fail event content parsing on invalid relation 2023-11-16 14:12:55 +01:00
Jonas Platte
c82f600d6a
Fix new lints 2023-11-08 18:16:44 +01:00
Jonas Platte
a3f8c97b33
events: Add a test case for reply to threaded message fallback 2023-10-12 12:47:53 +02:00
Jonas Platte
6dff2f37d1
events: Remove redundant import 2023-10-12 12:36:59 +02:00
Jonas Platte
5c570b1604
events: Change AddMentions::Yes to only mention the original sender 2023-10-09 14:44:35 +02:00
Kévin Commaille
5040aa2a93 events: Allow to build reply to raw events 2023-09-20 12:18:21 +02:00
Kévin Commaille
a53bd09b8a events: Make name required in RoomNameEventContent
The wording of the spec was confusing but it is indeed required
2023-09-18 15:05:26 +02:00
Kévin Commaille
18195e0a6e events: Allow replacement unstable poll start events to have no fallback 2023-09-15 13:19:22 +02:00
Jonas Platte
31331f3165
Bring back ruma-events
Co-authored-by: Kévin Commaille <zecakeh@tedomum.fr>
2023-08-28 10:23:54 +02:00
Kévin Commaille
c3f9a3cb70
common: Merge ruma-events into ruma-common 2022-03-04 11:45:07 +00:00
Kévin Commaille
588fe9c006 events: Remove unnecessary unwraps in message tests 2022-03-03 14:04:20 +01:00
Kévin Commaille
c37a514a89 events: Add support for extensible file events
As defined in MSC3551
2022-03-03 13:55:04 +01:00
Kévin Commaille
99cd70b430 events: Add support for extensible notice and emote events
As defined in MSC1767
2022-03-02 18:09:43 +01:00
Kévin Commaille
f78d3480a5 events: Add support for extensible text event
As defined in MSC1767
2022-03-02 18:09:43 +01:00
Kévin Commaille
f2dca60fc7
macros: Rename ruma-events-macros to ruma-macros 2022-02-27 13:54:17 +01:00
Kévin Commaille
771f437d9e
events: Rename MessageEvent to MessageLikeEvent 2022-02-22 20:06:36 +01:00
Jonas Platte
f130d09daa
events: Remove Serialize implementations for event enums 2022-02-12 01:52:53 +01:00
Kévin Commaille
cdf383cc45 events: Move MSCs to per-msc features 2022-02-11 10:18:07 +01:00
Jonas Platte
b08e8cff9d
events: Remove custom module
… and shuffle things around so there's still a content type that can be
used for _Custom event enum variants.
2022-02-08 19:12:19 +01:00
Jonas Platte
89ae41166d
events: Move new verification events out of unstable-pre-spec
… since they were stabilized with v1.1.
2022-01-31 20:43:38 +01:00
Jonas Platte
ee977b48f0
Make the inner type of _Custom enum variants unusable
The variant itself would be private if possible, this is the solution
closest to that.
2022-01-13 11:38:48 +01:00
Jonas Platte
3cb728e61a
Enforce most serde_json import renames through clippy 2022-01-03 12:28:15 +01:00
Jonas Platte
6b76d7813e
identifiers: Shorten RoomVersionId variant names 2021-11-26 01:07:26 +01:00
Jonas Platte
87051c3cb6
identifiers: Make server_name! macro return a reference instead of an owned value
It is easy to turn it into an owned value through `.to_owned()`.
The reverse was not possible without tying the reference to the lifetime
of a temporary variable.
2021-11-26 00:53:07 +01:00
Jonas Platte
5852658da5
identifiers: Make KeyId a DST 2021-11-26 00:40:44 +01:00
Jonas Platte
3ce578f384
identifiers: Make UserId a DST 2021-11-26 00:40:40 +01:00
Jonas Platte
2d4dbfe42f
identifiers: Make RoomId a DST 2021-11-26 00:04:28 +01:00
Jonas Platte
b0db5e94e1
identifiers: Make RoomAliasId a DST 2021-11-26 00:04:28 +01:00
Jonas Platte
ec605a0959
identifiers: Make MxcUri a DST 2021-11-26 00:04:28 +01:00
Jonas Platte
52608cc72c
identifiers: Make EventId a DST 2021-11-25 22:34:40 +01:00
Jonas Platte
438efee143
identifiers: Remove Box<$id> aliases 2021-11-25 21:07:14 +01:00
Jonas Platte
3ea16b6d09
events: Update comment, silence lint 2021-10-29 22:13:26 +02:00