mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
Fix auto-selecting chat channel, add some more config options
This commit is contained in:
@@ -4,17 +4,14 @@ use polariton_server::operations::{Operation, OperationCode};
|
||||
//use crate::persist::chat_user::{ChatUser, ChatUserImpl};
|
||||
//use oj_rc_core::persist::user::ChatUser;
|
||||
|
||||
pub struct MoreLobbyAuth {
|
||||
chat_system: crate::state::chat::ChatImpl,
|
||||
}
|
||||
pub struct MoreLobbyAuth;
|
||||
|
||||
impl MoreLobbyAuth {
|
||||
const AUTH_PAYLOAD_KEY: u8 = 245;
|
||||
|
||||
pub fn new(chat_system: crate::state::chat::ChatImpl) -> Self {
|
||||
Self {
|
||||
chat_system,
|
||||
}
|
||||
#[inline]
|
||||
pub fn new() -> Self {
|
||||
Self
|
||||
}
|
||||
|
||||
/*fn build_ext_map(&self, token: &oj_rc_core::persist::user::UserToken) -> Option<std::collections::HashMap<std::any::TypeId, Box<dyn std::any::Any + Send + Sync + 'static>>> {
|
||||
@@ -33,12 +30,12 @@ impl MoreLobbyAuth {
|
||||
async fn do_auth<C>(&self, params: std::collections::HashMap<u8, Typed<C>>, user: &crate::UserTy) -> Result<polariton::operation::ParameterTable<C>, i16> {
|
||||
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.public_id().to_owned();
|
||||
//let user_impl = user.user()?;
|
||||
//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();
|
||||
self.chat_system.system_mut().connect_user(name, channels, event_tx);
|
||||
//let channels = user_impl.subscribed_channels_strings().await?;
|
||||
//let event_tx = user.event_chann();
|
||||
//self.chat_system.system_mut().connect_user(name, channels, event_tx);
|
||||
let mut resp_params = std::collections::HashMap::new();
|
||||
resp_params.insert(Self::AUTH_PAYLOAD_KEY, polariton::operation::Typed::Byte(0));
|
||||
return Ok(resp_params.into());
|
||||
|
||||
Reference in New Issue
Block a user