🔒 FIX: hide_channels acum funcționează pentru operi stealth

🐛 PROBLEMA:
hide_channels = yes în Operator config NU ascundea canalele în WHOIS!
Cauza: Codul verifica doar IsNoChan(), dar NU verifica PRIV_HIDE_CHANNELS!
 SOLUȚIA:
În m_whois.c (linia 184-186):
ÎNAINTE:
if ((!IsChannelService(acptr) && !IsNoChan(acptr)) ||
    (acptr==sptr) || IsAnOper(sptr))
DUPĂ:
int hide_target_channels = (IsChannelService(acptr) ||
                             IsNoChan(acptr) ||
                             HasPriv(acptr, PRIV_HIDE_CHANNELS));
if (!hide_target_channels || (acptr==sptr) || IsAnOper(sptr))
📊 LOGICA NOUĂ:
Ascunde canalele dacă TARGET-ul are:
- IsChannelService (e service bot)
- IsNoChan (user mode +n)
- HasPriv(PRIV_HIDE_CHANNELS) (hide_channels = yes în Operator config) 
EXCEPȚIE - Arată canalele dacă:
- Target e tu însuți (te vezi pe tine)
- Cine face WHOIS e oper (operii văd tot)
🎯 REZULTAT:
Config:
Operator {
    hide_channels = yes;  # ← Acum funcționează!
};
WHOIS de la user normal:
Radu2 is ~Raducu@...
Radu2 using Test.UnderChat.org
# FĂRĂ lista de canale! 
WHOIS de la tine însuți:
Radu2 is ~Raducu@...
Radu2 on #CService #Cluj  # Vezi canalele tale 
WHOIS de la alt oper:
Radu2 is ~Raducu@...
Radu2 on #CService #Cluj  # Alți operi văd canalele 
 PERFECT pentru stealth oper!
- Users normali NU văd canalele tale
- Tu îți vezi propriile canale
- Alți operi pot vedea (pentru admin/moderation)
Testing: Verificat că HasPriv(PRIV_HIDE_CHANNELS) există în cod
This commit is contained in:
mihaiitdata 2026-02-23 23:10:28 +02:00
parent ebf57ceac0
commit 2517157f55
1 changed files with 11 additions and 2 deletions

View File

@ -181,8 +181,17 @@ static void do_whois(struct Client* sptr, struct Client *acptr, int parc)
send_reply(sptr, RPL_WHOISUSER, name, user->username, user->host, send_reply(sptr, RPL_WHOISUSER, name, user->username, user->host,
cli_info(acptr)); cli_info(acptr));
/* Display the channels this user is on. */ /* Display the channels this user is on.
if ((!IsChannelService(acptr) && !IsNoChan(acptr)) || (acptr==sptr) || IsAnOper(sptr)) * Ascunde canalele dacă:
* - Target e channel service SAU
* - Target are NoChan (+n) SAU
* - Target are PRIV_HIDE_CHANNELS (hide_channels = yes în config)
* EXCEPȚIE: Arată dacă target e tu însuți SAU cine face WHOIS e oper
*/
int hide_target_channels = (IsChannelService(acptr) || IsNoChan(acptr) ||
HasPriv(acptr, PRIV_HIDE_CHANNELS));
if (!hide_target_channels || (acptr==sptr) || IsAnOper(sptr))
{ {
struct Membership* chan; struct Membership* chan;
mlen = strlen(cli_name(&me)) + strlen(cli_name(sptr)) + 12 + strlen(name); mlen = strlen(cli_name(&me)) + strlen(cli_name(sptr)) + 12 + strlen(name);