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 * ---------------------------------------------------
19 /* $ModDesc: Changes the ident of connecting bottler clients to 'bottler' */
21 class ModuleAntiBottler : public Module
24 ModuleAntiBottler(InspIRCd* Me)
30 void Implements(char* List)
32 List[I_OnPreCommand] = 1;
36 virtual ~ModuleAntiBottler()
40 virtual Version GetVersion()
42 return Version(1,1,0,1,VF_VENDOR,API_VERSION);
45 virtual int OnPreCommand(const std::string &command, const char** parameters, int pcnt, userrec *user, bool validated, const std::string &original_line)
48 strlcpy(data,original_line.c_str(),MAXBUF);
49 bool not_bottler = false;
50 if (!strncmp(data,"user ",5))
52 for (char* j = data; *j; j++)
62 // Bug Fix (#14) -- FCS
63 if (!(data) || !(*data))
67 char *ident = strtok(NULL," ");
68 char *local = strtok(NULL," ");
69 char *remote = strtok(NULL," :");
70 char *gecos = strtok(NULL,"\r\n");
72 if (!ident || !local || !remote || !gecos)
75 for (char* j = remote; *j; j++)
77 if (((*j < '0') || (*j > '9')) && (*j != '.'))
85 std::string strgecos = std::string(gecos) + "[Possible bottler, ident: " + std::string(ident) + "]";
86 const char* modified[3];
87 modified[0] = "bottler";
90 modified[3] = strgecos.c_str();
91 ServerInstance->Parser->CallHandler("USER", modified, 4, user);
100 class ModuleAntiBottlerFactory : public ModuleFactory
103 ModuleAntiBottlerFactory()
107 ~ModuleAntiBottlerFactory()
111 virtual Module * CreateModule(InspIRCd* Me)
113 return new ModuleAntiBottler(Me);
119 extern "C" DllExport void * init_module( void )
121 return new ModuleAntiBottlerFactory;