comments: strip stray reference-implementation names from a handful of module/inline comments
This commit is contained in:
parent
81e013f053
commit
5a9825ee61
5 changed files with 6 additions and 58 deletions
|
|
@ -889,7 +889,7 @@ impl Server {
|
|||
}
|
||||
// +l full — with +L redirect, bounce the user to the target instead (opers override).
|
||||
// Count every member, local AND remote (services/other-server users), so the
|
||||
// limit reflects the channel's real network-wide size like InspIRCd.
|
||||
// limit reflects the channel's real network-wide size.
|
||||
if let Some(ch) = self.channels.get(&key) {
|
||||
let full = ch
|
||||
.modes
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ pub fn apply_mode(s: &mut Server, uid: Uid, params: &[String]) -> CmdResult {
|
|||
let mut echoed: Vec<String> = Vec::new();
|
||||
// (sign, letter, displayed-param) per applied change — for hidemode filtering
|
||||
let mut changes: Vec<(char, char, Option<String>)> = Vec::new();
|
||||
// Cap mode changes per command (advertised as MODES=, default 20 like InspIRCd):
|
||||
// Cap mode changes per command (advertised as MODES=, default 20):
|
||||
// otherwise `MODE #c +bbbb…` in one line dispatches hundreds of handlers, each
|
||||
// fanning out to the whole channel and every link — a cheap amplification flood.
|
||||
let max_modes = s.conf_num("modes", 20usize).max(1);
|
||||
|
|
|
|||
|
|
@ -368,58 +368,6 @@ fn resolve(td: &TypeDef, classes: &HashMap<String, ClassDef>) -> Resolved {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn builtin_types_grant_the_right_commands() {
|
||||
let (classes, types) = builtin();
|
||||
let r = |id: &str| resolve(&types[id], &classes);
|
||||
// Network Administrator: everything.
|
||||
assert!(r("netadmin").all_commands);
|
||||
// Administrator: bans + overrides, but not services or server control.
|
||||
let admin = r("admin");
|
||||
assert!(!admin.all_commands);
|
||||
assert!(admin.commands.contains("KILL"));
|
||||
assert!(admin.commands.contains("SAMODE"));
|
||||
assert!(!admin.commands.contains("CONNECT"));
|
||||
assert!(!admin.commands.contains("SVSNICK"));
|
||||
// Services Administrator: Administrator + services.
|
||||
let sa = r("servadmin");
|
||||
assert!(sa.commands.contains("KILL"));
|
||||
assert!(sa.commands.contains("SVSNICK"));
|
||||
assert!(!sa.commands.contains("CONNECT"));
|
||||
// GlobOp: announce only.
|
||||
let g = r("globop");
|
||||
assert!(g.commands.contains("GLOBOPS"));
|
||||
assert!(!g.commands.contains("KILL"));
|
||||
// Help Operator: no gated commands.
|
||||
assert!(r("helpop").commands.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn gated_covers_privileged_commands_only() {
|
||||
assert!(gated("kill") && gated("CONNECT") && gated("SamODE"));
|
||||
assert!(!gated("WHOIS") && !gated("MKPASSWD") && !gated("PRIVMSG"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn config_opertype_overrides_and_composes() {
|
||||
let (mut classes, mut types) = builtin();
|
||||
// a custom class + type layered on top, as config would add
|
||||
classes.insert("readonly".into(), cdef(&["CHECK"], &[], "t"));
|
||||
let mut td = TypeDef { title: "Watcher".into(), ..Default::default() };
|
||||
apply_type_kv(&mut td, "classes", "readonly");
|
||||
apply_type_kv(&mut td, "commands", "GLOBOPS");
|
||||
types.insert("watcher".into(), td);
|
||||
let r = resolve(&types["watcher"], &classes);
|
||||
assert_eq!(r.title, "Watcher");
|
||||
assert!(r.commands.contains("CHECK") && r.commands.contains("GLOBOPS"));
|
||||
assert!(!r.commands.contains("KILL"));
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
//! relaymsg — `RELAYMSG <channel> <nick> <text>` (IRCv3 `draft/relaymsg`): an
|
||||
//! operator whose client negotiated the capability, and who is in the channel,
|
||||
//! sends a channel message under a spoofed "relay" nick (e.g. `discord/alice`), for
|
||||
//! stateless bridges (operator-only, as in InspIRCd — the source nick is spoofed).
|
||||
//! stateless bridges (operator-only — the source nick is spoofed).
|
||||
//! The message is
|
||||
//! tagged `@draft/relaymsg=<sender>` so clients can attribute it. The spoofed nick
|
||||
//! must contain a configured separator and must not collide with a real nick.
|
||||
|
|
@ -37,8 +37,8 @@ impl Command for RelayMsg {
|
|||
CmdResult::Fail
|
||||
};
|
||||
|
||||
// RELAYMSG spoofs an arbitrary source nick, so it's operator-only (as in
|
||||
// InspIRCd, CmdAccess::OPERATOR) — bridges run their relay as an oper.
|
||||
// RELAYMSG spoofs an arbitrary source nick, so it's operator-only —
|
||||
// bridges run their relay as an oper.
|
||||
if !s.is_oper(uid) {
|
||||
s.numeric(
|
||||
uid,
|
||||
|
|
|
|||
|
|
@ -351,7 +351,7 @@ mod tests {
|
|||
use std::sync::{mpsc, Arc};
|
||||
|
||||
// The minchanmembers bump gate must count ALL members — local plus remote
|
||||
// (services bots, users on other servers) — like InspIRCd's GetUsers().size().
|
||||
// (services bots, users on other servers).
|
||||
// Regression: counting only local members froze the score of anyone sharing a
|
||||
// channel with remote/services members (e.g. reverse + a bot in #echoircd).
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue