globops + autodrop: /GLOBOPS oper broadcast and pre-registration scanner drop

This commit is contained in:
Jean Chevronnet 2026-08-10 08:58:15 +00:00
parent ab4d87488b
commit 512185d6df
4 changed files with 89 additions and 0 deletions

35
src/modules/globops.rs Normal file
View file

@ -0,0 +1,35 @@
//! globops — `GLOBOPS <message>` lets an oper send a message to all opers (the
//! server-notice stream, echoIRCd's equivalent of InspIRCd's `+g` snomask).
//! Reference: InspIRCd's `m_globops`. Original native Rust.
use crate::command::{CmdResult, Command};
use crate::numeric::ERR_NOPRIVILEGES;
use crate::server::Server;
use crate::Uid;
pub fn commands() -> Vec<Box<dyn Command>> {
vec![Box::new(GlobopsCmd)]
}
struct GlobopsCmd;
impl Command for GlobopsCmd {
fn name(&self) -> &'static str {
"GLOBOPS"
}
fn min_params(&self) -> usize {
1
}
fn handle(&self, s: &mut Server, uid: Uid, params: &[String]) -> CmdResult {
if !s.is_oper(uid) {
s.numeric(
uid,
ERR_NOPRIVILEGES,
":Permission Denied- You're not an IRC operator",
);
return CmdResult::Fail;
}
let nick = s.users.get(&uid).map(|u| u.nick.clone()).unwrap_or_default();
s.snotice(&format!("GLOBOPS from {nick}: {}", params.join(" ")));
CmdResult::Ok
}
}