server: Send a hsignal when a new room key is received.
This commit is contained in:
parent
47e71ce925
commit
d802aa30ae
1 changed files with 15 additions and 0 deletions
|
@ -52,6 +52,7 @@ from nio import (
|
||||||
LoginError,
|
LoginError,
|
||||||
JoinedMembersResponse,
|
JoinedMembersResponse,
|
||||||
JoinedMembersError,
|
JoinedMembersError,
|
||||||
|
RoomKeyEvent
|
||||||
)
|
)
|
||||||
|
|
||||||
from . import globals as G
|
from . import globals as G
|
||||||
|
@ -964,6 +965,20 @@ class MatrixServer(object):
|
||||||
|
|
||||||
self._handle_room_info(response)
|
self._handle_room_info(response)
|
||||||
|
|
||||||
|
for event in response.to_device_events:
|
||||||
|
if not isinstance(event, RoomKeyEvent):
|
||||||
|
continue
|
||||||
|
|
||||||
|
message = {
|
||||||
|
"sender": event.sender,
|
||||||
|
"sender_key": event.sender_key,
|
||||||
|
"room_id": event.room_id,
|
||||||
|
"session_id": event.session_id,
|
||||||
|
"algorithm": event.algorithm,
|
||||||
|
"server": self.name,
|
||||||
|
}
|
||||||
|
W.hook_hsignal_send("matrix_room_key_received", message)
|
||||||
|
|
||||||
# Full sync response handle everything.
|
# Full sync response handle everything.
|
||||||
if isinstance(response, SyncResponse):
|
if isinstance(response, SyncResponse):
|
||||||
if self.client.should_upload_keys:
|
if self.client.should_upload_keys:
|
||||||
|
|
Loading…
Add table
Reference in a new issue