Woohoo! Override is complete barring a few possible cleanups in the futures.
This commit is contained in:
parent
4ed822ed95
commit
b869e117f0
61
src/chmode.c
61
src/chmode.c
|
@ -1259,8 +1259,13 @@ chm_limit(struct Client *source_p, struct Channel *chptr,
|
||||||
const char *lstr;
|
const char *lstr;
|
||||||
static char limitstr[30];
|
static char limitstr[30];
|
||||||
int limit;
|
int limit;
|
||||||
|
int override = 0;
|
||||||
|
|
||||||
if(alevel != CHFL_CHANOP && alevel != CHFL_OWNER && alevel != CHFL_HALFOP)
|
if(alevel != CHFL_CHANOP && alevel != CHFL_OWNER && alevel != CHFL_HALFOP)
|
||||||
|
{
|
||||||
|
if(IsOverride(source_p))
|
||||||
|
override = 1;
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if(!(*errors & SM_ERR_NOOPS))
|
if(!(*errors & SM_ERR_NOOPS))
|
||||||
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
|
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
|
||||||
|
@ -1268,6 +1273,7 @@ chm_limit(struct Client *source_p, struct Channel *chptr,
|
||||||
*errors |= SM_ERR_NOOPS;
|
*errors |= SM_ERR_NOOPS;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(dir == MODE_QUERY)
|
if(dir == MODE_QUERY)
|
||||||
return;
|
return;
|
||||||
|
@ -1291,6 +1297,7 @@ chm_limit(struct Client *source_p, struct Channel *chptr,
|
||||||
mode_changes[mode_count].nocaps = 0;
|
mode_changes[mode_count].nocaps = 0;
|
||||||
mode_changes[mode_count].mems = ALL_MEMBERS;
|
mode_changes[mode_count].mems = ALL_MEMBERS;
|
||||||
mode_changes[mode_count].id = NULL;
|
mode_changes[mode_count].id = NULL;
|
||||||
|
mode_changes[mode_count].override = override;
|
||||||
mode_changes[mode_count++].arg = limitstr;
|
mode_changes[mode_count++].arg = limitstr;
|
||||||
|
|
||||||
chptr->mode.limit = limit;
|
chptr->mode.limit = limit;
|
||||||
|
@ -1308,6 +1315,7 @@ chm_limit(struct Client *source_p, struct Channel *chptr,
|
||||||
mode_changes[mode_count].nocaps = 0;
|
mode_changes[mode_count].nocaps = 0;
|
||||||
mode_changes[mode_count].mems = ALL_MEMBERS;
|
mode_changes[mode_count].mems = ALL_MEMBERS;
|
||||||
mode_changes[mode_count].id = NULL;
|
mode_changes[mode_count].id = NULL;
|
||||||
|
mode_changes[mode_count].override = override;
|
||||||
mode_changes[mode_count++].arg = NULL;
|
mode_changes[mode_count++].arg = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1318,15 +1326,22 @@ chm_throttle(struct Client *source_p, struct Channel *chptr,
|
||||||
const char **parv, int *errors, int dir, char c, long mode_type)
|
const char **parv, int *errors, int dir, char c, long mode_type)
|
||||||
{
|
{
|
||||||
int joins = 0, timeslice = 0;
|
int joins = 0, timeslice = 0;
|
||||||
|
int override = 0;
|
||||||
|
|
||||||
if(alevel != CHFL_CHANOP && alevel != CHFL_OWNER && alevel != CHFL_HALFOP)
|
if(alevel != CHFL_CHANOP && alevel != CHFL_OWNER && alevel != CHFL_HALFOP)
|
||||||
{
|
{
|
||||||
|
if(IsOverride(source_p))
|
||||||
|
override = 1;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
if(!(*errors & SM_ERR_NOOPS))
|
if(!(*errors & SM_ERR_NOOPS))
|
||||||
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
|
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
|
||||||
me.name, source_p->name, chptr->chname);
|
me.name, source_p->name, chptr->chname);
|
||||||
*errors |= SM_ERR_NOOPS;
|
*errors |= SM_ERR_NOOPS;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(dir == MODE_QUERY)
|
if(dir == MODE_QUERY)
|
||||||
return;
|
return;
|
||||||
|
@ -1347,6 +1362,7 @@ chm_throttle(struct Client *source_p, struct Channel *chptr,
|
||||||
mode_changes[mode_count].nocaps = 0;
|
mode_changes[mode_count].nocaps = 0;
|
||||||
mode_changes[mode_count].mems = ALL_MEMBERS;
|
mode_changes[mode_count].mems = ALL_MEMBERS;
|
||||||
mode_changes[mode_count].id = NULL;
|
mode_changes[mode_count].id = NULL;
|
||||||
|
mode_changes[mode_count].override = override;
|
||||||
mode_changes[mode_count++].arg = parv[(*parn)];
|
mode_changes[mode_count++].arg = parv[(*parn)];
|
||||||
|
|
||||||
(*parn)++;
|
(*parn)++;
|
||||||
|
@ -1370,6 +1386,7 @@ chm_throttle(struct Client *source_p, struct Channel *chptr,
|
||||||
mode_changes[mode_count].nocaps = 0;
|
mode_changes[mode_count].nocaps = 0;
|
||||||
mode_changes[mode_count].mems = ALL_MEMBERS;
|
mode_changes[mode_count].mems = ALL_MEMBERS;
|
||||||
mode_changes[mode_count].id = NULL;
|
mode_changes[mode_count].id = NULL;
|
||||||
|
mode_changes[mode_count].override = override;
|
||||||
mode_changes[mode_count++].arg = NULL;
|
mode_changes[mode_count++].arg = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1382,6 +1399,7 @@ chm_forward(struct Client *source_p, struct Channel *chptr,
|
||||||
struct Channel *targptr = NULL;
|
struct Channel *targptr = NULL;
|
||||||
struct membership *msptr;
|
struct membership *msptr;
|
||||||
const char *forward;
|
const char *forward;
|
||||||
|
int override = 0;
|
||||||
|
|
||||||
/* if +f is disabled, ignore local attempts to set it */
|
/* if +f is disabled, ignore local attempts to set it */
|
||||||
if(!ConfigChannel.use_forward && MyClient(source_p) &&
|
if(!ConfigChannel.use_forward && MyClient(source_p) &&
|
||||||
|
@ -1403,6 +1421,10 @@ chm_forward(struct Client *source_p, struct Channel *chptr,
|
||||||
|
|
||||||
#ifndef FORWARD_OPERONLY
|
#ifndef FORWARD_OPERONLY
|
||||||
if(alevel != CHFL_CHANOP && alevel != CHFL_OWNER && alevel != CHFL_HALFOP)
|
if(alevel != CHFL_CHANOP && alevel != CHFL_OWNER && alevel != CHFL_HALFOP)
|
||||||
|
{
|
||||||
|
if(IsOverride(source_p))
|
||||||
|
override = 1;
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if(!(*errors & SM_ERR_NOOPS))
|
if(!(*errors & SM_ERR_NOOPS))
|
||||||
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
|
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
|
||||||
|
@ -1410,6 +1432,7 @@ chm_forward(struct Client *source_p, struct Channel *chptr,
|
||||||
*errors |= SM_ERR_NOOPS;
|
*errors |= SM_ERR_NOOPS;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
if(!IsOper(source_p) && !IsServer(source_p))
|
if(!IsOper(source_p) && !IsServer(source_p))
|
||||||
{
|
{
|
||||||
|
@ -1453,12 +1476,17 @@ chm_forward(struct Client *source_p, struct Channel *chptr,
|
||||||
{
|
{
|
||||||
if((msptr = find_channel_membership(targptr, source_p)) == NULL ||
|
if((msptr = find_channel_membership(targptr, source_p)) == NULL ||
|
||||||
is_any_op(msptr))
|
is_any_op(msptr))
|
||||||
|
{
|
||||||
|
if(IsOverride(source_p))
|
||||||
|
override = 1;
|
||||||
|
else
|
||||||
{
|
{
|
||||||
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
|
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
|
||||||
me.name, source_p->name, targptr->chname);
|
me.name, source_p->name, targptr->chname);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
rb_strlcpy(chptr->mode.forward, forward, sizeof(chptr->mode.forward));
|
rb_strlcpy(chptr->mode.forward, forward, sizeof(chptr->mode.forward));
|
||||||
|
|
||||||
|
@ -1468,6 +1496,7 @@ chm_forward(struct Client *source_p, struct Channel *chptr,
|
||||||
mode_changes[mode_count].nocaps = 0;
|
mode_changes[mode_count].nocaps = 0;
|
||||||
mode_changes[mode_count].mems = ConfigChannel.use_forward ? ALL_MEMBERS : ONLY_SERVERS;
|
mode_changes[mode_count].mems = ConfigChannel.use_forward ? ALL_MEMBERS : ONLY_SERVERS;
|
||||||
mode_changes[mode_count].id = NULL;
|
mode_changes[mode_count].id = NULL;
|
||||||
|
mode_changes[mode_count].override = override;
|
||||||
mode_changes[mode_count++].arg = forward;
|
mode_changes[mode_count++].arg = forward;
|
||||||
}
|
}
|
||||||
else if(dir == MODE_DEL)
|
else if(dir == MODE_DEL)
|
||||||
|
@ -1483,6 +1512,7 @@ chm_forward(struct Client *source_p, struct Channel *chptr,
|
||||||
mode_changes[mode_count].nocaps = 0;
|
mode_changes[mode_count].nocaps = 0;
|
||||||
mode_changes[mode_count].mems = ALL_MEMBERS;
|
mode_changes[mode_count].mems = ALL_MEMBERS;
|
||||||
mode_changes[mode_count].id = NULL;
|
mode_changes[mode_count].id = NULL;
|
||||||
|
mode_changes[mode_count].override = override;
|
||||||
mode_changes[mode_count++].arg = NULL;
|
mode_changes[mode_count++].arg = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1493,8 +1523,13 @@ chm_key(struct Client *source_p, struct Channel *chptr,
|
||||||
const char **parv, int *errors, int dir, char c, long mode_type)
|
const char **parv, int *errors, int dir, char c, long mode_type)
|
||||||
{
|
{
|
||||||
char *key;
|
char *key;
|
||||||
|
int override = 0;
|
||||||
|
|
||||||
if(alevel != CHFL_CHANOP && alevel != CHFL_OWNER && alevel != CHFL_HALFOP)
|
if(alevel != CHFL_CHANOP && alevel != CHFL_OWNER && alevel != CHFL_HALFOP)
|
||||||
|
{
|
||||||
|
if(IsOverride(source_p))
|
||||||
|
override = 1;
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if(!(*errors & SM_ERR_NOOPS))
|
if(!(*errors & SM_ERR_NOOPS))
|
||||||
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
|
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
|
||||||
|
@ -1502,6 +1537,7 @@ chm_key(struct Client *source_p, struct Channel *chptr,
|
||||||
*errors |= SM_ERR_NOOPS;
|
*errors |= SM_ERR_NOOPS;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(dir == MODE_QUERY)
|
if(dir == MODE_QUERY)
|
||||||
return;
|
return;
|
||||||
|
@ -1531,6 +1567,7 @@ chm_key(struct Client *source_p, struct Channel *chptr,
|
||||||
mode_changes[mode_count].nocaps = 0;
|
mode_changes[mode_count].nocaps = 0;
|
||||||
mode_changes[mode_count].mems = ALL_MEMBERS;
|
mode_changes[mode_count].mems = ALL_MEMBERS;
|
||||||
mode_changes[mode_count].id = NULL;
|
mode_changes[mode_count].id = NULL;
|
||||||
|
mode_changes[mode_count].override = override;
|
||||||
mode_changes[mode_count++].arg = chptr->mode.key;
|
mode_changes[mode_count++].arg = chptr->mode.key;
|
||||||
}
|
}
|
||||||
else if(dir == MODE_DEL)
|
else if(dir == MODE_DEL)
|
||||||
|
@ -1562,6 +1599,7 @@ chm_key(struct Client *source_p, struct Channel *chptr,
|
||||||
mode_changes[mode_count].nocaps = 0;
|
mode_changes[mode_count].nocaps = 0;
|
||||||
mode_changes[mode_count].mems = ALL_MEMBERS;
|
mode_changes[mode_count].mems = ALL_MEMBERS;
|
||||||
mode_changes[mode_count].id = NULL;
|
mode_changes[mode_count].id = NULL;
|
||||||
|
mode_changes[mode_count].override = override;
|
||||||
mode_changes[mode_count++].arg = "*";
|
mode_changes[mode_count++].arg = "*";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1571,7 +1609,13 @@ chm_regonly(struct Client *source_p, struct Channel *chptr,
|
||||||
int alevel, int parc, int *parn,
|
int alevel, int parc, int *parn,
|
||||||
const char **parv, int *errors, int dir, char c, long mode_type)
|
const char **parv, int *errors, int dir, char c, long mode_type)
|
||||||
{
|
{
|
||||||
|
int override = 0;
|
||||||
|
|
||||||
if(alevel != CHFL_CHANOP && alevel != CHFL_OWNER && alevel != CHFL_HALFOP)
|
if(alevel != CHFL_CHANOP && alevel != CHFL_OWNER && alevel != CHFL_HALFOP)
|
||||||
|
{
|
||||||
|
if(IsOverride(source_p))
|
||||||
|
override = 1;
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if(!(*errors & SM_ERR_NOOPS))
|
if(!(*errors & SM_ERR_NOOPS))
|
||||||
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
|
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
|
||||||
|
@ -1579,6 +1623,7 @@ chm_regonly(struct Client *source_p, struct Channel *chptr,
|
||||||
*errors |= SM_ERR_NOOPS;
|
*errors |= SM_ERR_NOOPS;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(dir == MODE_QUERY)
|
if(dir == MODE_QUERY)
|
||||||
return;
|
return;
|
||||||
|
@ -1601,6 +1646,7 @@ chm_regonly(struct Client *source_p, struct Channel *chptr,
|
||||||
mode_changes[mode_count].nocaps = 0;
|
mode_changes[mode_count].nocaps = 0;
|
||||||
mode_changes[mode_count].mems = ALL_MEMBERS;
|
mode_changes[mode_count].mems = ALL_MEMBERS;
|
||||||
mode_changes[mode_count].id = NULL;
|
mode_changes[mode_count].id = NULL;
|
||||||
|
mode_changes[mode_count].override = override;
|
||||||
mode_changes[mode_count++].arg = NULL;
|
mode_changes[mode_count++].arg = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1911,6 +1957,8 @@ set_channel_mode(struct Client *client_p, struct Client *source_p,
|
||||||
|
|
||||||
alevel = get_channel_access(source_p, msptr);
|
alevel = get_channel_access(source_p, msptr);
|
||||||
|
|
||||||
|
no_override_deop = 0;
|
||||||
|
|
||||||
/* Hide connecting server on netburst -- jilles */
|
/* Hide connecting server on netburst -- jilles */
|
||||||
if (ConfigServerHide.flatten_links && IsServer(source_p) && !has_id(source_p) && !HasSentEob(source_p))
|
if (ConfigServerHide.flatten_links && IsServer(source_p) && !has_id(source_p) && !HasSentEob(source_p))
|
||||||
fakesource_p = &me;
|
fakesource_p = &me;
|
||||||
|
@ -1953,12 +2001,16 @@ set_channel_mode(struct Client *client_p, struct Client *source_p,
|
||||||
for (override = 0; override < (IsOverride(source_p) ? 2 : 1); ++override)
|
for (override = 0; override < (IsOverride(source_p) ? 2 : 1); ++override)
|
||||||
{
|
{
|
||||||
int was_on_chan = 0;
|
int was_on_chan = 0;
|
||||||
|
|
||||||
if(override)
|
if(override)
|
||||||
{
|
{
|
||||||
if(msptr)
|
if(msptr)
|
||||||
|
{
|
||||||
was_on_chan = 1;
|
was_on_chan = 1;
|
||||||
|
msptr->flags |= CHFL_CHANOP;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
add_user_to_channel(chptr, source_p, 0);
|
add_user_to_channel(chptr, source_p, CHFL_CHANOP);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(j = 0, flags = ALL_MEMBERS; j < 2; j++, flags = ONLY_CHANOPS)
|
for(j = 0, flags = ALL_MEMBERS; j < 2; j++, flags = ONLY_CHANOPS)
|
||||||
|
@ -2036,8 +2088,13 @@ set_channel_mode(struct Client *client_p, struct Client *source_p,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(override && !was_on_chan)
|
if(override)
|
||||||
|
{
|
||||||
|
if(!was_on_chan)
|
||||||
remove_user_from_channel(find_channel_membership(chptr, source_p));
|
remove_user_from_channel(find_channel_membership(chptr, source_p));
|
||||||
|
else if (!no_override_deop)
|
||||||
|
msptr->flags &= ~CHFL_CHANOP;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* only propagate modes originating locally, or if we're hubbing */
|
/* only propagate modes originating locally, or if we're hubbing */
|
||||||
if(MyClient(source_p) || rb_dlink_list_length(&serv_list) > 1)
|
if(MyClient(source_p) || rb_dlink_list_length(&serv_list) > 1)
|
||||||
|
|
Loading…
Reference in New Issue