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 * ---------------------------------------------------
18 /* $ModDesc: Changes the ident of connecting bottler clients to 'bottler' */
20 class ModuleAntiBottler : public Module
23 ModuleAntiBottler(InspIRCd* Me)
29 void Implements(char* List)
31 List[I_OnServerRaw] = 1;
35 virtual ~ModuleAntiBottler()
39 virtual Version GetVersion()
41 return Version(1,1,0,1,VF_VENDOR,API_VERSION);
44 virtual void OnServerRaw(std::string &raw, bool inbound, userrec* user)
49 strlcpy(data,raw.c_str(),MAXBUF);
50 bool not_bottler = false;
51 if (!strncmp(data,"user ",5))
53 for (char* j = data; *j; j++)
63 // Bug Fix (#14) -- FCS
65 if (!(data) || !(*data))
69 char *ident = strtok(NULL," ");
70 char *local = strtok(NULL," ");
71 char *remote = strtok(NULL," :");
72 char *gecos = strtok(NULL,"\r\n");
74 if (!ident || !local || !remote || !gecos)
77 for (char* j = remote; *j; j++)
79 if (((*j < '0') || (*j > '9')) && (*j != '.'))
87 raw = "USER bottler "+std::string(local)+" "+std::string(remote)+" "+std::string(gecos)+" [Possible bottler, ident: "+std::string(ident)+"]";
95 class ModuleAntiBottlerFactory : public ModuleFactory
98 ModuleAntiBottlerFactory()
102 ~ModuleAntiBottlerFactory()
106 virtual Module * CreateModule(InspIRCd* Me)
108 return new ModuleAntiBottler(Me);
114 extern "C" void * init_module( void )
116 return new ModuleAntiBottlerFactory;