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

Add some basic commands for sysadmins and permission system for them

This commit is contained in:
NG (Graham)
2025-10-31 21:02:10 -04:00
parent 77b6d8c11f
commit 3ef1aa20d0
13 changed files with 290 additions and 29 deletions

View File

@@ -39,6 +39,12 @@ impl IntercomHandler {
};
emitter.emit(event);
},
IntercomWebServiceUserMessage::Maintenance(msg) => {
let event = super::MaintenanceMode {
message: msg.message,
};
emitter.emit(event);
}
}
} else {
break;

View File

@@ -0,0 +1,18 @@
pub struct MaintenanceMode {
pub message: String,
}
impl <C: Send + Sync + 'static> polariton_server::events::IntoEvent<C> for MaintenanceMode {
const CHANNEL: u8 = 0;
const ENCRYPT: bool = true;
const RELIABLE: bool = true;
fn into_event(self) -> polariton::operation::Event<C> {
let mut params = polariton::operation::ParameterTable::with_capacity(1);
params.insert(19, polariton::operation::Typed::Str(self.message.clone().into()));
polariton::operation::Event {
code: 3,
params,
}
}
}

View File

@@ -3,3 +3,6 @@ pub use handler::IntercomHandler;
mod dev_message;
pub use dev_message::DevMessage;
mod maintenance_mode;
pub use maintenance_mode::MaintenanceMode;