1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
22 /* $ModDesc: Changes the ident of connecting bottler clients to 'bottler' */
24 class ModuleAntiBottler : public Module
30 ModuleAntiBottler(Server* Me)
36 void Implements(char* List)
38 List[I_OnServerRaw] = 1;
42 virtual ~ModuleAntiBottler()
46 virtual Version GetVersion()
48 return Version(1,0,0,1,VF_VENDOR);
51 virtual void OnServerRaw(std::string &raw, bool inbound, userrec* user)
56 strlcpy(data,raw.c_str(),MAXBUF);
57 bool not_bottler = false;
58 if (!strncmp(data,"user ",5))
60 for (char* j = data; *j; j++)
70 // Bug Fix (#14) -- FCS
72 if (!(data) || !(*data))
76 * slight efficiency fix: strtok() just returns NULL if it has no more
77 * tokens to return. Plus strlen's here really could have been replaced
78 * with above pointer voodoo :-). --w00t
81 char *ident = strtok(NULL," ");
82 char *local = strtok(NULL," ");
83 char *remote = strtok(NULL," :");
84 char *gecos = strtok(NULL,"\r\n");
86 if (!ident || !local || !remote || !gecos)
89 for (char* j = remote; *j; j++)
91 if (((*j < '0') || (*j > '9')) && (*j != '.'))
99 raw = "USER bottler "+std::string(local)+" "+std::string(remote)+" "+std::string(gecos)+" [Possible bottler, ident: "+std::string(ident)+"]";
107 class ModuleAntiBottlerFactory : public ModuleFactory
110 ModuleAntiBottlerFactory()
114 ~ModuleAntiBottlerFactory()
118 virtual Module * CreateModule(Server* Me)
120 return new ModuleAntiBottler(Me);
126 extern "C" void * init_module( void )
128 return new ModuleAntiBottlerFactory;