void
spamserv_channel_message(struct chanNode *channel, struct userNode *user, char *text)
{
+ struct chanData *cData;
struct chanInfo *cInfo;
struct userInfo *uInfo;
+ struct userData *uData;
struct spamNode *sNode;
struct floodNode *fNode;
unsigned int violation = 0;
char reason[MAXLEN];
/* make sure: spamserv is not disabled; x3 is running; spamserv is in the chan; chan is regged, user does exist */
- if(!spamserv || quit_services || !GetUserMode(channel, spamserv) || !(cInfo = get_chanInfo(channel->name)) || !(uInfo = get_userInfo(user->nick)))
+ if(!spamserv || quit_services || !GetUserMode(channel, spamserv) || IsOper(user) || !(cInfo = get_chanInfo(channel->name)) || !(uInfo = get_userInfo(user->nick)))
return;
+ cData = channel->channel_info;
+ uData = GetChannelUser(cData, user->handle_info);
+
if(!CHECK_CHANOPS(cInfo))
{
struct modeNode *mn = GetUserMode(channel, user);
- if(mn->modes & MODE_CHANOP)
+ if (mn && (mn->modes & MODE_CHANOP))
+ return;
+
+ /* Chan Ops covers all levels except peon and half op */
+ if(uData && ((uData->access < UL_OP) || (uData->access < UL_MANAGER) ||
+ (uData->access < UL_COOWNER) || (uData->access < UL_OWNER)))
return;
}
if(!CHECK_HALFOPS(cInfo))
{
struct modeNode *mn = GetUserMode(channel, user);
- if(mn->modes & MODE_HALFOP)
+ if (mn && (mn->modes & MODE_HALFOP))
+ return;
+
+ if(uData && (uData->access < UL_HALFOP))
return;
}
if(!CHECK_VOICED(cInfo))
{
struct modeNode *mn = GetUserMode(channel, user);
- if((mn->modes & MODE_VOICE) && !(mn->modes & MODE_CHANOP) && !(mn->modes & MODE_HALFOP))
+ if (mn && ((mn->modes & MODE_VOICE) && !(mn->modes & MODE_CHANOP) && !(mn->modes & MODE_HALFOP)))
+ return;
+
+ if(uData && (uData->access < UL_PEON))
return;
}