feat: handle new message

This commit is contained in:
reya
2025-01-12 12:39:05 +07:00
parent 7925db925e
commit 923966fb95
7 changed files with 199 additions and 507 deletions
+10
View File
@@ -54,6 +54,7 @@ pub struct Room {
pub members: Vec<Member>, // Extract from event's tags
pub last_seen: Timestamp,
pub is_group: bool,
pub new_messages: Vec<Event>, // Hold all new messages
}
impl Room {
@@ -87,6 +88,15 @@ impl Room {
title,
last_seen,
is_group,
new_messages: vec![],
}
}
pub fn metadata(&self, public_key: PublicKey) -> Metadata {
if let Some(member) = self.members.iter().find(|m| m.public_key == public_key) {
member.metadata()
} else {
Metadata::default()
}
}