Tracks channel membership (join/part/kick), the current key, and per-nick last-seen in the network view. Entry messages greet joiners; enforce re-applies the lock, access modes and auto-kicks to everyone present; getkey reports the key; seen reports last activity; clone copies a channel's settings; aop/sop/vop are tiered shortcuts over the access list.
18 lines
766 B
Rust
18 lines
766 B
Rust
use crate::engine::service::{Sender, ServiceCtx};
|
|
use crate::engine::state::Network;
|
|
|
|
// SEEN <nick>: when a nick was last seen, and doing what.
|
|
pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx, net: &Network) {
|
|
let Some(&nick) = args.get(1) else {
|
|
ctx.notice(me, from.uid, "Syntax: SEEN <nick>");
|
|
return;
|
|
};
|
|
if net.uid_by_nick(nick).is_some() {
|
|
ctx.notice(me, from.uid, format!("\x02{nick}\x02 is currently online."));
|
|
return;
|
|
}
|
|
match net.last_seen(nick) {
|
|
Some(s) => ctx.notice(me, from.uid, format!("\x02{}\x02 was last seen {} ({}).", s.nick, super::human_time(s.ts), s.what)),
|
|
None => ctx.notice(me, from.uid, format!("I have no record of \x02{nick}\x02.")),
|
|
}
|
|
}
|