From a5ebe4284bd6b8f0a3de9a2b619acc9d295c8cd9 Mon Sep 17 00:00:00 2001 From: "NG (Graham)" Date: Sun, 25 Jan 2026 15:03:28 -0500 Subject: [PATCH] Fix joining battle chats (and other existing chats) --- rc_chat_room/src/operations/send_message.rs | 2 +- rc_chat_room/src/state/chat/chat.rs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/rc_chat_room/src/operations/send_message.rs b/rc_chat_room/src/operations/send_message.rs index 2445276..780dcdd 100644 --- a/rc_chat_room/src/operations/send_message.rs +++ b/rc_chat_room/src/operations/send_message.rs @@ -34,7 +34,7 @@ impl SimpleOperation for PublicMessageSender { "".to_owned() }; let chat_system = self.chat.system().await; - log::debug!("Got message `{}` from user {} ({} @ {}/{:?})", message_text.string, user.public_id(), chat_loc, channel_name.string, channel_enum); + log::debug!("Got message `{}` from user {} ({} @ {}/{:?})", message_text.string, user.public_id(), channel_name.string, chat_loc, channel_enum); chat_system.handle_public_message(user.as_ref().as_ref(), message_text.string, channel_name.string, channel_enum).await; } } diff --git a/rc_chat_room/src/state/chat/chat.rs b/rc_chat_room/src/state/chat/chat.rs index e2b0243..941990f 100644 --- a/rc_chat_room/src/state/chat/chat.rs +++ b/rc_chat_room/src/state/chat/chat.rs @@ -80,9 +80,11 @@ impl ChatSystem { pub fn join_channel(&mut self, display_name: String, channel: String, channel_ty: crate::data::channel::ChatChannelType) { if let Some(user_handle) = self.online_users.get(&display_name) { - if let Some(chat_room) = self.chats.get_mut(&channel) { + if let Some(chat_room) = self.chats.get_mut(&channel.to_lowercase()) { + log::debug!("Connecting {} to channel {} ({:?})", display_name, channel, channel_ty); chat_room.connect_user(user_handle.to_owned()); } else { + log::debug!("Connecting {} to new channel {} ({:?})", display_name, channel, channel_ty); let mut new_room = super::ChatRoom::new(channel.clone(), channel_ty); new_room.connect_user(user_handle.to_owned()); self.chats.insert(channel.to_lowercase(), new_room);