1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * Inspire is copyright (C) 2002-2004 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 * ---------------------------------------------------
21 /* $ModDesc: Changes the ident of connecting bottler clients to 'bottler' */
23 class ModuleAntiBottler : public Module
34 virtual ~ModuleAntiBottler()
39 virtual Version GetVersion()
41 return Version(1,0,0,0);
45 virtual void OnServerRaw(std::string &raw, bool inbound, userrec* user)
50 strncpy(data,raw.c_str(),MAXBUF);
51 bool not_bottler = false;
52 if (!strncmp(data,"user ",5))
54 for (int j = 0; j < strlen(data); j++)
64 // Bug Fix (#14) -- FCS
65 if (!strlen(data)) return;
66 char *user = strtok(data," ");
67 if (!strlen(data)) return;
68 char *ident = strtok(NULL," ");
69 if (!strlen(data)) return;
70 char *local = strtok(NULL," ");
71 if (!strlen(data)) return;
72 char *remote = strtok(NULL," :");
73 if (!strlen(data)) return;
74 char *gecos = strtok(NULL,"\r\n");
75 for (int j = 0; j < strlen(remote); j++)
77 if (((remote[j] < '0') || (remote[j] > '9')) && (remote[j] != '.'))
85 raw = "USER bottler "+std::string(local)+" "+std::string(remote)+" "+std::string(gecos)+" [Possible bottler, ident: "+std::string(ident)+"]";
93 class ModuleAntiBottlerFactory : public ModuleFactory
96 ModuleAntiBottlerFactory()
100 ~ModuleAntiBottlerFactory()
104 virtual Module * CreateModule()
106 return new ModuleAntiBottler;
112 extern "C" void * init_module( void )
114 return new ModuleAntiBottlerFactory;