From 28092fc4bf4b180276669d4a9484c6193f5e6fe5 Mon Sep 17 00:00:00 2001 From: Jazzzzz-hub Date: Thu, 15 Oct 2026 09:05:41 +0000 Subject: [PATCH 1/2] Add WHOIS privacy user mode +p --- doc/opers.txt | 5 +++++ include/numeric.h | 1 + include/struct.h | 11 +++++++---- src/m_who.c | 4 +++- src/s_err.c | 4 ++-- src/s_user.c | 10 +++++++++- 6 files changed, 27 insertions(+), 8 deletions(-) diff --git a/doc/opers.txt b/doc/opers.txt index 04007216..8904217e 100755 --- a/doc/opers.txt +++ b/doc/opers.txt @@ -22,6 +22,7 @@ Usermodes: (* designates that the umode is oper only) +S - Is connected using a secure connection (SSL). +H - When enabled, masks a client's hostname. +P - When enabled, opt's out of server side spam filter protection. + +p - Hides non-shared channels in WHO/WHOIS and WHOIS idle/signon. *+a - Designates the oper as being a Services Administrator. *+b - Can see chatops messages. *+c - Can see client connections and exits. @@ -42,6 +43,10 @@ Usermodes: (* designates that the umode is oper only) *+O - Is a local IRC Operator. *+I - When enabled, allows 'hidden' opers. (unlisted in /stats p, etc.) + +p keeps shared channels visible and does not hide membership from + NAMES or WHO #channel. Opers and the user themselves retain full + WHOIS visibility. + =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Oper Commands: (+ indicates that /quote must be used with ircII) diff --git a/include/numeric.h b/include/numeric.h index 624cc308..76c51dc2 100644 --- a/include/numeric.h +++ b/include/numeric.h @@ -108,6 +108,7 @@ #define RPL_WHOISIDLE 317 #define RPL_ENDOFWHOIS 318 #define RPL_WHOISCHANNELS 319 +#define RPL_WHOISPRIVACY 320 #define RPL_LISTSTART 321 #define RPL_LIST 322 diff --git a/include/struct.h b/include/struct.h index 1988200d..a6abac18 100644 --- a/include/struct.h +++ b/include/struct.h @@ -329,9 +329,11 @@ typedef struct SServicesTag ServicesTag; #define UMODE_S 0x10000000 /* umode +S - User is using SSL */ #define UMODE_C 0x20000000 /* umode +C - User is only accepting private messages from users who share a common channel with them */ #define UMODE_H 0x40000000 /* umode +H - User is host-masked */ +#define UMODE_p 0x80000000L /* umode +p - WHOIS privacy */ -/* WARNING: Do not add any values greater than 0x40000000 unless you change Client->umode to unsigned long - (and change everything else to support it) -Kobi & xPsycho. */ +/* WARNING: Do not add values greater than 0x80000000L unless you widen + Client->umode and all user-mode storage and masks accordingly. + -Kobi & xPsycho; updated by Jazzzzz. */ /* for sendto_ops_lev */ @@ -354,13 +356,13 @@ typedef struct SServicesTag ServicesTag; * that mode will be 'silent.' */ -#define SEND_UMODES (UMODE_a|UMODE_i|UMODE_o|UMODE_r|UMODE_A|UMODE_I|UMODE_R|UMODE_S|UMODE_C|UMODE_H|UMODE_P) +#define SEND_UMODES (UMODE_a|UMODE_i|UMODE_o|UMODE_r|UMODE_A|UMODE_I|UMODE_R|UMODE_S|UMODE_C|UMODE_H|UMODE_P|UMODE_p) #define ALL_UMODES (SEND_UMODES|UMODE_b|UMODE_c|UMODE_d|UMODE_e|UMODE_f|\ UMODE_g|UMODE_h|UMODE_j|UMODE_k|UMODE_m|UMODE_n|UMODE_s|\ UMODE_w|UMODE_y|UMODE_F|UMODE_K|UMODE_O) /* modes users can set themselves */ -#define USER_UMODES (UMODE_i|UMODE_k|UMODE_w|UMODE_s|UMODE_R|UMODE_C|UMODE_H|UMODE_P) +#define USER_UMODES (UMODE_i|UMODE_k|UMODE_w|UMODE_s|UMODE_R|UMODE_C|UMODE_H|UMODE_P|UMODE_p) /* modes only opers can have */ #define OPER_UMODES (UMODE_a|UMODE_b|UMODE_c|UMODE_d|UMODE_e|UMODE_f|UMODE_g|\ @@ -396,6 +398,7 @@ typedef struct SServicesTag ServicesTag; #define IsUmodeI(x) ((x)->umode & UMODE_I) #define IsUmodeH(x) ((x)->umode & UMODE_H) #define IsUmodeP(x) ((x)->umode & UMODE_P) +#define IsUmodep(x) ((x)->umode & UMODE_p) #define IsNoNonReg(x) ((x)->umode & UMODE_R) #define IsWSquelch(x) ((x)->umode & UMODE_x) #define IsSSquelch(x) ((x)->umode & UMODE_X) diff --git a/src/m_who.c b/src/m_who.c index 5e44a09d..d39b72d3 100644 --- a/src/m_who.c +++ b/src/m_who.c @@ -704,7 +704,9 @@ static inline char *first_visible_channel(aClient *cptr, aClient *sptr) { for(lp = cptr->user->channel; lp; lp = lp->next) { - if(ShowChannel(sptr, lp->value.chptr)) + if(ShowChannel(sptr, lp->value.chptr) && + (!IsUmodep(cptr) || IsAnOper(sptr) || sptr == cptr || + IsMember(sptr, lp->value.chptr))) break; } if(lp) diff --git a/src/s_err.c b/src/s_err.c index 9a78a63f..c5cbb2b1 100644 --- a/src/s_err.c +++ b/src/s_err.c @@ -26,7 +26,7 @@ static char *replies[] = /* 002 RPL_YOURHOST */ ":%s 002 %s :Your host is %s, running " "version %s", /* 003 RPL_CREATED */ ":%s 003 %s :This server was created %s", - /* 004 RPL_MYINFO */ ":%s 004 %s %s %s aAbcCdefFghHiIjkKmnoOPrRsSwxXy " + /* 004 RPL_MYINFO */ ":%s 004 %s %s %s aAbcCdefFghHiIjkKmnoOpPrRsSwxXy " "AbceiIjklLmMnoOpPrRsStv " "beIjklov", /* 005 RPL_ISUPPORT */ ":%s 005 %s %s :are available on this server", @@ -350,7 +350,7 @@ static char *replies[] = "signon time", /* 318 RPL_ENDOFWHOIS */ ":%s 318 %s %s :End of /WHOIS list.", /* 319 RPL_WHOISCHANNELS */ ":%s 319 %s %s :%s", - /* 320 */ NULL, + /* 320 RPL_WHOISPRIVACY */ ":%s 320 %s %s :is using WHOIS privacy mode (+p)", /* 321 RPL_LISTSTART */ ":%s 321 %s Channel :Users Name", /* 322 RPL_LIST */ ":%s 322 %s %s %d :%s", /* 323 RPL_LISTEND */ ":%s 323 %s :End of /LIST", diff --git a/src/s_user.c b/src/s_user.c index bc4839c8..d6924eec 100644 --- a/src/s_user.c +++ b/src/s_user.c @@ -106,6 +106,7 @@ long user_modes[] = #ifdef SPAMFILTER UMODE_P, 'P', #endif + UMODE_p, 'p', 0, 0 }; @@ -2155,6 +2156,9 @@ m_whois(aClient *cptr, aClient *sptr, int parc, char *parv[]) for (len = 0, *buf = '\0', lp = user->channel; lp; lp = lp->next) { chptr = lp->value.chptr; + if (IsUmodep(acptr) && !IsAnOper(sptr) && sptr != acptr && + !IsMember(sptr, chptr)) + continue; showchan=ShowChannel(sptr,chptr); if (showchan || IsAdmin(sptr)) { @@ -2213,6 +2217,9 @@ m_whois(aClient *cptr, aClient *sptr, int parc, char *parv[]) user->away); if(IsUmodeS(acptr)) sendto_one(sptr, rpl_str(RPL_USINGSSL), me.name, parv[0], name); + if(IsUmodep(acptr)) + sendto_one(sptr, rpl_str(RPL_WHOISPRIVACY), + me.name, parv[0], name); buf[0] = '\0'; if (IsAnOper(acptr)) @@ -2265,7 +2272,8 @@ m_whois(aClient *cptr, aClient *sptr, int parc, char *parv[]) } /* don't give away that this oper is on this server if they're hidden! */ - if (acptr->user && MyConnect(acptr) && ((sptr == acptr) || + if ((!IsUmodep(acptr) || IsAnOper(sptr) || sptr == acptr) && + acptr->user && MyConnect(acptr) && ((sptr == acptr) || !IsUmodeI(acptr) || (parc > 2) || IsAnOper(sptr))) sendto_one(sptr, rpl_str(RPL_WHOISIDLE), me.name, parv[0], name, timeofday - user->last, acptr->firsttime); From 284a12a16fd05ce96c6eae664dd30b6afd2afb68 Mon Sep 17 00:00:00 2001 From: Jazzzzz <45793598+Jazzzzz-hub@users.noreply.github.com> Date: Thu, 15 Oct 2026 12:56:37 +0100 Subject: [PATCH 2/2] Update opers.txt --- doc/opers.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/opers.txt b/doc/opers.txt index 8904217e..df50ccc5 100755 --- a/doc/opers.txt +++ b/doc/opers.txt @@ -4,6 +4,7 @@ The following outlines features and commands available on the Bahamut server - 02-Oct-2004 - Quension (quension@dal.net) - 25-Aug-2018 - Visigoth (visigoth@dal.net) - 30-Sep-2018 - Holbrook (holbrook@dal.net) +- 15-Oct-2026 - Jazzzzz (dreamhealer@hotmail.co.uk) Original ircd-hybrid opers.txt written by ThemBones (kraemer@u.washington.edu)