From a7f6c264d1787e0e7c39dc588059ec3b671f5293 Mon Sep 17 00:00:00 2001 From: reverse Date: Wed, 19 Aug 2026 01:18:58 +0000 Subject: [PATCH] =?UTF-8?q?snoop:=20gate=20the=20per-connect/join/quit=20e?= =?UTF-8?q?println!=20behind=20snoop=5Fstderr=20(default=20off)=20?= =?UTF-8?q?=E2=80=94=20it=20wrote=20to=20stderr=20(journald)=20on=20every?= =?UTF-8?q?=20client=20event=20in=20the=20reactor=20thread,=20unbounded=20?= =?UTF-8?q?under=20a=20connect=20flood;=20the=20+c/+q=20snotices=20already?= =?UTF-8?q?=20carry=20the=20operator-facing=20signal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/snoop.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/modules/snoop.rs b/src/modules/snoop.rs index 01e60dd..846b537 100644 --- a/src/modules/snoop.rs +++ b/src/modules/snoop.rs @@ -17,13 +17,17 @@ impl Module for Snoop { .get(&uid) .map(|u| (u.nick.clone(), u.ident.clone(), u.host.clone())); if let Some((nick, ident, host)) = info { - eprintln!("[snoop] connect {nick} ({ident}@{host})"); + if srv.conf_bool("snoop_stderr", false) { + eprintln!("[snoop] connect {nick} ({ident}@{host})"); + } srv.snotice_c('c', &format!("Client connecting: {nick} ({ident}@{host})")); } } fn on_join(&mut self, srv: &mut Server, uid: Uid, chan: &str) { - if let Some(u) = srv.users.get(&uid) { - eprintln!("[snoop] {} joined {chan}", u.nick); + if srv.conf_bool("snoop_stderr", false) { + if let Some(u) = srv.users.get(&uid) { + eprintln!("[snoop] {} joined {chan}", u.nick); + } } } fn on_user_quit(&mut self, srv: &mut Server, uid: Uid, reason: &str) { @@ -40,7 +44,9 @@ impl Module for Snoop { else { return; }; - eprintln!("[snoop] quit uid={uid} ({reason})"); + if srv.conf_bool("snoop_stderr", false) { + eprintln!("[snoop] quit uid={uid} ({reason})"); + } srv.snotice_c('q', &format!("Client exiting: {nick} ({reason})")); } }