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

Prefix all crates with oj_ and use release version of dependencies

This commit is contained in:
NG (Graham)
2025-06-03 21:09:03 -04:00
parent d0c2b1ec03
commit f678426e10
85 changed files with 773 additions and 763 deletions

View File

@@ -6,7 +6,7 @@ pub struct ChatProvider {
}
impl ChatProvider {
pub fn new(conf: rc_core::persist::config::ChatSystemConfig) -> std::io::Result<Self> {
pub fn new(conf: oj_rc_core::persist::config::ChatSystemConfig) -> std::io::Result<Self> {
Ok(Self {
chat_system: std::sync::Arc::new(std::sync::RwLock::new(crate::state::chat::ChatSystem::new(conf)?)),
})
@@ -83,7 +83,7 @@ impl ChatSystem {
}
}
pub fn handle_public_message(&self, user: &dyn rc_core::persist::user::User<()>, text: String, channel: String, channel_ty: crate::data::channel::ChatChannelType) {
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) {
self.handle_public_command(user, text, user_handle, channel, channel_ty);
@@ -103,7 +103,7 @@ impl ChatSystem {
}
}
fn handle_public_command(&self, user: &dyn rc_core::persist::user::User<()>, text: String, handle: &super::UserHandle, channel: String, channel_ty: crate::data::channel::ChatChannelType) {
fn handle_public_command(&self, user: &dyn oj_rc_core::persist::user::User<()>, text: String, handle: &super::UserHandle, channel: String, channel_ty: crate::data::channel::ChatChannelType) {
let event_params = crate::events::chat_message::PublicMessage {
sender_name: self.config.command_username().to_owned(),
sender_display_name: self.config.command_username().to_owned(),
@@ -126,7 +126,7 @@ impl ChatSystem {
handle.send(polariton_server::ToSend::Data { data: polariton::packet::Data::Event(event), encrypt: true, channel: 0, reliable: true });
}
pub fn handle_private_message(&self, user: &dyn rc_core::persist::user::User<()>, text: String, recipient: String) {
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) {
self.handle_private_command(user, text, user_handle);
@@ -144,7 +144,7 @@ impl ChatSystem {
}
}
fn handle_private_command(&self, user: &dyn rc_core::persist::user::User<()>, text: String, handle: &super::UserHandle) {
fn handle_private_command(&self, user: &dyn oj_rc_core::persist::user::User<()>, text: String, handle: &super::UserHandle) {
let event_params = crate::events::chat_message::PrivateMessage {
sender_name: self.config.command_username().to_owned(),
sender_display_name: self.config.command_username().to_owned(),
@@ -161,7 +161,7 @@ impl ChatSystem {
handle.send_private_message(response);
}
pub fn new(config: rc_core::persist::config::ChatSystemConfig) -> std::io::Result<Self> {
pub fn new(config: oj_rc_core::persist::config::ChatSystemConfig) -> std::io::Result<Self> {
Ok(Self {
chats: HashMap::new(),
online_users: HashMap::new(),

View File

@@ -7,11 +7,11 @@ pub struct ChatSystemConfig {
#[derive(Clone, Copy)]
struct CommandContext<'a, 'b> {
chat_system: &'a super::ChatSystem,
user: &'b dyn rc_core::persist::user::User<()>,
user: &'b dyn oj_rc_core::persist::user::User<()>,
}
impl ChatSystemConfig {
pub fn from_persist(config: rc_core::persist::config::ChatSystemConfig) -> std::io::Result<Self> {
pub fn from_persist(config: oj_rc_core::persist::config::ChatSystemConfig) -> std::io::Result<Self> {
let mut compiled_commands = Vec::with_capacity(config.commands.len());
for (i, cmd) in config.commands.into_iter().enumerate() {
let compiled_command = ChatCommand::compile_command(cmd).map_err(|e| {
@@ -26,7 +26,7 @@ impl ChatSystemConfig {
})
}
pub fn perform_command(&self, text: &str, chat_system: &super::ChatSystem, user: &dyn rc_core::persist::user::User<()>,) -> String {
pub fn perform_command(&self, text: &str, chat_system: &super::ChatSystem, user: &dyn oj_rc_core::persist::user::User<()>,) -> String {
let ctx = CommandContext {
chat_system,
user,
@@ -58,7 +58,7 @@ pub struct ChatCommand {
}
impl ChatCommand {
fn compile_command(command: rc_core::persist::ChatCommand) -> Result<Self, regex::Error> {
fn compile_command(command: oj_rc_core::persist::ChatCommand) -> Result<Self, regex::Error> {
Ok(Self {
regex: regex::RegexBuilder::new(&command.regex).build()?,
op: ChatOperation::from_persist(command.op)
@@ -81,11 +81,11 @@ enum ChatOperation {
}
impl ChatOperation {
fn from_persist(op: rc_core::persist::ChatOperation) -> Self {
fn from_persist(op: oj_rc_core::persist::ChatOperation) -> Self {
match op {
rc_core::persist::ChatOperation::BuiltIn(b_in) => Self::BuiltIn(BuiltIn::from_persist(b_in)),
rc_core::persist::ChatOperation::Custom => Self::Custom,
rc_core::persist::ChatOperation::Nop => Self::Nop,
oj_rc_core::persist::ChatOperation::BuiltIn(b_in) => Self::BuiltIn(BuiltIn::from_persist(b_in)),
oj_rc_core::persist::ChatOperation::Custom => Self::Custom,
oj_rc_core::persist::ChatOperation::Nop => Self::Nop,
}
}
@@ -104,10 +104,10 @@ enum BuiltIn {
}
impl BuiltIn {
fn from_persist(b_in: rc_core::persist::BuiltInChatOperation) -> Self {
fn from_persist(b_in: oj_rc_core::persist::BuiltInChatOperation) -> Self {
match b_in {
rc_core::persist::BuiltInChatOperation::OnlineUsers => Self::OnlineUsers,
rc_core::persist::BuiltInChatOperation::TotalUsers => Self::TotalUsers,
oj_rc_core::persist::BuiltInChatOperation::OnlineUsers => Self::OnlineUsers,
oj_rc_core::persist::BuiltInChatOperation::TotalUsers => Self::TotalUsers,
}
}