@@ -4,7 +4,7 @@ use async_compat::get_runtime_handle;
44use language_tags:: LanguageTag ;
55use matrix_sdk:: {
66 async_trait,
7- widget:: { MessageLikeEventFilter , StateEventFilter } ,
7+ widget:: { MessageLikeEventFilter , StateEventFilter , ToDeviceEventFilter } ,
88} ;
99use ruma:: events:: MessageLikeEventType ;
1010use tracing:: error;
@@ -488,6 +488,8 @@ pub enum WidgetEventFilter {
488488 StateWithType { event_type : String } ,
489489 /// Matches state events with the given `type` and `state_key`.
490490 StateWithTypeAndStateKey { event_type : String , state_key : String } ,
491+ /// Matches to-device events with the given `event_type`.
492+ ToDevice { event_type : String } ,
491493}
492494
493495impl From < WidgetEventFilter > for matrix_sdk:: widget:: Filter {
@@ -505,6 +507,9 @@ impl From<WidgetEventFilter> for matrix_sdk::widget::Filter {
505507 WidgetEventFilter :: StateWithTypeAndStateKey { event_type, state_key } => {
506508 Self :: State ( StateEventFilter :: WithTypeAndStateKey ( event_type. into ( ) , state_key) )
507509 }
510+ WidgetEventFilter :: ToDevice { event_type } => {
511+ Self :: ToDevice ( ToDeviceEventFilter { event_type : event_type. into ( ) } )
512+ }
508513 }
509514 }
510515}
@@ -526,6 +531,9 @@ impl From<matrix_sdk::widget::Filter> for WidgetEventFilter {
526531 F :: State ( StateEventFilter :: WithTypeAndStateKey ( event_type, state_key) ) => {
527532 Self :: StateWithTypeAndStateKey { event_type : event_type. to_string ( ) , state_key }
528533 }
534+ F :: ToDevice ( ToDeviceEventFilter { event_type } ) => {
535+ Self :: ToDevice { event_type : event_type. to_string ( ) }
536+ }
529537 }
530538 }
531539}
0 commit comments