#include "module.h" #define AUTHOR "SGR" #define VERSION "1.00" /* ----------------------------------------------------------- * Name : ircd_disablebotserv * Author: SGR * Date : 18/01/2004 * ----------------------------------------------------------- * Functions: deny_botserv, botserv_offline_notices * no_bs_privmsg * Limitations: None Known. * Tested: Ultimate(2.8.x), Unreal(3.2), Ultimate(3.x), Bahamut. * ----------------------------------------------------------- * This version has been tested on Ultimate, Viagra and * Unreal. * * This modules has 12 configurable options, please read * The comments * * ----------------------------------------------------------- */ /* ---------------------------------------------------------------------- */ /* START OF CONFIGURATION BLOCK - please read the comments :) */ /* ---------------------------------------------------------------------- */ #define NoBotServHere1 "BotServ is not available on this network." #define NoBotServHere2 "To leave offline messages for a user, please request" #define NoBotServHere3 "their e-mail address and use e-mail to communicate." #define NoBotServHere4 "For more information, join #Help" //#define NoBotServHere5 "if someone is persistantly harassing you, flooding or" //#define NoBotServHere6 "making obsene remarks, please do make use of this service." //#define NoBotServHere7 "Help text7" //#define NoBotServHere8 "Help Text8" //#define NoBotServHere9 "Help Text9" //#define NoBotServHere10 "Help Text10" // Set this to 1 to FULLY Disable BotServ // Set this to 2 to restrict BotServ to Opers only // Set this to 3 to restrict BotServ to ServicesAdmins only #define DisableType 1 // Set this to 1 to respond with NoBotServHereX notices. // Set this to 2 to respond with the default "service offline" message // Set this to 3 to not respond at all. #define ResponseType 1 /* ---------------------------------------------------------------------- */ /* DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING */ /* ---------------------------------------------------------------------- */ int deny_botserv(User *u); void botserv_offline_notices(User *u); int no_bs_privmsg(char *source, int ac, char **av); int AnopeInit(int argc, char **argv) { Message *msg = NULL; int status; msg = createMessage("NOTICE", no_bs_privmsg); status = moduleAddMessage(msg, MOD_HEAD); msg = createMessage("PRIVMSG", no_bs_privmsg); status = moduleAddMessage(msg, MOD_HEAD); moduleAddAuthor(AUTHOR); moduleAddVersion(VERSION); alog("[ircd_disablebotserv] This module has loaded and is now active."); return MOD_CONT; } int no_bs_privmsg(char *source, int ac, char **msg) { User *u; char *s; if (ac != 2) { return MOD_CONT; } if (!(u = finduser(source))) { return MOD_CONT; } if (*msg[0] == '#') { return MOD_CONT; } s = strchr(msg[0], '@'); if (s) { *s++ = 0; if (stricmp(s, ServerName) != 0) { return MOD_CONT; } } if (msg[0] != NULL) { if (stricmp(msg[0],s_BotServ)==0) { if (deny_botserv(u)) { return MOD_STOP; } } else if (s_BotServAlias) { if (stricmp(msg[0], s_BotServAlias)==0) { if (deny_botserv(u)) { return MOD_STOP; } } } else { return MOD_CONT; } } return MOD_CONT; } /*****************************************************************************/ int deny_botserv(User * u) { if ((DisableType == 2) && is_oper(u)) { return 0; } if ((DisableType == 2) && is_services_admin(u)) { return 0; } if (ResponseType==1) { botserv_offline_notices(u); return 1; } if (ResponseType==2) { notice_lang(s_BotServ, u, SERVICE_OFFLINE, s_BotServ); return 1; } if (ResponseType==3) { return 1; } return 0; } void botserv_offline_notices(User *u) { notice(s_BotServ, u->nick, "-----------------------------------------------------------------------"); #ifdef NoBotServHere1 notice(s_BotServ, u->nick, NoBotServHere1); #endif #ifdef NoBotServHere2 notice(s_BotServ, u->nick, NoBotServHere2); #endif #ifdef NoBotServHere3 notice(s_BotServ, u->nick, NoBotServHere3); #endif #ifdef NoBotServHere4 notice(s_BotServ, u->nick, NoBotServHere4); #endif #ifdef NoBotServHere5 notice(s_BotServ, u->nick, NoBotServHere5); #endif #ifdef NoBotServHere6 notice(s_BotServ, u->nick, NoBotServHere6); #endif #ifdef NoBotServHere7 notice(s_BotServ, u->nick, NoBotServHere7); #endif #ifdef NoBotServHere8 notice(s_BotServ, u->nick, NoBotServHere8); #endif #ifdef NoBotServHere9 notice(s_BotServ, u->nick, NoBotServHere9); #endif #ifdef NoBotServHere10 notice(s_BotServ, u->nick, NoBotServHere10); #endif notice(s_BotServ, u->nick, "-----------------------------------------------------------------------"); return; }