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
|
|
@ -38,11 +38,14 @@ impl Command for Vhost {
|
|||
}
|
||||
fn handle(&self, s: &mut Server, uid: Uid, params: &[String]) -> CmdResult {
|
||||
let (user, pass) = (¶ms[0], ¶ms[1]);
|
||||
let host = s
|
||||
.vhosts
|
||||
.iter()
|
||||
.find(|(u, p, _)| u == user && p == pass)
|
||||
.map(|(_, _, h)| h.clone());
|
||||
// vhost blocks live in the config: `vhost = <user> <pass> <host>`
|
||||
let host = s.conf_all("vhost").iter().find_map(|line| {
|
||||
let mut it = line.split_whitespace();
|
||||
match (it.next(), it.next(), it.next()) {
|
||||
(Some(u), Some(p), Some(h)) if u == user && p == pass => Some(h.to_string()),
|
||||
_ => None,
|
||||
}
|
||||
});
|
||||
let nick = s
|
||||
.users
|
||||
.get(&uid)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue