log(DEFAULT,"*** BUG *** give_ops was given an invalid parameter");
return 0;
}
- if (status != STATUS_OP)
+ if (status < STATUS_OP)
{
+ log(DEBUG,"%s cant give ops to %s because they nave status %d and needs %d",user->nick,dest,status,STATUS_OP);
WriteServ(user->fd,"482 %s %s :You're not a channel operator",user->nick, chan->name);
return 0;
}
{
if (!isnick(dest))
{
+ log(DEFAULT,"the target nickname given to give_ops was invalid");
WriteServ(user->fd,"401 %s %s :No suck nick/channel",user->nick, dest);
return 0;
}
d = Find(dest);
if (!d)
{
+ log(DEFAULT,"the target nickname given to give_ops couldnt be found");
WriteServ(user->fd,"401 %s %s :No suck nick/channel",user->nick, dest);
return 0;
}
{
for (int i = 0; i != MAXCHANS; i++)
{
- if ((d->chans[i].channel == chan) && (chan != NULL))
+ if ((d->chans[i].channel != NULL) && (chan != NULL))
+ if (!strcasecmp(d->chans[i].channel->name,chan->name))
{
if (d->chans[i].uc_modes & UCMODE_OP)
{
/* mode already set on user, dont allow multiple */
+ log(DEFAULT,"The target user given to give_ops was already opped on the channel");
return 0;
}
d->chans[i].uc_modes = d->chans[i].uc_modes | UCMODE_OP;
log(DEBUG,"gave ops: %s %s",d->chans[i].channel->name,d->nick);
+ return 1;
}
}
+ log(DEFAULT,"The target channel given to give_ops was not in the users mode list");
}
}
return 1;
{
for (int i = 0; i != MAXCHANS; i++)
{
- if ((d->chans[i].channel == chan) && (chan != NULL))
+ if ((d->chans[i].channel != NULL) && (chan != NULL))
+ if (!strcasecmp(d->chans[i].channel->name,chan->name))
{
if (d->chans[i].uc_modes & UCMODE_HOP)
{
}
d->chans[i].uc_modes = d->chans[i].uc_modes | UCMODE_HOP;
log(DEBUG,"gave h-ops: %s %s",d->chans[i].channel->name,d->nick);
+ return 1;
}
}
}
{
for (int i = 0; i != MAXCHANS; i++)
{
- if ((d->chans[i].channel == chan) && (chan != NULL))
+ if ((d->chans[i].channel != NULL) && (chan != NULL))
+ if (!strcasecmp(d->chans[i].channel->name,chan->name))
{
if (d->chans[i].uc_modes & UCMODE_VOICE)
{
}
d->chans[i].uc_modes = d->chans[i].uc_modes | UCMODE_VOICE;
log(DEBUG,"gave voice: %s %s",d->chans[i].channel->name,d->nick);
+ return 1;
}
}
}
log(DEFAULT,"*** BUG *** take_ops was given an invalid parameter");
return 0;
}
- if (status != STATUS_OP)
+ if (status < STATUS_OP)
{
+ log(DEBUG,"%s cant give ops to %s because they have status %d and needs %d",user->nick,dest,status,STATUS_OP);
WriteServ(user->fd,"482 %s %s :You're not a channel operator",user->nick, chan->name);
return 0;
}
d = Find(dest);
if (!isnick(dest))
{
+ log(DEBUG,"take_ops was given an invalid target nickname of %s",dest);
WriteServ(user->fd,"401 %s %s :No suck nick/channel",user->nick, dest);
return 0;
}
if (!d)
{
+ log(DEBUG,"take_ops couldnt resolve the target nickname: %s",dest);
WriteServ(user->fd,"401 %s %s :No suck nick/channel",user->nick, dest);
return 0;
}
{
for (int i = 0; i != MAXCHANS; i++)
{
- if ((d->chans[i].channel == chan) && (chan != NULL))
+ if ((d->chans[i].channel != NULL) && (chan != NULL))
+ if (!strcasecmp(d->chans[i].channel->name,chan->name))
{
if ((d->chans[i].uc_modes & UCMODE_OP) == 0)
{
}
d->chans[i].uc_modes ^= UCMODE_OP;
log(DEBUG,"took ops: %s %s",d->chans[i].channel->name,d->nick);
+ return 1;
}
}
+ log(DEBUG,"take_ops couldnt locate the target channel in the target users list");
}
}
return 1;
{
for (int i = 0; i != MAXCHANS; i++)
{
- if ((d->chans[i].channel == chan) && (chan != NULL))
+ if ((d->chans[i].channel != NULL) && (chan != NULL))
+ if (!strcasecmp(d->chans[i].channel->name,chan->name))
{
if ((d->chans[i].uc_modes & UCMODE_HOP) == 0)
{
}
d->chans[i].uc_modes ^= UCMODE_HOP;
log(DEBUG,"took h-ops: %s %s",d->chans[i].channel->name,d->nick);
+ return 1;
}
}
}
{
for (int i = 0; i != MAXCHANS; i++)
{
- if ((d->chans[i].channel == chan) && (chan != NULL))
+ if ((d->chans[i].channel != NULL) && (chan != NULL))
+ if (!strcasecmp(d->chans[i].channel->name,chan->name))
{
if ((d->chans[i].uc_modes & UCMODE_VOICE) == 0)
{
}
d->chans[i].uc_modes ^= UCMODE_VOICE;
log(DEBUG,"took voice: %s %s",d->chans[i].channel->name,d->nick);
+ return 1;
}
}
}
return;
}
- log(DEBUG,"process_modes: start");
+ log(DEBUG,"process_modes: start: parameters=%d",pcnt);
strcpy(modelist,parameters[1]); /* mode list, e.g. +oo-o */
/* parameters[2] onwards are parameters for
break;
case 'o':
+ log(DEBUG,"Ops");
if ((param >= pcnt)) break;
+ log(DEBUG,"Enough parameters left");
if (mdir == 1)
{
+ log(DEBUG,"calling give_ops");
r = give_ops(user,parameters[param++],chan,status);
}
else
{
+ log(DEBUG,"calling take_ops");
r = take_ops(user,parameters[param++],chan,status);
}
if (r)
if (local)
{
log(DEBUG,"Local mode change");
- WriteChannelLocal(chan, user, "MODE %s",outstr);
+ WriteChannelLocal(chan, user, "MODE %s %s",chan->name,outstr);
}
else
{
return;
}
- process_modes(parameters,user,Ptr,cstatus(user,Ptr),pcnt,false,true,true);
+ process_modes(parameters,user,Ptr,cstatus(user,Ptr),pcnt,false,false,true);
}
}
pars[index++] = parameter;
parameter = strtok(NULL," ");
}
- merge_mode(pars,--index);
+ merge_mode(pars,index);
if (FindChan(target))
{
WriteChannelLocal(FindChan(target), NULL, "MODE %s",original);
return;
}
- char* o = original;
- while (o[0] != ' ')
- o++;
- o++;
-
int index = 0;
char* src = strtok(params," ");
}
log(DEBUG,"Calling merge_mode2");
- merge_mode2(pars,--index,user);
+ merge_mode2(pars,index,user);
}
}
if (privilage == '+')
{
user->chans[i].uc_modes = user->chans[i].uc_modes | UCMODE_VOICE;
- WriteChannelLocal(user->chans[i].channel, NULL, "MODE %s +o %s",channel,user->nick);
+ WriteChannelLocal(user->chans[i].channel, NULL, "MODE %s +v %s",channel,user->nick);
}
}
}