Skip to content

Commit

Permalink
Improve SpamFilter's STRIPALL flag (#73)
Browse files Browse the repository at this point in the history
This changes check_sf() function to remove the target's nick (or channel) from the beginning of the message when STRIPALL flag is used.

This will let us add non-wildcard patterns for "<nick> spam" messages.
  • Loading branch information
kobishmueli authored and eaescob committed Oct 13, 2018
1 parent b5bd955 commit 16035e1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/spamfilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ int check_sf(aClient *cptr, char *text, char *caction, int action, char *target)
unsigned int len = 0; /* For regexp */
int ovector[30]; /* For regexp */
char *action_text;
char *textptr;

if(IsAnOper(cptr))
return 0;
Expand All @@ -181,7 +182,15 @@ int check_sf(aClient *cptr, char *text, char *caction, int action, char *target)
if(p->flags & SF_FLAG_STRIPALL)
{
if(stripamsg[0]=='\0')
stripall(stripamsg, text);
{
textptr = text;
while(*textptr==' ') textptr++;
if(*textptr && *target && !strncasecmp(textptr,target,strlen(target)))
{
textptr += strlen(target);
}
stripall(stripamsg, textptr);
}
matched = !match(p->text,stripamsg);
}
else if(p->flags & SF_FLAG_STRIPCTRL)
Expand Down

0 comments on commit 16035e1

Please sign in to comment.