diff --git a/src/imp.rs b/src/imp.rs index 321b6c2..d0d101d 100644 --- a/src/imp.rs +++ b/src/imp.rs @@ -18,6 +18,9 @@ pub trait EventHandler { fn on_new_contact(&self, cwtch: &dyn libcwtch::CwtchLib, profile: &Profile, convo_id: ConversationID) {} #[allow(unused_variables)] fn on_new_message_from_contact(&self, cwtch: &dyn libcwtch::CwtchLib, profile: &Profile, conversation_id: ConversationID, handle: String, timestamp_received: DateTime, message: MessageWrapper) {} + + #[allow(unused_variables)] + fn on_new_message_from_group(&self, cwtch: &dyn libcwtch::CwtchLib, profile: &Profile, conversation_id: ConversationID, handle: String, timestamp_sent: DateTime, message: MessageWrapper) {} } /// Cwtch bot @@ -192,6 +195,11 @@ impl Imp { None => {}, } } + Event::NewMessageFromGroup { profile_id, conversation_id, timestamp_sent, contact_id, index, message, content_hash, picture, nick, notification, } => { + if let Some(profile )= self.profile.as_ref() { + handler.on_new_message_from_group(self.cwtch.as_ref(), profile, conversation_id.clone(), nick.clone(), timestamp_sent.clone(), message.clone()) + } + } Event::ErrUnhandled { name, data } => eprintln!("unhandled event: {}!", name), _ => (), };