#include "module.h" #define AUTHOR "SGR" #define VERSION "1.01" /* ----------------------------------------------------------- * Name: bs_botaddonlyunreg * Author: SGR * Date: 30/12/2003 * ----------------------------------------------------------- * Functions: m_bs_noticeact, m_bs_noticesay * Limitations: NONE KNOWN. * Tested: Ultimate(2.8.x), Unreal(3.2) * ----------------------------------------------------------- * This version has been tested on Ultimate2.8.6, viagra * Unreal and Bahamut. All IRCd's should be compatible with * this module. * * This module will prevent the creation of new BotServ bots * where the nick of the bot that would be created matches the * nick of an already registered nickname. * -----------------------------------------------------------*/ /* ---------------------------------------------------------------------- */ /* START OF CONFIGURATION BLOCK - please read the comments :) */ /* ---------------------------------------------------------------------- */ #define NICK_REGISTERED_PLEASE_DROP "The nick you provided for the new bot is already registered. Please DROP it first." /* ---------------------------------------------------------------------- */ /* DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING */ /* ---------------------------------------------------------------------- */ #define MyFree(x) if ((x) != NULL) { free(x); } int m_bs_botchecknicknotreg(User * u); int AnopeInit(int argc, char **argv) { Command *c; alog("Loading module bs_botaddonlyunreg.so"); c = createCommand("BOT", m_bs_botchecknicknotreg, is_services_admin,-1,-1,-1,-1,-1); moduleAddCommand(BOTSERV, c, MOD_HEAD); alog("[bs_botaddonlyunreg] Services Admins and Roots will no longer be able to add"); alog("[bs_botaddonlyunreg] new bots where the nick of the bot they are trying to add"); alog("[bs_botaddonlyunreg] is registered with %s.", s_NickServ); alog("[bs_botaddonlyunreg] Yayness!(tm) - MODULE LOADED AND ACTIVE"); moduleAddAuthor(AUTHOR); moduleAddVersion(VERSION); return MOD_CONT; } int m_bs_botchecknicknotreg(User * u) { char *temp = moduleGetLastBuffer(); char *cmd = myStrGetToken(temp,' ',0); char *nick = myStrGetToken(temp,' ',1); int dostop = 0; NickAlias *na; if (cmd == NULL) { syntax_error(s_BotServ, u, "BOT", BOT_BOT_SYNTAX); dostop = 1; } else if (!(!stricmp(cmd, "ADD"))) { dostop = 1; } else if (!stricmp(cmd, "ADD")) { if (nick == NULL) { syntax_error(s_BotServ, u, "BOT", BOT_BOT_SYNTAX); dostop = 1; } if (findbot(nick)) { notice_lang(s_BotServ, u, BOT_BOT_ALREADY_EXISTS, nick); dostop = 1; } if ((na = findnick(nick))) { notice(s_BotServ, u->nick, NICK_REGISTERED_PLEASE_DROP); dostop = 1; } } MyFree(cmd); MyFree(nick); if (dostop) { return MOD_STOP; } return MOD_CONT; }