simple chat window

This commit is contained in:
2024-09-28 03:42:39 -06:00
parent 8fd40a9a5a
commit de17960335
4 changed files with 430 additions and 42 deletions
+16
View File
@@ -1,6 +1,7 @@
pub mod app;
use app::ChannelState;
use app::Chat;
use app::UserState;
use dioxus::prelude::*;
@@ -656,6 +657,21 @@ fn accept_packet(
}
}
}
ControlPacket::TextMessage(u) => {
let mut server = STATE.server.write();
if u.has_message() {
let text = u.get_message().to_string();
server.chat.push(Chat {
sender: if u.has_actor() {
Some(u.get_actor())
} else {
None
},
dangerous_html: html_purifier::purifier(&text, Default::default()),
text: text,
});
}
}
_ => {}
}
}