modules: move all per-module state/config out of server.rs/config.rs into own files
This commit is contained in:
parent
0d4c9297b5
commit
131471e245
18 changed files with 525 additions and 425 deletions
17
src/modules/profilelink.rs
Normal file
17
src/modules/profilelink.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
//! profileLink — InspIRCd `m_profileLink`. Adds a profile URL to WHOIS for
|
||||
//! logged-in users from `profilelink_baseurl = <url>`. Config-driven; nothing
|
||||
//! lives on `Server`.
|
||||
|
||||
use crate::server::Server;
|
||||
|
||||
/// The WHOIS profile line for `account`, or `None` when unconfigured.
|
||||
pub fn line(s: &Server, account: &Option<String>) -> Option<String> {
|
||||
let base = s.conf("profilelink_baseurl")?;
|
||||
if base.is_empty() {
|
||||
return None;
|
||||
}
|
||||
Some(match account {
|
||||
Some(acct) => format!("Profil: {base}{acct}"),
|
||||
None => "Profile: The user is not logged in or the account is not registered.".to_string(),
|
||||
})
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue