echoIRCd/src/modules/mod.rs

87 lines
2.7 KiB
Rust

//! Optional, pluggable modules — echoIRCd's answer to InspIRCd's `src/modules/`.
//! Most hook lifecycle events via the [`crate::module::Module`] trait; [`dnsbl`]
//! is the exception — it's driven straight from the connection lifecycle rather
//! than the hook bus, but lives here as its own self-contained unit.
pub mod account_registration;
pub mod antimixedutf8;
pub mod antirandom;
pub mod blockamsg;
pub mod channelban;
pub mod chathistory;
pub mod cloak;
pub mod cloudflare_challenge;
pub mod connectban;
pub mod connflood;
pub mod denychans;
pub mod dnsbl;
pub mod extjwt;
pub mod filter;
pub mod flood;
pub mod hashident;
pub mod hidewhois;
pub mod jwt;
pub mod markread;
pub mod metadata;
pub mod multiline;
pub mod network_icon;
pub mod password_hash;
pub mod profilelink;
pub mod realnameban;
pub mod recaptcha;
pub mod reputation;
pub mod restrictcommands;
pub mod restrictmsg;
pub mod rpc;
pub mod securelist;
pub mod securitygroups;
pub mod serverban;
pub mod snoop;
pub mod whoisport;
use crate::command::Command;
use crate::module::Module;
/// The modules loaded at boot. (Later: load by name from the config.)
pub fn default_modules() -> Vec<Box<dyn Module>> {
vec![
Box::new(snoop::Snoop),
Box::new(flood::Flood),
Box::new(cloak::Cloak),
Box::new(antimixedutf8::AntiMixedUtf8),
Box::new(filter::Filter),
Box::new(metadata::Metadata),
Box::new(markread::MarkRead),
Box::new(multiline::Multiline),
Box::new(reputation::ReputationMod::default()),
Box::new(connflood::ConnFlood),
Box::new(antirandom::AntiRandom),
Box::new(restrictcommands::RestrictCommands),
Box::new(restrictmsg::RestrictMsg),
Box::new(blockamsg::BlockAmsg),
Box::new(connectban::ConnectBan),
Box::new(securelist::SecureList),
Box::new(hashident::HashIdent),
Box::new(recaptcha::ReCaptcha),
Box::new(cloudflare_challenge::CloudflareChallenge),
]
}
/// Commands contributed by modules (chained into the core command table), so a
/// module that adds a command keeps it in its own file, InspIRCd-style.
pub fn module_commands() -> Vec<Box<dyn Command>> {
filter::commands()
.into_iter()
.chain(metadata::commands())
.chain(markread::commands())
.chain(multiline::commands())
.chain(chathistory::commands())
.chain(reputation::commands())
.chain(securitygroups::commands())
.chain(password_hash::commands())
.chain(account_registration::commands())
.chain(recaptcha::commands())
.chain(cloudflare_challenge::commands())
.chain(extjwt::commands())
.collect()
}