summaryrefslogtreecommitdiffstats
path: root/src/open_chats.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/open_chats.rs')
-rw-r--r--src/open_chats.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/open_chats.rs b/src/open_chats.rs
index ed89537..6d08c5d 100644
--- a/src/open_chats.rs
+++ b/src/open_chats.rs
@@ -5,20 +5,20 @@ use reactive_stores::{ArcStore, Store};
use tracing::debug;
use leptos::prelude::*;
-use crate::chat::MacawChat;
+use crate::chat::{ArcMacawChat, MacawChat};
#[derive(Store, Default)]
pub struct OpenChatsPanel {
// jid must be a chat in the chats map
chat_view: Option<BareJID>,
#[store(key: BareJID = |(jid, _)| jid.clone())]
- chats: IndexMap<BareJID, MacawChat>,
+ chats: IndexMap<BareJID, ArcMacawChat>,
}
-pub fn open_chat(open_chats: Store<OpenChatsPanel>, chat: MacawChat) {
+pub fn open_chat(open_chats: Store<OpenChatsPanel>, chat: ArcMacawChat) {
if let Some(jid) = &*open_chats.chat_view().read() {
if let Some((index, _jid, entry)) = open_chats.chats().write().shift_remove_full(jid) {
- let new_jid = <ArcStore<filamento::chat::Chat> as Clone>::clone(&chat.chat)
+ let new_jid = chat.get()
.correspondent()
.read()
.clone();
@@ -28,7 +28,7 @@ pub fn open_chat(open_chats: Store<OpenChatsPanel>, chat: MacawChat) {
.insert_before(index, new_jid.clone(), chat);
*open_chats.chat_view().write() = Some(new_jid);
} else {
- let new_jid = <ArcStore<filamento::chat::Chat> as Clone>::clone(&chat.chat)
+ let new_jid = chat.get()
.correspondent()
.read()
.clone();
@@ -36,7 +36,7 @@ pub fn open_chat(open_chats: Store<OpenChatsPanel>, chat: MacawChat) {
*open_chats.chat_view().write() = Some(new_jid);
}
} else {
- let new_jid = <ArcStore<filamento::chat::Chat> as Clone>::clone(&chat.chat)
+ let new_jid = chat.get()
.correspondent()
.read()
.clone();
@@ -46,18 +46,18 @@ pub fn open_chat(open_chats: Store<OpenChatsPanel>, chat: MacawChat) {
}
impl OpenChatsPanel {
- pub fn open(&mut self, chat: MacawChat) {
+ pub fn open(&mut self, chat: ArcMacawChat) {
if let Some(jid) = &mut self.chat_view {
debug!("a chat was already open");
if let Some((index, _jid, entry)) = self.chats.shift_remove_full(jid) {
- let new_jid = <ArcStore<filamento::chat::Chat> as Clone>::clone(&chat.chat)
+ let new_jid = chat.get()
.correspondent()
.read()
.clone();
self.chats.insert_before(index, new_jid.clone(), chat);
*&mut self.chat_view = Some(new_jid);
} else {
- let new_jid = <ArcStore<filamento::chat::Chat> as Clone>::clone(&chat.chat)
+ let new_jid = chat.get()
.correspondent()
.read()
.clone();
@@ -65,7 +65,7 @@ impl OpenChatsPanel {
*&mut self.chat_view = Some(new_jid);
}
} else {
- let new_jid = <ArcStore<filamento::chat::Chat> as Clone>::clone(&chat.chat)
+ let new_jid = chat.get()
.correspondent()
.read()
.clone();