1
0
mirror of https://git.ngram.ca/OpenJam/rc-servers synced 2026-08-23 23:08:52 +00:00

Get part way through loading (to sync) #30

This commit is contained in:
NG (Graham)
2025-07-06 17:36:52 -04:00
parent 38ab4ba799
commit 1d404db209
31 changed files with 1049 additions and 100 deletions

View File

@@ -25,7 +25,7 @@ async fn do_join_handling(params: ParameterTable<()>, user: &crate::UserTy, chat
}
let user_info = user.user()?;
//let chat_user = super::get_chat_user(user_info.as_ref().as_ref());
chat_system.system_mut().join_channel(user_info.token().uuid.clone(), chann_name.string.clone());
chat_system.system_mut().join_channel(user_info.public_id().to_owned(), chann_name.string.clone());
let response = user_info.add_subscribed_channel(chann_name.string, crate::data::channel::ChatChannelType::from_u8(chann_ty as _)?).await?;
params.insert(CHANNEL_INFO_PARAM_KEY, response);
}
@@ -62,7 +62,7 @@ async fn do_leave_handling(params: ParameterTable<()>, user: &crate::UserTy, cha
if let Some(Typed::Int(chann_ty)) = params.remove(&CHANNEL_TYPE_PARAM_KEY) {
let user_info = user.user()?;
//let chat_user = super::get_chat_user(user_info.as_ref().as_ref());
chat_system.system_mut().leave_channel(user_info.token().uuid.clone(), chann_name.string.clone());
chat_system.system_mut().leave_channel(user_info.public_id().to_owned(), chann_name.string.clone());
user_info.remove_subscribed_channel(chann_name.string, crate::data::channel::ChatChannelType::from_u8(chann_ty as _)?).await?;
}
}

View File

@@ -34,7 +34,7 @@ impl MoreLobbyAuth {
if let Some(Typed::Str(auth_payload)) = params.get(&Self::AUTH_PAYLOAD_KEY) {
if user.update_with_auth(&auth_payload.string).await {
let user_impl = user.user()?;
let name = user_impl.token().uuid.clone();
let name = user_impl.public_id().to_owned();
//let chat_user = super::get_chat_user(user_impl.as_ref().as_ref());
let channels = user_impl.subscribed_channels_strings().await?;
let event_tx = user.event_chann();

View File

@@ -16,7 +16,7 @@ pub fn send_public_message_handler(chat_system: crate::state::chat::ChatImpl) ->
if let Some(Typed::Str(message_text)) = params.remove(&MESSAGE_TEXT_PARAM_KEY) {
let user = user.user()?;
if message_text.string.bytes().len() > MAX_MESSAGE_LEN {
log::warn!("Rejecting too long chat message from {}", user.token().uuid);
log::warn!("Rejecting too long chat message from {}", user.public_id());
return Err(oj_rc_core::data::error_codes::ChatErrorCodes::Flood as i16)
}
let chat_loc = if let Some(Typed::Str(chat_loc)) = params.remove(&CHAT_LOCATION_PARAM_KEY) {
@@ -25,7 +25,7 @@ pub fn send_public_message_handler(chat_system: crate::state::chat::ChatImpl) ->
"<unknown location>".to_owned()
};
let chat_system = chat.system();
log::debug!("Got message `{}` from user {} ({} @ {}/{:?})", message_text.string, user.token().uuid, chat_loc, channel_name.string, channel_enum);
log::debug!("Got message `{}` from user {} ({} @ {}/{:?})", message_text.string, user.public_id(), chat_loc, channel_name.string, channel_enum);
chat_system.handle_public_message(user.as_ref().as_ref(), message_text.string, channel_name.string, channel_enum);
}
}
@@ -43,7 +43,7 @@ pub fn send_private_message_handler(chat_system: crate::state::chat::ChatImpl) -
if let Some(Typed::Str(message_text)) = params.remove(&MESSAGE_TEXT_PARAM_KEY) {
let user = user.user()?;
if message_text.string.bytes().len() > MAX_MESSAGE_LEN {
log::warn!("Rejecting too long chat message from {}", user.token().uuid);
log::warn!("Rejecting too long chat message from {}", user.public_id());
return Err(oj_rc_core::data::error_codes::ChatErrorCodes::Flood as i16)
}
let chat_loc = if let Some(Typed::Str(chat_loc)) = params.remove(&CHAT_LOCATION_PARAM_KEY) {
@@ -52,7 +52,7 @@ pub fn send_private_message_handler(chat_system: crate::state::chat::ChatImpl) -
"<unknown location>".to_owned()
};
let chat_system = chat.system();
log::debug!("Got message `{}` from user {} (@ {} to {})", message_text.string, user.token().uuid, chat_loc, username.string);
log::debug!("Got message `{}` from user {} (@ {} to {})", message_text.string, user.public_id(), chat_loc, username.string);
chat_system.handle_private_message(user.as_ref().as_ref(), message_text.string, username.string);
}
}

View File

@@ -85,13 +85,13 @@ impl ChatSystem {
pub fn handle_public_message(&self, user: &dyn oj_rc_core::persist::user::User<()>, text: String, channel: String, channel_ty: crate::data::channel::ChatChannelType) {
if self.config.is_command_channel(&channel) {
if let Some(user_handle) = self.online_users.get(&user.token().uuid) {
if let Some(user_handle) = self.online_users.get(user.public_id()) {
self.handle_public_command(user, text, user_handle, channel, channel_ty);
}
} else if let Some(room) = self.chats.get(&channel) {
let event_params = crate::events::chat_message::PublicMessage {
sender_name: user.token().uuid.clone(),
sender_display_name: user.token().uuid.clone(),
sender_name: user.public_id().to_owned(),
sender_display_name: user.public_id().to_owned(),
text,
is_dev: user.is_dev(),
is_mod: user.is_mod(),
@@ -128,13 +128,13 @@ impl ChatSystem {
pub fn handle_private_message(&self, user: &dyn oj_rc_core::persist::user::User<()>, text: String, recipient: String) {
if self.config.is_command_user(&recipient) {
if let Some(user_handle) = self.online_users.get(&user.token().uuid) {
if let Some(user_handle) = self.online_users.get(user.public_id()) {
self.handle_private_command(user, text, user_handle);
}
} else if let Some(recipient_handle) = self.online_users.get(&recipient) {
let private_msg = crate::events::chat_message::PrivateMessage {
sender_name: user.token().uuid.clone(),
sender_display_name: user.token().uuid.clone(),
sender_name: user.public_id().to_owned(),
sender_display_name: user.public_id().to_owned(),
text,
is_dev: user.is_dev(),
is_mod: user.is_mod(),