operserv: NOTIFY feed uses labelled fields (IP/DNS/Account/Server) and Service:verb
All checks were successful
CI / check (push) Successful in 4m5s
All checks were successful
CI / check (push) Successful in 4m5s
This commit is contained in:
parent
4247df8844
commit
617d3c7966
3 changed files with 13 additions and 13 deletions
|
|
@ -75,19 +75,19 @@ impl Engine {
|
|||
if to.eq_ignore_ascii_case(svc.uid()) || to.eq_ignore_ascii_case(svc.nick()) {
|
||||
let args: Vec<&str> = text.split_whitespace().collect();
|
||||
svc.on_command(&sender, &args, &mut ctx, network, db);
|
||||
matched = Some(svc.nick().to_ascii_lowercase());
|
||||
matched = Some(svc.nick().to_string()); // real case, for the feed line
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(nick) = matched {
|
||||
self.bump(&format!("{nick}.command"));
|
||||
self.bump(&format!("{}.command", nick.to_ascii_lowercase()));
|
||||
// NOTIFY watch on services use: log the service + verb only (never
|
||||
// the arguments, which may carry a password). SET commands carry the
|
||||
// 'S' flag, everything else 's'.
|
||||
let verb = text.split_whitespace().next().unwrap_or("").to_ascii_uppercase();
|
||||
let flag = if verb == "SET" { 'S' } else { 's' };
|
||||
if let Some(line) = self.notify_line(flag, from, None, &format!("used {nick} {verb}")) {
|
||||
// the arguments, which may carry a password), as "Service:verb". A
|
||||
// SET command carries the 'S' flag, everything else 's'.
|
||||
let verb = text.split_whitespace().next().unwrap_or("").to_ascii_lowercase();
|
||||
let flag = if verb == "set" { 'S' } else { 's' };
|
||||
if let Some(line) = self.notify_line(flag, from, None, &format!("used {nick}:{verb}")) {
|
||||
ctx.actions.push(line);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -397,17 +397,17 @@ impl Engine {
|
|||
// it still correlates with what ordinary users see.
|
||||
let mut parts: Vec<String> = Vec::new();
|
||||
if !target.ip.is_empty() {
|
||||
let mut s = format!("\x02{}\x02", target.ip);
|
||||
let mut s = format!("IP: \x02{}\x02", target.ip);
|
||||
if !target.realhost.is_empty() && target.realhost != target.ip {
|
||||
s.push_str(&format!(" ({})", target.realhost));
|
||||
s.push_str(&format!(" DNS: {}", target.realhost));
|
||||
}
|
||||
parts.push(s);
|
||||
}
|
||||
if let Some(account) = target.account {
|
||||
parts.push(format!("acct \x02{account}\x02"));
|
||||
parts.push(format!("Account: \x02{account}\x02"));
|
||||
}
|
||||
if !target.server.is_empty() {
|
||||
parts.push(format!("via {}", target.server));
|
||||
parts.push(format!("Server: {}", target.server));
|
||||
}
|
||||
let detail = if parts.is_empty() { String::new() } else { format!(" · {}", parts.join(" · ")) };
|
||||
let who = format!("\x02{}\x02!{}@{}", target.nick, target.ident, target.host);
|
||||
|
|
|
|||
|
|
@ -5415,8 +5415,8 @@ fn notify_hook_emits_feed_for_watched_user() {
|
|||
assert!(
|
||||
out.iter().any(|a| matches!(a, NetAction::Privmsg { from, to, text }
|
||||
if from == "42SAAAAAO" && to == "#services" && text.contains("[NOTIFY]") && text.contains("connected")
|
||||
&& text.contains("1.2.3.4"))), // the real IP is carried, not just the cloak
|
||||
"expected a NOTIFY connect line with the real IP, got {out:?}"
|
||||
&& text.contains("IP: ") && text.contains("1.2.3.4"))), // real IP carried under a label, not just the cloak
|
||||
"expected a NOTIFY connect line with a labelled real IP, got {out:?}"
|
||||
);
|
||||
// A clean user draws nothing.
|
||||
e.handle(NetEvent::UserConnect { uid: "000AAAAAD".into(), nick: "nice".into(), host: "h".into(), ip: "9.9.9.9".into() });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue