#include "module.h" #define AUTHOR "Strike" #define VERSION "1.0.1" /********************************************************************** * hs_autohost.c - 16 October 2004 by Strike * * This module will automatically set vhosts via hostserv based * * upon the user's display name. This module should provide a * * system that should emulate ircu's +x mode. User's vhosts * * set in HostServ will still work. * * * * Tested on: * * 1) Unreal3.2 * * If you happen to test this module on another ircd, please * * contact me with your results at rokeaj@rpi.edu. * * Special thanks to: SGR * * * * This module would not have been possible without the help of * * DrStein. * * * * Changes: * * 1.0.0 - Works * * 1.0.1 - Added support for SolidIRCd (Thanks to BarkerJr) * * * * This module has 2 configurable options. * **********************************************************************/ // This is the host that will be set after the user's display name. // Default entry will set hosts to [groupowner].users.elitistfaction.net #define NETHOST "users.elitistfaction.net" // This is the message that will be sent to clients upon setting the vhost. // Comment this line out to run silently. #define MESSAGE "Your vhost has automatically been set to %s.%s" int do_setUserHost(User * u); int AnopeInit(int argc, char **argv) { Command *c; c = createCommand("IDENTIFY", do_setUserHost, NULL, -1, -1, -1, -1, -1); moduleAddCommand(NICKSERV, c, MOD_TAIL); c = createCommand("REGISTER", do_setUserHost, NULL, -1, -1, -1, -1, -1); moduleAddCommand(NICKSERV, c, MOD_TAIL); c = createCommand("GROUP", do_setUserHost, NULL, -1, -1, -1, -1, -1); moduleAddCommand(NICKSERV, c, MOD_TAIL); moduleAddAuthor(AUTHOR); moduleAddVersion(VERSION); alog("hs_autohost.c v%s by %s loaded", VERSION, AUTHOR); return MOD_CONT; } int do_setUserHost(User * u) { NickAlias *na; char *vHost; char *vIdent; if (!(na = u->na)) { return MOD_CONT; } vHost = getvHost(u->nick); vIdent = getvIdent(u->nick); if ((na->status & NS_IDENTIFIED)) { if (!vHost) { //SolidIRCd support added by BarkerJr #ifdef IRC_SOLID send_cmd(s_HostServ, "SVSMODE %s +v", u->nick); send_cmd(ServerName, "SVHOST %s %s.%s", u->nick, na->nc->display, NETHOST); #else send_cmd(s_HostServ, "CHGHOST %s %s.%s", u->nick, na->nc->display, NETHOST); #endif #ifdef MESSAGE notice(s_HostServ, u->nick, MESSAGE, na->nc->display, NETHOST); #endif return MOD_CONT; } } return MOD_CONT; }