Skip to content

Commit

Permalink
who invisible change, halfop ifdefs
Browse files Browse the repository at this point in the history
Added the use_halfops ifdefs for the right parts.

Changed rwho/who output for invisible from % being invisible to I=invisible,V=visible. % now used in rwho/who for user is halfop in channel.
  • Loading branch information
holbrookb committed Mar 25, 2022
1 parent c5d9ed5 commit 9b09123
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 11 deletions.
14 changes: 11 additions & 3 deletions src/m_rwho.c
Original file line number Diff line number Diff line change
Expand Up @@ -1130,13 +1130,17 @@ static void rwho_reply(aClient *cptr, aClient *ac, char *buf, chanMember *cm)
if (IsAnOper(ac))
*dst++ = '*';
else if (IsInvisible(ac))
*dst++ = '%';
*dst++ = 'I';
else
*dst++ = 'V';
if (cm)
{
if (cm->flags & CHFL_CHANOP)
*dst++ = '@';
#ifdef USE_HALFOPS
else if (cm->flags & CHFL_HALFOP)
*dst++ = '%';
#endif
else if (cm->flags & CHFL_VOICE)
*dst++ = '+';
}
Expand Down Expand Up @@ -1229,8 +1233,10 @@ static void rwho_reply(aClient *cptr, aClient *ac, char *buf, chanMember *cm)
*dst++ = 'H';
if (IsAnOper(ac))
*dst++ = '*';
if (IsInvisible(ac))
*dst++ = '%';
else if (IsInvisible(ac))
*dst++ = 'I';
else
*dst++ = 'V';

if (!cm && (rwho_opts.rplfields & RWO_CHANNEL) && chptr)
{
Expand All @@ -1243,8 +1249,10 @@ static void rwho_reply(aClient *cptr, aClient *ac, char *buf, chanMember *cm)
{
if (cm->flags & CHFL_CHANOP)
*dst++ = '@';
#ifdef USE_HALFOPS
else if (cm->flags & CHFL_HALFOP)
*dst++ = '%';
#endif
else if (cm->flags & CHFL_VOICE)
*dst++ = '+';
}
Expand Down
37 changes: 29 additions & 8 deletions src/m_who.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,23 +254,36 @@ int build_searchopts(aClient *sptr, int parc, char *parv[])
sptr->name, "WHO", "who");
return 0;
}

#ifdef USE_HALFOPS
if (*parv[args] == '@' || *parv[args] == '%' || *parv[args] == '+')
#else
if (*parv[args] == '@' || parv[args] == '+')
#endif
{
char *cname = parv[args];

#ifdef USE_HALFOPS
while (*cname == '@' || *cname == '%' || *cname == '+')
#else
while (*cname == '@' || *cname == '+')
#endif
{
if (wsopts.channelflags)
{
if (*cname == '@') wsopts.channelflags |= CHFL_CHANOP;
#ifdef USE_HALFOPS
else if (*cname == '%') wsopts.channelflags |= CHFL_HALFOP;
#endif
else if (*cname == '+') wsopts.channelflags |= CHFL_VOICE;
}

else
{
if (*cname == '@') wsopts.channelflags = CHFL_CHANOP;
#ifdef USE_HALFOPS
else if (*cname == '%') wsopts.channelflags = CHFL_HALFOP;
#endif
else if (*cname == '+') wsopts.channelflags = CHFL_VOICE
}

Expand Down Expand Up @@ -806,10 +819,13 @@ int m_who(aClient *cptr, aClient *sptr, int parc, char *parv[])
/* wow, they passed it all, give them the reply...
* IF they haven't reached the max, or they're an oper */
status[i++]=(ac->user->away==NULL ? 'H' : 'G');
status[i]=(IsAnOper(ac) ? '*' : ((IsInvisible(ac) &&
IsOper(sptr)) ? '%' : 0));
status[i]=(IsAnOper(ac) ? '*' :
((IsInvisible(ac) && IsOper(sptr)) ? 'I' :
(!IsInvisible(ac) && IsOper(sptr)) ? 'V' : 0));
status[((status[i]) ? ++i : i)]=(cm->flags&CHFL_CHANOP) ? '@' :
#ifdef USE_HALFOPS
(cm->flags&CHFL_HALFOP) ? '%' :
#endif
(cm->flags&CHFL_VOICE) ? '+' : 0;
status[++i]=0;
sendto_one(sptr, getreply(RPL_WHOREPLY), me.name, sptr->name,
Expand Down Expand Up @@ -839,8 +855,9 @@ int m_who(aClient *cptr, aClient *sptr, int parc, char *parv[])
else
{
status[0]=(ac->user->away==NULL ? 'H' : 'G');
status[1]=(IsAnOper(ac) ? '*' : (IsInvisible(ac) &&
IsAnOper(sptr) ? '%' : 0));
status[1]=(IsAnOper(ac) ? '*' :
((IsInvisible(ac) && IsAnOper(sptr)) ? 'I' :
(!IsInvisible(ac) && IsAnOper(sptr)) ? 'V' : 0));
status[2]=0;
sendto_one(sptr, getreply(RPL_WHOREPLY), me.name, sptr->name,
wsopts.show_chan ? first_visible_channel(ac, sptr)
Expand Down Expand Up @@ -877,10 +894,13 @@ int m_who(aClient *cptr, aClient *sptr, int parc, char *parv[])

i = 0;
status[i++]=(ac->user->away==NULL ? 'H' : 'G');
status[i]=(IsAnOper(ac) ? '*' : ((IsInvisible(ac) &&
IsOper(sptr)) ? '%' : 0));
status[i]=(IsAnOper(ac) ? '*' :
((IsInvisible(ac) && IsOper(sptr)) ? 'I' :
(!IsInvisible(ac) && IsOper(sptr)) ? 'V' : 0));
status[((status[i]) ? ++i : i)]=(cm->flags&CHFL_CHANOP) ? '@' :
#ifdef USE_HALFOPS
(cm->flags&CHFL_HALFOP) ? '%' :
#endif
(cm->flags&CHFL_VOICE) ? '+' : 0;
status[++i]=0;
sendto_one(sptr, getreply(RPL_WHOREPLY), me.name, sptr->name,
Expand All @@ -906,8 +926,9 @@ int m_who(aClient *cptr, aClient *sptr, int parc, char *parv[])
break; /* break out of loop so we can send end of who */
}
status[0]=(ac->user->away==NULL ? 'H' : 'G');
status[1]=(IsAnOper(ac) ? '*' : (IsInvisible(ac) &&
IsAnOper(sptr) ? '%' : 0));
status[1]=(IsAnOper(ac) ? '*' :
((IsInvisible(ac) && IsAnOper(sptr)) ? 'I' :
(!IsInvisible(ac) && IsAnOper(sptr)) ? 'V' : 0));
status[2]=0;
sendto_one(sptr, getreply(RPL_WHOREPLY), me.name, sptr->name,
wsopts.show_chan ? first_visible_channel(ac, sptr) :
Expand Down

0 comments on commit 9b09123

Please sign in to comment.