@@ -5,6 +5,7 @@ use matrix_sdk::{
55 async_trait,
66 widget:: { MessageLikeEventFilter , StateEventFilter } ,
77} ;
8+ use ruma:: events:: MessageLikeEventType ;
89use tracing:: error;
910
1011use crate :: { room:: Room , RUNTIME } ;
@@ -268,6 +269,31 @@ pub fn get_element_call_required_permissions(
268269) -> WidgetCapabilities {
269270 use ruma:: events:: StateEventType ;
270271
272+ let read_send = vec ! [
273+ // To read and send rageshake requests from other room members
274+ WidgetEventFilter :: MessageLikeWithType {
275+ event_type: "org.matrix.rageshake_request" . to_owned( ) ,
276+ } ,
277+ // To read and send encryption keys
278+ // TODO change this to the appropriate to-device version once ready
279+ WidgetEventFilter :: MessageLikeWithType {
280+ event_type: "io.element.call.encryption_keys" . to_owned( ) ,
281+ } ,
282+ // To read and send custom EC reactions. They are different to normal `m.reaction`,
283+ // they can be send multiple times to the same event.
284+ WidgetEventFilter :: MessageLikeWithType {
285+ event_type: "io.element.call.reaction" . to_owned( ) ,
286+ } ,
287+ // This allows send raise hand reactions.
288+ WidgetEventFilter :: MessageLikeWithType {
289+ event_type: MessageLikeEventType :: Reaction . to_string( ) ,
290+ } ,
291+ // This allows to detect if someone does not raise their hand anymore.
292+ WidgetEventFilter :: MessageLikeWithType {
293+ event_type: MessageLikeEventType :: RoomRedaction . to_string( ) ,
294+ } ,
295+ ] ;
296+
271297 WidgetCapabilities {
272298 read : vec ! [
273299 // To compute the current state of the matrixRTC session.
@@ -278,19 +304,15 @@ pub fn get_element_call_required_permissions(
278304 WidgetEventFilter :: StateWithType {
279305 event_type: StateEventType :: RoomEncryption . to_string( ) ,
280306 } ,
281- // To read rageshake requests from other room members
282- WidgetEventFilter :: MessageLikeWithType {
283- event_type: "org.matrix.rageshake_request" . to_owned( ) ,
284- } ,
285- // To read encryption keys
286- // TODO change this to the appropriate to-device version once ready
287- WidgetEventFilter :: MessageLikeWithType {
288- event_type: "io.element.call.encryption_keys" . to_owned( ) ,
289- } ,
290307 // This allows the widget to check the room version, so it can know about
291308 // version-specific auth rules (namely MSC3779).
292309 WidgetEventFilter :: StateWithType { event_type: StateEventType :: RoomCreate . to_string( ) } ,
293- ] ,
310+ // Custom element call reaction event. (which can be send multiple times for one
311+ // event),
312+ ]
313+ . into_iter ( )
314+ . chain ( read_send. clone ( ) )
315+ . collect ( ) ,
294316 send : vec ! [
295317 // To send the call participation state event (main MatrixRTC event).
296318 // This is required for legacy state events (using only one event for all devices with
@@ -313,15 +335,10 @@ pub fn get_element_call_required_permissions(
313335 event_type: StateEventType :: CallMember . to_string( ) ,
314336 state_key: format!( "_{own_user_id}_{own_device_id}" ) ,
315337 } ,
316- // To request other room members to send rageshakes
317- WidgetEventFilter :: MessageLikeWithType {
318- event_type: "org.matrix.rageshake_request" . to_owned( ) ,
319- } ,
320- // To send this user's encryption keys
321- WidgetEventFilter :: MessageLikeWithType {
322- event_type: "io.element.call.encryption_keys" . to_owned( ) ,
323- } ,
324- ] ,
338+ ]
339+ . into_iter ( )
340+ . chain ( read_send)
341+ . collect ( ) ,
325342 requires_client : true ,
326343 update_delayed_event : true ,
327344 send_delayed_event : true ,
@@ -417,7 +434,7 @@ impl From<matrix_sdk::widget::Capabilities> for WidgetCapabilities {
417434}
418435
419436/// Different kinds of filters that could be applied to the timeline events.
420- #[ derive( uniffi:: Enum ) ]
437+ #[ derive( uniffi:: Enum , Clone ) ]
421438pub enum WidgetEventFilter {
422439 /// Matches message-like events with the given `type`.
423440 MessageLikeWithType { event_type : String } ,
0 commit comments