This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new module API for adding custom fields to events
unsigned
sect…
…ion (#16549)
- Loading branch information
1 parent
679c691
commit c02406a
Showing
19 changed files
with
194 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add a new module API callback that allows adding extra fields to events' unsigned section when sent down to clients. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
docs/modules/add_extra_fields_to_client_events_unsigned.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Add extra fields to client events unsigned section callbacks | ||
|
||
_First introduced in Synapse v1.96.0_ | ||
|
||
This callback allows modules to add extra fields to the unsigned section of | ||
events when they get sent down to clients. | ||
|
||
These get called *every* time an event is to be sent to clients, so care should | ||
be taken to ensure with respect to performance. | ||
|
||
### API | ||
|
||
To register the callback, use | ||
`register_add_extra_fields_to_unsigned_client_event_callbacks` on the | ||
`ModuleApi`. | ||
|
||
The callback should be of the form | ||
|
||
```python | ||
async def add_field_to_unsigned( | ||
event: EventBase, | ||
) -> JsonDict: | ||
``` | ||
|
||
where the extra fields to add to the event's unsigned section is returned. | ||
(Modules must not attempt to modify the `event` directly). | ||
|
||
This cannot be used to alter the "core" fields in the unsigned section emitted | ||
by Synapse itself. | ||
|
||
If multiple such callbacks try to add the same field to an event's unsigned | ||
section, the last-registered callback wins. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.