Anope IRC Services

Anope Development => Modules => Topic started by: Kugener Jeff on January 29, 2014, 08:46:35 PM

Title: Spamfilter.c module for anope1.8.6 and Unreal3.2
Post by: Kugener Jeff on January 29, 2014, 08:46:35 PM
Hello Ppls,

i have rewrite the module ippaddr to spamfilter.c, but i have a question on it.
All times, when an Services Administrator enter the command: "!Spamfilter www.url.com" on the #channel, this module insert the SPAM-URL into the spamfilter block automatically. After this, i must manually rehash the server config file like ./unreal rehash. But now my question is, is it possible to wrote a command into the spamfilter module that this script rehash the config file automatically after the code below

if ( pFile != NULL ) {
fprintf(pFile, "#Added by %s\n", u->nick);
fprintf(pFile, "spamfilter {\n");
fprintf(pFile, "regex \"%s\";\n", argv[3]);
fprintf(pFile, "target { private; channel; };\n");
fprintf(pFile, "action block;\n");
fprintf(pFile, "reason \"No spam on our network!\";\n");
fprintf(pFile, "};\n");
fprintf(pFile, "\n");
fclose (pFile);
notice(whosends(ci), ci->name, "!spamfilter used by %s: adding: %s",
u->nick, argv[3]);
return MOD_CONT;
}else{
....
}

The method to rehash my config file: --> /home/my_ircd/Unreal3.2/./unreal rehash.

The complete code u can find here:
http://modules.anope.org/index.php?page=browser&id=262&release=1.0.0&name=spamfilter.c&v=43

Thx for help ;)
Title: Re: Spamfilter.c module for anope1.8.6 and Unreal3.2
Post by: Jan Milants on January 30, 2014, 12:12:16 PM
As Jobe already suggested on IRC yesterday, instead of doing it the hard way through calling a script on your system, just send the S2S REHASH command after the module s done writing the file..

Code: [Select]
send_cmd(NULL, "REHASH");
or

Code: [Select]
send_cmd(NULL, "REHASH %s", serv_uplink->name);
Title: Re: Spamfilter.c module for anope1.8.6 and Unreal3.2
Post by: Kugener Jeff on January 30, 2014, 04:45:14 PM
Hallo,

Problem is solved, with this code the server rehash the config file.

Code: [Select]
system ("/home/MYIRC/Unreal/./unreal rehash");
Thx a lot.