diff --git a/include/h.h b/include/h.h index 996b16fb5..69ab50f14 100644 --- a/include/h.h +++ b/include/h.h @@ -182,9 +182,21 @@ extern int del_silence(aClient *, char *); extern void send_user_joins(aClient *, aClient *); extern void clean_channelname(char *); extern long get_access(aClient *, aChannel *); -extern int is_chan_op(aClient *, aChannel *); -extern int has_voice(aClient *, aChannel *); -extern int is_chanowner(aClient *, aChannel *); +#ifdef PREFIX_AQ + #define CHFL_CHANOP_OR_HIGHER (CHFL_CHANOP|CHFL_CHANPROT|CHFL_CHANOWNER) + #define CHFL_HALFOP_OR_HIGHER (CHFL_CHANOWNER|CHFL_CHANPROT|CHFL_CHANOP|CHFL_HALFOP) +#else + #define CHFL_CHANOP_OR_HIGHER (CHFL_CHANOP) + #define CHFL_HALFOP_OR_HIGHER (CHFL_CHANOP|CHFL_HALFOP) +#endif + +#define is_chan_op(cptr,chptr) (get_access(cptr,chptr) & CHFL_CHANOP_OR_HIGHER) +#define is_skochanop(cptr,chptr) (get_access(cptr,chptr) & CHFL_HALFOP_OR_HIGHER) +#define has_voice(cptr,chptr) (get_access(cptr,chptr) & CHFL_VOICE) +#define is_halfop is_half_op +#define is_half_op(cptr,chptr) (get_access(cptr,chptr) & CHFL_HALFOP) +#define is_chanowner(cptr,chptr) (get_access(cptr,chptr) & CHFL_CHANOWNER) +#define is_chanprot(cptr,chptr) (get_access(cptr,chptr) & CHFL_CHANPROT) extern int ban_check_mask(aClient *, aChannel *, char *, int, char **, char **, int); extern int extban_is_ok_nuh_extban(aClient *, aChannel *, char *, int, int, int); extern char *extban_conv_param_nuh_or_extban(char *); @@ -471,8 +483,6 @@ extern int Auth_Check(aClient *cptr, anAuthStruct *as, char *para); extern char *Auth_Make(short type, char *para); extern int Auth_CheckError(ConfigEntry *ce); -extern int is_chanownprotop(aClient *cptr, aChannel *chptr); -extern int is_skochanop(aClient *cptr, aChannel *chptr); extern char *make_virthost(aClient *sptr, char *curr, char *new, int mode); extern int channel_canjoin(aClient *sptr, char *name); extern char *collapse(char *pattern); diff --git a/include/proto.h b/include/proto.h index c97a4d4e5..aef984be7 100644 --- a/include/proto.h +++ b/include/proto.h @@ -25,8 +25,6 @@ /* channel.c */ extern int sendmodeto_one(aClient *cptr, char *from, char *name, char *mode, char *param, TS creationtime); extern void make_cmodestr(void); -extern int is_halfop(aClient *cptr, aChannel *chptr); -extern int is_chanprot(aClient *cptr, aChannel *chptr); /* lusers.c */ extern void init_ircstats(void); diff --git a/include/struct.h b/include/struct.h index a18fb76f2..6bd8e26b6 100644 --- a/include/struct.h +++ b/include/struct.h @@ -1704,7 +1704,6 @@ struct liststructprio { #define MODE_RGSTR 0x8000 #define MODE_INVEX 0x8000000 -#define is_halfop is_half_op /* * mode flags which take another parameter (With PARAmeterS) */ diff --git a/src/channel.c b/src/channel.c index 8240ba930..13d6fbe99 100644 --- a/src/channel.c +++ b/src/channel.c @@ -639,103 +639,6 @@ long get_access(aClient *cptr, aChannel *chptr) return 0; } -int is_chan_op(aClient *cptr, aChannel *chptr) -{ - Membership *lp; -/* chanop/halfop ? */ - if (IsServer(cptr)) - return 1; - if (chptr) - if ((lp = find_membership_link(cptr->user->channel, chptr))) -#ifdef PREFIX_AQ - return ((lp->flags & (CHFL_CHANOP|CHFL_CHANPROT|CHFL_CHANOWNER))); -#else - return ((lp->flags & CHFL_CHANOP)); -#endif - - return 0; -} - -int has_voice(aClient *cptr, aChannel *chptr) -{ - Membership *lp; - - if (IsServer(cptr)) - return 1; - if (chptr) - if ((lp = find_membership_link(cptr->user->channel, chptr))) - return (lp->flags & CHFL_VOICE); - - return 0; -} -int is_halfop(aClient *cptr, aChannel *chptr) -{ - Membership *lp; - - if (IsServer(cptr)) - return 1; - if (chptr) - if ((lp = find_membership_link(cptr->user->channel, chptr))) - if (!(lp->flags & CHFL_CHANOP)) - return (lp->flags & CHFL_HALFOP); - - return 0; -} - -int is_chanowner(aClient *cptr, aChannel *chptr) -{ - Membership *lp; - - if (IsServer(cptr)) - return 1; - if (chptr) - if ((lp = find_membership_link(cptr->user->channel, chptr))) - return (lp->flags & CHFL_CHANOWNER); - - return 0; -} - -int is_chanownprotop(aClient *cptr, aChannel *chptr) -{ - Membership *lp; - - if (IsServer(cptr)) - return 1; - if (chptr) - if ((lp = find_membership_link(cptr->user->channel, chptr))) - if (lp->flags & (CHFL_CHANOWNER|CHFL_CHANPROT|CHFL_CHANOP)) - return 1; - return 0; -} - -int is_skochanop(aClient *cptr, aChannel *chptr) -{ - Membership *lp; - - if (IsServer(cptr)) - return 1; - if (chptr) - if ((lp = find_membership_link(cptr->user->channel, chptr))) -#ifdef PREFIX_AQ - if (lp->flags & (CHFL_CHANOWNER|CHFL_CHANPROT|CHFL_CHANOP|CHFL_HALFOP)) -#else - if (lp->flags & (CHFL_CHANOP|CHFL_HALFOP)) -#endif - return 1; - return 0; -} - -int is_chanprot(aClient *cptr, aChannel *chptr) -{ - Membership *lp; - - if (chptr) - if ((lp = find_membership_link(cptr->user->channel, chptr))) - return (lp->flags & CHFL_CHANPROT); - - return 0; -} - /** Returns 1 if channel has this channel mode set and 0 if not */ int has_channel_mode(aChannel *chptr, char mode) { diff --git a/src/modules/chanmodes/nonickchange.c b/src/modules/chanmodes/nonickchange.c index 83b967db0..c5c385b9a 100644 --- a/src/modules/chanmodes/nonickchange.c +++ b/src/modules/chanmodes/nonickchange.c @@ -71,8 +71,10 @@ int nonickchange_check (aClient *sptr, aChannel *chptr) { if (!IsOper(sptr) && !IsULine(sptr) && IsNoNickChange(chptr) - && !is_chanownprotop(sptr, chptr)) + && !is_chan_op(sptr, chptr)) + { return HOOK_DENY; + } return HOOK_ALLOW; } diff --git a/src/modules/m_part.c b/src/modules/m_part.c index cf27815e8..8fe9ad60e 100644 --- a/src/modules/m_part.c +++ b/src/modules/m_part.c @@ -132,7 +132,7 @@ CMD_FUNC(m_part) continue; } - if (!ValidatePermissionsForPath("channel:override:banpartmsg",sptr,NULL,chptr,NULL) && !is_chanownprotop(sptr, chptr)) { + if (!ValidatePermissionsForPath("channel:override:banpartmsg",sptr,NULL,chptr,NULL) && !is_chan_op(sptr, chptr)) { /* Banned? No comment allowed ;) */ if (comment && is_banned(sptr, chptr, BANCHK_MSG, &comment, NULL)) comment = NULL;