Anope IRC Services

Please login or register.

Login with username, password and session length
Advanced search  

News:

Pages: [1]   Go Down

Author Topic: Spamfilter.c module for anope1.8.6 and Unreal3.2  (Read 3060 times)

0 Members and 1 Guest are viewing this topic.

Kugener Jeff

  • Anope User
  • Offline Offline
  • Posts: 19
Spamfilter.c module for anope1.8.6 and Unreal3.2
« 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 ;)
« Last Edit: January 29, 2014, 08:51:25 PM by Kugener Jeff »
Logged

Jan Milants

  • Team
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 1372
Re: Spamfilter.c module for anope1.8.6 and Unreal3.2
« Reply #1 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);
Logged
If you like me donate coins to 1FBmZVT4J8WAUMHKqpWhgNVj3XXnRN1cCk :)

Kugener Jeff

  • Anope User
  • Offline Offline
  • Posts: 19
Re: Spamfilter.c module for anope1.8.6 and Unreal3.2
« Reply #2 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.
Logged
Pages: [1]   Go Up