"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/spamfilter.c" between
bahamut-2.1.4.tar.gz and bahamut-2.1.5.tar.gz

About: Bahamut is an Internet Relay Chat Daemon (IRCd) designed for DALnet, one of the major IRC networks in the world.

spamfilter.c  (bahamut-2.1.4):spamfilter.c  (bahamut-2.1.5)
skipping to change at line 249 skipping to change at line 249
me.name, cptr->name, blocked?"been blocked":"triggere d a warning", me.name, cptr->name, blocked?"been blocked":"triggere d a warning",
p->reason?p->reason:"<none>"); p->reason?p->reason:"<none>");
sendto_one(cptr, ":%s NOTICE %s :*** Notice -- Please visit %s f or more information.", sendto_one(cptr, ":%s NOTICE %s :*** Notice -- Please visit %s f or more information.",
me.name, cptr->name, SpamFilter_URL); me.name, cptr->name, SpamFilter_URL);
warned++; warned++;
} }
if(!reported && (p->flags & SF_ACT_REPORT)) if(!reported && (p->flags & SF_ACT_REPORT))
{ {
if((p->flags & SF_ACT_BLOCK) && (p->flags & SF_ACT_AKILL)) if((p->flags & SF_ACT_BLOCK) && (p->flags & SF_ACT_AKILL))
action_text = " (blocked+akilled)"; action_text = " (blocked+akilled)";
else if(action!=SF_CMD_QUIT && (p->flags & SF_ACT_BLOCK) && (p->
flags & SF_ACT_KILL))
action_text = " (blocked+killed)";
else if(p->flags & SF_ACT_BLOCK) else if(p->flags & SF_ACT_BLOCK)
action_text = " (blocked)"; action_text = " (blocked)";
else if(p->flags & SF_ACT_AKILL) else if(p->flags & SF_ACT_AKILL)
action_text = " (akilled)"; action_text = " (akilled)";
else if(action!=SF_CMD_QUIT && p->flags & SF_ACT_KILL)
action_text = " (killed)";
else else
action_text = ""; action_text = "";
if(IsPerson(cptr)) if(IsPerson(cptr))
{ {
sendto_realops_lev(SPAM_LEV, "spamfilter %s: %s by %s!%s@%s to %s%s --> %s", p->id?p->id:p->text, sendto_realops_lev(SPAM_LEV, "spamfilter %s: %s by %s!%s@%s to %s%s --> %s", p->id?p->id:p->text,
caction, cptr->name, cptr->user->username , cptr->user->host, caction, cptr->name, cptr->user->username , cptr->user->host,
target, action_text, text); target, action_text, text);
sendto_serv_butone(NULL, ":%s SPAMOPS :spamfilter %s: %s by %s!%s@%s to %s%s --> %s", sendto_serv_butone(NULL, ":%s SPAMOPS :spamfilter %s: %s by %s!%s@%s to %s%s --> %s",
me.name, p->id?p->id:p->text, caction, cp tr->name, cptr->user->username, me.name, p->id?p->id:p->text, caction, cp tr->name, cptr->user->username,
cptr->user->host, target, action_text, te xt); cptr->user->host, target, action_text, te xt);
skipping to change at line 364 skipping to change at line 368
p->reason = MyMalloc(strlen(reason) + 1); p->reason = MyMalloc(strlen(reason) + 1);
strcpy(p->reason, reason); strcpy(p->reason, reason);
len = 1; len = 1;
if(reason[0] == '[') if(reason[0] == '[')
{ {
while(reason[len]!=']' && reason[len]!='\0') while(reason[len]!=']' && reason[len]!='\0')
len++; len++;
} }
if(len > 1 && reason[len]==']') if(len > 1 && reason[len]==']')
{ {
p->id = MyMalloc(len); p->id = MyMalloc(len-1);
strncpy(p->id, &reason[1], len - 1); strncpy(p->id, &reason[1], len - 1);
p->id[len] = '\0'; p->id[len-1] = '\0';
} }
else p->id = NULL; else p->id = NULL;
} }
else else
{ {
p->reason = NULL; p->reason = NULL;
p->id = NULL; p->id = NULL;
} }
if(target) if(target)
{ {
skipping to change at line 487 skipping to change at line 491
} }
return 0; return 0;
} }
/* Strip colors and other control codes from a text */ /* Strip colors and other control codes from a text */
void stripcolors(char new[512], char *org) void stripcolors(char new[512], char *org)
{ {
int len = 0; int len = 0;
for(; (*org && len<512); org++) for(; (*org && len < 512); org++)
{ {
if(*org=='\003') if(*org == '\003')
{ {
// Color codes: 1-2 digits, then optionally followed by a comma and an additional 1-2 digits
org++; org++;
while(IsDigit(*org) || *org==',') if(*org && IsDigit(*org))
{
org++; org++;
if(*org && IsDigit(*org))
org++;
if(*org && *org == ',' && IsDigit(*(org + 1)))
{
org = org + 2;
if(*org && IsDigit(*org))
org++;
}
}
} }
if(*org<32) if(*org < 32)
continue; continue;
new[len++] = *org; new[len++] = *org;
} }
new[len] = '\0'; new[len] = '\0';
} }
/* Strip all "special" chars */ /* Strip all "special" chars */
void stripall(char new[512], char *org) void stripall(char new[512], char *org)
{ {
#define fstripall(c) ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || IsDigi t(c) || c == '-' || c == '/' || c == '.' || c== '$' || c == '(') /* to strip eve rything ;) */ #define fstripall(c) ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || IsDigi t(c) || c == '-' || c == '/' || c == '.' || c== '$' || c == '(') /* to strip eve rything ;) */
int len = 0; int len = 0;
for(; (*org && len<512); org++) for(; (*org && len<512); org++)
{ {
if(*org=='\003') if(*org == '\003')
{ {
// Color codes: 1-2 digits, then optionally followed by a comma and an additional 1-2 digits
org++; org++;
while(IsDigit(*org) || *org==',') if(*org && IsDigit(*org))
{
org++; org++;
if(*org && IsDigit(*org))
org++;
if(*org && *org == ',' && IsDigit(*(org + 1)))
{
org = org + 2;
if(*org && IsDigit(*org))
org++;
}
}
} }
if(!fstripall(*org)) if(!fstripall(*org))
continue; continue;
new[len++] = *org; new[len++] = *org;
} }
new[len] = '\0'; new[len] = '\0';
} }
 End of changes. 14 change blocks. 
8 lines changed or deleted 35 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)