1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2008 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
16 /* $ModDesc: Changes the ident of connecting bottler clients to 'bottler' */
18 class ModuleAntiBottler : public Module
21 ModuleAntiBottler(InspIRCd* Me)
25 Implementation eventlist[] = { I_OnPreCommand };
26 ServerInstance->Modules->Attach(eventlist, this, 1);
31 virtual ~ModuleAntiBottler()
35 virtual Version GetVersion()
37 return Version("$Id$",VF_VENDOR,API_VERSION);
40 virtual int OnPreCommand(std::string &command, std::vector<std::string> ¶meters, User *user, bool validated, const std::string &original_line)
43 strlcpy(data,original_line.c_str(),MAXBUF);
44 bool not_bottler = false;
45 if (!strncmp(data,"user ",5))
47 for (char* j = data; *j; j++)
57 // Bug Fix (#14) -- FCS
62 char *ident = strtok(NULL," ");
63 char *local = strtok(NULL," ");
64 char *remote = strtok(NULL," :");
65 char *gecos = strtok(NULL,"\r\n");
67 if (!ident || !local || !remote || !gecos)
70 for (char* j = remote; *j; j++)
72 if (((*j < '0') || (*j > '9')) && (*j != '.'))
80 std::string strgecos = std::string(gecos) + "[Possible bottler, ident: " + std::string(ident) + "]";
81 std::vector<std::string> modified;
82 modified.push_back("bottler");
83 modified.push_back(local);
84 modified.push_back(remote);
85 modified.push_back(strgecos);
86 ServerInstance->Parser->CallHandler("USER", modified, user);
94 MODULE_INIT(ModuleAntiBottler)