mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
Fix joining battle chats (and other existing chats)
This commit is contained in:
@@ -34,7 +34,7 @@ impl <C: Send + 'static> SimpleOperation<C> for PublicMessageSender {
|
|||||||
"<unknown location>".to_owned()
|
"<unknown location>".to_owned()
|
||||||
};
|
};
|
||||||
let chat_system = self.chat.system().await;
|
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;
|
chat_system.handle_public_message(user.as_ref().as_ref(), message_text.string, channel_name.string, channel_enum).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,9 +80,11 @@ impl ChatSystem {
|
|||||||
|
|
||||||
pub fn join_channel(&mut self, display_name: String, channel: String, channel_ty: crate::data::channel::ChatChannelType) {
|
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(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());
|
chat_room.connect_user(user_handle.to_owned());
|
||||||
} else {
|
} else {
|
||||||
|
log::debug!("Connecting {} to new channel {} ({:?})", display_name, channel, channel_ty);
|
||||||
let mut new_room = super::ChatRoom::new(channel.clone(), channel_ty);
|
let mut new_room = super::ChatRoom::new(channel.clone(), channel_ty);
|
||||||
new_room.connect_user(user_handle.to_owned());
|
new_room.connect_user(user_handle.to_owned());
|
||||||
self.chats.insert(channel.to_lowercase(), new_room);
|
self.chats.insert(channel.to_lowercase(), new_room);
|
||||||
|
|||||||
Reference in New Issue
Block a user