Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add notifications to IRCops when they get restricted information. #171

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/numeric.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@
#define RPL_ENDOFWHOIS 318
#define RPL_WHOISCHANNELS 319

#define RPL_OPERONLY 320

#define RPL_LISTSTART 321
#define RPL_LIST 322
#define RPL_LISTEND 323
Expand Down
14 changes: 14 additions & 0 deletions src/channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -2088,6 +2088,10 @@ static int set_mode(aClient *cptr, aClient *sptr, aChannel *chptr,
break;
}

/* Let IRCops know if they're getting information not visible to normal users */
if((chptr->xflags & XFLAG_HIDE_MODE_LISTS) && IsAnOper(sptr))
sendto_one(sptr, rpl_str(RPL_OPERONLY), me.name, cptr->name, chptr->chname, "+I");

for (invite = chptr->invite_list; invite; invite = invite->next)
sendto_one(sptr, rpl_str(RPL_INVITELIST), me.name, cptr->name,
chptr->chname, invite->invstr, invite->who, invite->when);
Expand Down Expand Up @@ -2170,6 +2174,11 @@ static int set_mode(aClient *cptr, aClient *sptr, aChannel *chptr,
anylistsent = 1;
break;
}

/* Let IRCops know if they're getting information not visible to normal users */
if((chptr->xflags & XFLAG_HIDE_MODE_LISTS) && IsAnOper(sptr))
sendto_one(sptr, rpl_str(RPL_OPERONLY), me.name, cptr->name, chptr->chname, "+e");

for (exempt = chptr->banexempt_list; exempt; exempt = exempt->next)
sendto_one(sptr, rpl_str(RPL_EXEMPTLIST), me.name, cptr->name,
chptr->chname, exempt->banstr, exempt->who, exempt->when);
Expand Down Expand Up @@ -2252,6 +2261,11 @@ static int set_mode(aClient *cptr, aClient *sptr, aChannel *chptr,
anylistsent = 1;
break;
}

/* Let IRCops know if they're getting information not visible to normal users */
if((chptr->xflags & XFLAG_HIDE_MODE_LISTS) && IsAnOper(sptr))
sendto_one(sptr, rpl_str(RPL_OPERONLY), me.name, cptr->name, chptr->chname, "+b");

for(bp=chptr->banlist;bp;bp=bp->next)
sendto_one(sptr, rpl_str(RPL_BANLIST), me.name, cptr->name,
chptr->chname, bp->banstr, bp->who, bp->when);
Expand Down
4 changes: 2 additions & 2 deletions src/s_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,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_OPERONLY */ ":%s 320 %s %s :Returned %s data is not visible to normal users",
/* 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",
Expand All @@ -367,7 +367,7 @@ static char *replies[] =
/* 335 */ NULL,
/* 336 */ NULL,
/* 337 RPL_WHOISTEXT*/ ":%s 337 %s %s :%s",
/* 338 RPL_WHOISACTUALLY */ ":%s 338 %s %s :is actually %s@%s [%s]",
/* 338 RPL_WHOISACTUALLY */ ":%s 338 %s %s :is actually %s@%s [%s] [IRCop Restricted Information]",
/* 339 */ NULL,
/* 340 */ NULL,
/* 341 RPL_INVITING */ ":%s 341 %s %s %s",
Expand Down
16 changes: 12 additions & 4 deletions src/s_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -2204,8 +2204,8 @@ m_whois(aClient *cptr, aClient *sptr, int parc, char *parv[])

if(IsAnOper(sptr) && IsSquelch(acptr))
sendto_one(sptr, rpl_str(RPL_WHOISTEXT), me.name, parv[0], name,
IsWSquelch(acptr) ? "User is squelched (warned)" :
"User is squelched (silent)");
IsWSquelch(acptr) ? "User is squelched (warned) [IRCop Restricted Information]" :
"User is squelched (silent) [IRCop Restricted Information]");

if(IsRegNick(acptr))
sendto_one(sptr, rpl_str(RPL_WHOISREGNICK), me.name, parv[0], name);
Expand All @@ -2232,8 +2232,16 @@ m_whois(aClient *cptr, aClient *sptr, int parc, char *parv[])
{
servicestag = acptr->user->servicestag;
while(servicestag)
{
if(*servicestag->tag && (!servicestag->umode || (sptr->umode & servicestag->umode))) sendto_one(sptr, ":%s %d %s %s :%s", me.name, servicestag->raw, parv[0], name, servicestag->tag);
{
if(*servicestag->tag)
{
/* If servicestag->umode is unset, this is viewable by everybody. */
if(!servicestag->umode)
sendto_one(sptr, ":%s %d %s %s :%s", me.name, servicestag->raw, parv[0], name, servicestag->tag);
/* Otherwise, it can only be viewed by users with the correct umode (usually +o or higher) */
else if(sptr->umode & servicestag->umode)
sendto_one(sptr, ":%s %d %s %s :%s [IRCop Restricted Information]", me.name, servicestag->raw, parv[0], name, servicestag->tag);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is problematic and conflicts with our current SVSTAG usage.

Kobi.

}
servicestag = servicestag->next;
}
}
Expand Down