diff --git a/include/channel.h b/include/channel.h index 43054819..3c79793e 100644 --- a/include/channel.h +++ b/include/channel.h @@ -196,6 +196,7 @@ typedef int (*ExtbanFunc)(const char *data, struct Client *client_p, #define CHANROLE_GRANT 0x008 /* Can grant (unused atm) */ #define CHANROLE_MODE 0x010 /* Can change modes */ #define CHANROLE_TOPIC 0x020 /* Can change topic */ +#define CHANROLE_INHERIT 0x040 /* Role is inherited (backwards compat) */ #define CHANROLE_INITIAL (CHANROLE_KICK | CHANROLE_STATUS | CHANROLE_GRANT | CHANROLE_MODE | CHANROLE_TOPIC) diff --git a/src/chmode.c b/src/chmode.c index 04be25db..f6354389 100644 --- a/src/chmode.c +++ b/src/chmode.c @@ -202,24 +202,12 @@ get_channel_access(struct Client *source_p, struct membership *msptr, int role) moduledata.msptr = msptr; moduledata.target = NULL; - if (is_chanop(msptr)) - { - /* Their chanrole is unset by GRANT, for backwards compat let them pass */ - if(HasChanRole(msptr, CHANROLE_UNSET)) - { - moduledata.approved = CHFL_CHANOP; - goto finish_access; - } - } - /* Check if they have the proper role */ if(HasChanRole(msptr, role)) moduledata.approved = CHFL_CHANOP; else moduledata.approved = CHFL_PEON; -finish_access: - call_hook(h_get_channel_access, &moduledata); return moduledata.approved; @@ -915,6 +903,11 @@ chm_op(struct Client *source_p, struct Channel *chptr, mode_changes[mode_count++].client = targ_p; mstptr->flags |= CHFL_CHANOP; + if (msptr->roles & CHANROLE_UNSET) + { + mstptr->roles &= ~CHANROLE_UNSET; + mstptr->roles = CHANROLE_INITIAL | CHANROLE_INHERIT; + } } else { @@ -935,6 +928,8 @@ chm_op(struct Client *source_p, struct Channel *chptr, mode_changes[mode_count++].client = targ_p; mstptr->flags &= ~CHFL_CHANOP; + if (mstptr->roles & CHANROLE_INHERIT) + mstptr->roles = CHANROLE_UNSET; } }