Skip to content

Commit

Permalink
don't cast, mildly better var names, less confusing empty string check
Browse files Browse the repository at this point in the history
  • Loading branch information
jesopo committed Jan 1, 2021
1 parent aee1347 commit 0907d3c
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions ircd/s_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -1400,11 +1400,13 @@ user_welcome(struct Client *source_p)
void
oper_up(struct Client *source_p, struct oper_conf *oper_p)
{
unsigned int old = source_p->umodes, oldsnomask = source_p->snomask, i = 0;
unsigned int old = source_p->umodes, oldsnomask = source_p->snomask;
unsigned int i = 0;
rb_dlink_node *ptr;
struct membership *mscptr;
struct Channel *chptr;
unsigned char cmode1[256], cmode2[256];
unsigned char *cmode_ptr = cmode1;
unsigned char cmodes_hidden[256], cmodes_send[256];
unsigned char *cmode_ptr = cmodes_hidden;

hook_data_umode_changed hdata;

Expand Down Expand Up @@ -1484,16 +1486,17 @@ oper_up(struct Client *source_p, struct oper_conf *oper_p)

RB_DLINK_FOREACH(ptr, source_p->user->channel.head)
{
chptr = ((struct membership *)ptr->data)->chptr;
cmode_ptr = cmode2;
mscptr = ptr->data;
chptr = mscptr->chptr;
cmode_ptr = cmodes_send;

for (i = 0; cmode1[i]; i++)
if (chptr->mode.mode & chmode_flags[cmode1[i]])
*cmode_ptr++ = cmode1[i];
for (i = 0; cmodes_hidden[i]; i++)
if (chptr->mode.mode & chmode_flags[cmodes_hidden[i]])
*cmode_ptr++ = cmodes_hidden[i];
*cmode_ptr = '\0';

if (*cmode2)
sendto_one(source_p, ":%s MODE %s +%s", me.name, chptr->chname, cmode2);
if (cmodes_send[0] != '\0')
sendto_one(source_p, ":%s MODE %s +%s", me.name, chptr->chname, cmodes_send);
}
}

Expand Down

0 comments on commit 0907d3c

Please sign in to comment.