1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 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);
29 void Implements(char* List)
31 List[I_OnPreCommand] = 1;
35 virtual ~ModuleAntiBottler()
39 virtual Version GetVersion()
41 return Version(1,1,0,1,VF_VENDOR,API_VERSION);
44 virtual int OnPreCommand(const std::string &command, const char** parameters, int pcnt, User *user, bool validated, const std::string &original_line)
47 strlcpy(data,original_line.c_str(),MAXBUF);
48 bool not_bottler = false;
49 if (!strncmp(data,"user ",5))
51 for (char* j = data; *j; j++)
61 // Bug Fix (#14) -- FCS
66 char *ident = strtok(NULL," ");
67 char *local = strtok(NULL," ");
68 char *remote = strtok(NULL," :");
69 char *gecos = strtok(NULL,"\r\n");
71 if (!ident || !local || !remote || !gecos)
74 for (char* j = remote; *j; j++)
76 if (((*j < '0') || (*j > '9')) && (*j != '.'))
84 std::string strgecos = std::string(gecos) + "[Possible bottler, ident: " + std::string(ident) + "]";
85 const char* modified[4];
86 modified[0] = "bottler";
89 modified[3] = strgecos.c_str();
90 ServerInstance->Parser->CallHandler("USER", modified, 4, user);
98 MODULE_INIT(ModuleAntiBottler)