Swear Filter v2.0 ----------------- This swear filter replaces the previous version, and has the following changes in functionality: 1) Only rude words are replaced, even if they are mid-word. For example, if the word "dragon" was placed in files/rude.msg, then only the "dragon" part of "dragoness" would be replaced. 2) The replacement string is configured in soft/config.msg, and is used instead of the random symbols used by v1.0 of the swear filter. To install: At the end of src/include/proto.h, add: extern char **rudewords; In src/parse.c, underneath "int backup_hour;" add: char **rudewords = NULL; Also in src/parse.c, near the end of the file, replace the filter_rude_words and swear_version functions with the following: char *filter_rude_words(char *str) { char *x, *rude, *t; int c; t=get_config_msg("swear_word"); if(!rudewords) { /* Create the rude words list */ x=rude_msg.where; c=0; while(*x) { while((*x) && isspace(*x)) x++; if(!*x) break; rude=strchr(x, '\n'); if(!rude) break; c++; x=(rude+1); } rudewords=(char **)malloc(sizeof(char *)*(c+1)); x=rude_msg.where; c=0; while(*x) { while((*x) && isspace(*x)) x++; if(!*x) break; rudewords[c]=x; rude=strchr(x, '\n'); if(!rude) break; *rude=0; rude++; c++; x=rude; } rudewords[c]=0; } while (1) { for(c=0; rudewords[c]; c++) { if((rude=strcasestr(str, rudewords[c]))!=NULL) break; }; if(!rudewords[c]) return str; str = replace(str, rudewords[c], t); } return str; } void swear_version(void) { sprintf(stack, " -=*> Swear filtering v2.0 (by Silver and ekto) enabled.\n"); stack = strchr(stack, 0); } Then, in glue.c, locate the init_messages function. Within that function, you should find the following lines: SUWALL(" -=*> Reloaded '%s' ...\n", MessageFileArray[i].path); if (!strcasecmp(MessageFileArray[i].path, "soft/config.msg")) update_configs(); Directly below the update_configs() line, add: if(!strcasecmp(MessageFileArray[i].path, "files/rude.msg")) { free(rudewords); rudewords=NULL; } In src/xstring.c, line 151, replace: if (!(ptr = strstr(str, find))) return str; With: if (!(ptr = strcasestr(str, find))) return str; And starting at line 181, replace: if (strstr(str, find)) { /* seed */ strncpy(returnstr, single_replace(str, find, rep), 51100); /* recursion */ while (strstr(returnstr, find)) strncpy(returnstr, single_replace(returnstr, find, rep), 51100); With: if (strcasestr(str, find)) { /* seed */ strncpy(returnstr, single_replace(str, find, rep), 51100); /* recursion */ while (strcasestr(returnstr, find)) strncpy(returnstr, single_replace(returnstr, find, rep), 51100); And finally, in soft/config.msg, add a line similar to: swear_word: Change the "" to whatever you want rude words to be replaced with. Then recompile and reboot. Credits v1.0 by Silver and phypor v2.0 by Silver and ekto