EventHandler

Trait EventHandler 

Source
pub trait EventHandler {
    // Provided methods
    fn handle(
        &mut self,
        cwtch: &dyn CwtchLib,
        profile: Option<&Profile>,
        event: &Event,
    ) { ... }
    fn on_contact_online(
        &self,
        cwtch: &dyn CwtchLib,
        profile: &Profile,
        convo_id: ConversationID,
    ) { ... }
    fn on_new_contact(
        &self,
        cwtch: &dyn CwtchLib,
        profile: &Profile,
        convo_id: ConversationID,
    ) { ... }
    fn on_new_message_from_contact(
        &mut self,
        cwtch: &dyn CwtchLib,
        behaviour: &mut Behaviour,
        profile: &Profile,
        conversation_id: ConversationID,
        handle: String,
        timestamp_received: DateTime<FixedOffset>,
        message: MessageWrapper,
    ) { ... }
    fn on_new_message_from_group(
        &mut self,
        cwtch: &dyn CwtchLib,
        behaviour: &mut Behaviour,
        profile: &Profile,
        conversation_id: ConversationID,
        contact: ContactIdentity,
        timestamp_sent: DateTime<FixedOffset>,
        message: MessageWrapper,
    ) { ... }
}
Expand description

Trait to be used by implementors of imp bots to supply their custom event handling the handle function is called after the default imp automatic event handling has run on each new event

Provided Methods§

Source

fn handle( &mut self, cwtch: &dyn CwtchLib, profile: Option<&Profile>, event: &Event, )

Source

fn on_contact_online( &self, cwtch: &dyn CwtchLib, profile: &Profile, convo_id: ConversationID, )

Source

fn on_new_contact( &self, cwtch: &dyn CwtchLib, profile: &Profile, convo_id: ConversationID, )

Source

fn on_new_message_from_contact( &mut self, cwtch: &dyn CwtchLib, behaviour: &mut Behaviour, profile: &Profile, conversation_id: ConversationID, handle: String, timestamp_received: DateTime<FixedOffset>, message: MessageWrapper, )

Source

fn on_new_message_from_group( &mut self, cwtch: &dyn CwtchLib, behaviour: &mut Behaviour, profile: &Profile, conversation_id: ConversationID, contact: ContactIdentity, timestamp_sent: DateTime<FixedOffset>, message: MessageWrapper, )

Implementors§