pub fn into_accepted(
        self,
        event: &ToDeviceEvent<AcceptEventContent>,
    ) -> Result<SasState<Accepted>, SasState<Canceled>> {
        self.check_event(&event.sender, &event.content.transaction_id)
            .map_err(|c| self.clone().cancel(c))?;

        if let AcceptMethod::MSasV1(content) = &event.content.method {
            let accepted_protocols =
                AcceptedProtocols::try_from(content.clone()).map_err(|c| self.clone().cancel(c))?;

            let json_start_content = cjson::to_string(&self.as_content())
                .expect("Can't deserialize start event content");

            Ok(SasState {
                inner: self.inner,
                ids: self.ids,
                verification_flow_id: self.verification_flow_id,
                creation_time: self.creation_time,
                last_event_time: self.last_event_time,
                state: Arc::new(Accepted {
                    json_start_content,
                    commitment: content.commitment.clone(),
                    accepted_protocols: Arc::new(accepted_protocols),
                }),
            })
        } else {
            Err(self.cancel(CancelCode::UnknownMethod))
        }
    }
/// Receive a m.key.verification.accept event, changing the state into
/// an Accepted one.
///
/// # Arguments
///
/// * `event` - The m.key.verification.accept event that was sent to us by
/// the other side.
Receive a m.key.verification.accept event, changing the state into
an Accepted one.
Receive a m . key . verification . accept event changing the state into an Accepted one .
pub fn into_accepted(
        self,
        event: &ToDeviceEvent<AcceptEventContent>,
    ) -> Result<SasState<Accepted>, SasState<Canceled>> {
        self.check_event(&event.sender, &event.content.transaction_id)
            .map_err(|c| self.clone().cancel(c))?;
        if let AcceptMethod::MSasV1(content) = &event.content.method {
            let accepted_protocols =
                AcceptedProtocols::try_from(content.clone()).map_err(|c| self.clone().cancel(c))?;
            let json_start_content = cjson::to_string(&self.as_content())
                .expect("Can't deserialize start event content");
            Ok(SasState {
                inner: self.inner,
                ids: self.ids,
                verification_flow_id: self.verification_flow_id,
                creation_time: self.creation_time,
                last_event_time: self.last_event_time,
                state: Arc::new(Accepted {
                    json_start_content,
                    commitment: content.commitment.clone(),
                    accepted_protocols: Arc::new(accepted_protocols),
                }),
            })
        } else {
            Err(self.cancel(CancelCode::UnknownMethod))
        }
    }
pub fn into_accepted ( self , event : & ToDeviceEvent < AcceptEventContent > , ) -> Result < SasState < Accepted > , SasState < Canceled > > { self . check_event ( & event . sender , & event . content . transaction_id ) . map_err ( | c | self . clone ( ) . cancel ( c ) ) ? ; if let AcceptMethod :: MSasV1 ( content ) = & event . content . method { let accepted_protocols = AcceptedProtocols :: try_from ( content . clone ( ) ) . map_err ( | c | self . clone ( ) . cancel ( c ) ) ? ; let json_start_content = cjson :: to_string ( & self . as_content ( ) ) . expect ( " " ) ; Ok ( SasState { inner : self . inner , ids : self . ids , verification_flow_id : self . verification_flow_id , creation_time : self . creation_time , last_event_time : self . last_event_time , state : Arc :: new ( Accepted { json_start_content , commitment : content . commitment . clone ( ) , accepted_protocols : Arc :: new ( accepted_protocols ) , } ) , } ) } else { Err ( self . cancel ( CancelCode :: UnknownMethod ) ) } }
Receive a m.key.verification.accept event, changing the state into
an Accepted one.
Receive a m . key . verification . accept event changing the state into an Accepted one .
self
event
&ToDeviceEvent<AcceptEventContent>
self
event
&ToDeviceEvent<AcceptEventContent>