Make chm_staff (staff only modes) only settable if you have ops in the channel in question.

If operators need to set such modes in a channel where they don't have ops, that's what override/omode are for.
This commit is contained in:
B.Greenham 2010-03-31 11:22:32 -04:00
parent 36fb4e9a77
commit 92b26e74a9
1 changed files with 18 additions and 2 deletions

View File

@ -660,6 +660,8 @@ chm_staff(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type)
{
int override = 0;
if(!IsOper(source_p) && !IsServer(source_p))
{
if(!(*errors & SM_ERR_NOPRIVS))
@ -676,6 +678,20 @@ chm_staff(struct Client *source_p, struct Channel *chptr,
return;
}
if(alevel != CHFL_CHANOP && alevel != CHFL_ADMIN && alevel != CHFL_HALFOP)
{
if (IsOverride(source_p))
override = 1;
else
{
if(!(*errors & SM_ERR_NOOPS))
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
me.name, source_p->name, chptr->chname);
*errors |= SM_ERR_NOOPS;
return;
}
}
if(MyClient(source_p) && (++mode_limit_simple > MAXMODES_SIMPLE))
return;
@ -690,7 +706,7 @@ chm_staff(struct Client *source_p, struct Channel *chptr,
mode_changes[mode_count].nocaps = 0;
mode_changes[mode_count].id = NULL;
mode_changes[mode_count].mems = ALL_MEMBERS;
mode_changes[mode_count].override = 0;
mode_changes[mode_count].override = override;
mode_changes[mode_count++].arg = NULL;
}
else if((dir == MODE_DEL) && (chptr->mode.mode & mode_type))
@ -702,7 +718,7 @@ chm_staff(struct Client *source_p, struct Channel *chptr,
mode_changes[mode_count].caps = 0;
mode_changes[mode_count].nocaps = 0;
mode_changes[mode_count].mems = ALL_MEMBERS;
mode_changes[mode_count].override = 0;
mode_changes[mode_count].override = override;
mode_changes[mode_count].id = NULL;
mode_changes[mode_count++].arg = NULL;
}