#include "module.h" #define AUTHOR "DrStein" #define MYNAME "hs_roff" #define VERSION "1.0.0" /* -------------------------------------------- * MODULE AUTHOR AND RELEASE DATE * -------------------------------------------- * Name : hs_roff * Author: DrStein * Date : 08-25-2004 * * -------------------------------------------- * MODULE DESCRIPTION * -------------------------------------------- * Module to set off the vHost for the given * nickname. * * -------------------------------------------- * COMMANDS LIST * -------------------------------------------- * /msg HostServ ROFF * * -------------------------------------------- * MODULE SUPPORT * -------------------------------------------- * IRCd: Tested on UnrealIRCd 3.2.1, but * supports all IRCds which Anope support. * Services: Tested on Anope 1.7.5 but supports * all the Anope versions. * * -------------------------------------------- * CHANGELOG * -------------------------------------------- * v1.0.0 - Fixed several bugs. Stable release. * Added 1.7.5 support. * v0.0.1 - Initial release * * -------------------------------------------- * GRATEFULNESS * -------------------------------------------- * * * -------------------------------------------- * RELEASE NOTES * -------------------------------------------- * This was one of my first modules. Now, I've * more experience building modules, so I fixed * several bugs. Also, the code style has been * changed to make it more consistent. * I won't add new features to this module. So, * it is the stable release. * Enjoy. * * -------------------------------------------- * HELP strings - Don't remove the %s * -------------------------------------------- */ #define ROFF_HELP_MAIN " ROFF Set off the vHost for the given nick" #define ROFF_HELP_1 "Syntax: /msg %s ROFF " #define ROFF_HELP_2 "Set off the vHost for the given nick" #define ROFF_HELP_3 "The user will be noticed to reset his +x umode" /* --------------------------------------------- * Please don't edit anything below here. * --------------------------------------------- */ extern int is_host_setter(User * u); int vhost_off(User *u); int hsRoffHelp(User *u); void hsMainHelp(User *u); /** * AnopeInit is called when the module is loaded * @param argc Argument count * @param argv Argument list * @return MOD_STOP if we want to unload, MOD_CONT if we want to carry on **/ int AnopeInit(int argc, char **argv) { Command *c; c = createCommand("ROFF", vhost_off, is_host_setter, -1, -1, -1, -1, -1); moduleAddHelp(c, hsRoffHelp); moduleAddCommand(HOSTSERV, c, MOD_HEAD); moduleSetHostHelp(hsMainHelp); moduleAddAuthor(AUTHOR); moduleAddVersion(VERSION); alog("[%s.so] Module loaded.", MYNAME); return MOD_CONT; } /** * AnopeFini is called when the module is unloaded **/ void AnopeFini(void) { alog("Unloading %s.so", MYNAME); } /** * Turn off the vhost for the given nickname * The command is in the HostSetter table, so * only HostSetters could use it. (I hope) * @param u The user who executed this command **/ int vhost_off(User *u) { char *args = NULL; char *nick = NULL; User *u2; if (moduleGetLastBuffer()) { args = sstrdup(moduleGetLastBuffer()); nick = myStrGetToken(args,' ',0); free(args); } if (nick) { if (!(u2 = finduser(nick))) { notice_lang(s_OperServ, u, NICK_X_NOT_IN_USE, nick); } else { #if defined(IRC_UNREAL32) || defined(IRC_UNREAL31) || defined(IRC_UNREAL) send_cmd(s_HostServ, "SVSMODE %s -xt", nick); notice_lang(s_HostServ, u2, HOST_OFF_UNREAL, nick); notice(s_HostServ, u->nick, "The vhost of %s has been removed.", nick); #endif #if defined(IRC_VIAGRA) send_cmd(NULL, "SVSMODE %s -x", nick); notice_lang(s_HostServ, u2, HOST_OFF_UNREAL, nick); notice(s_HostServ, u->nick, "The vhost of %s has been removed.", nick); #endif #if defined(IRC_ULTIMATE3) send_cmd(s_HostServ, "SVSMODE %s -x", nick); notice_lang(s_HostServ, u2, HOST_OFF_UNREAL, nick); notice(s_HostServ, u->nick, "The vhost of %s has been removed.", nick); #endif } } else { notice(s_HostServ, u->nick, ROFF_HELP_1, s_HostServ); } return MOD_CONT; } /** * /msg HostServ HELP ROFF **/ int hsRoffHelp(User *u) { if (is_host_setter(u)) { notice(s_HostServ, u->nick, ROFF_HELP_1, s_HostServ); notice(s_HostServ, u->nick, ROFF_HELP_2); notice(s_HostServ, u->nick, ROFF_HELP_3); } else { notice_lang(s_HostServ, u, NO_HELP_AVAILABLE, "ROFF"); } return MOD_CONT; } /** * Performed in wrong syntax **/ void hsMainHelp(User * u) { if (is_host_setter(u)) { notice(s_HostServ, u->nick, ROFF_HELP_MAIN); } } /* EOF */