From: B.Greenham Date: Wed, 31 Mar 2010 15:22:32 +0000 (-0400) Subject: Make chm_staff (staff only modes) only settable if you have ops in the channel in... X-Git-Tag: shadowircd-6.1.0~15^2~4^2 X-Git-Url: https://jfr.im/git/irc/rqf/shadowircd.git/commitdiff_plain/92b26e74a99f74832ffc8aa0f750f91b668bb61e 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. --- diff --git a/src/chmode.c b/src/chmode.c index 3161b64..5aa618f 100644 --- a/src/chmode.c +++ b/src/chmode.c @@ -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; }