1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2009 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/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
24 Implementation eventlist[] = { I_OnPreCommand };
25 ServerInstance->Modules->Attach(eventlist, this, 1);
30 virtual ~ModuleAntiBottler()
34 virtual Version GetVersion()
36 return Version("Changes the ident of connecting bottler clients to 'bottler'",VF_VENDOR,API_VERSION);
39 virtual ModResult OnPreCommand(std::string &command, std::vector<std::string> ¶meters, User *user, bool validated, const std::string &original_line)
42 strlcpy(data,original_line.c_str(),MAXBUF);
43 bool not_bottler = false;
44 if (!strncmp(data,"user ",5))
46 for (char* j = data; *j; j++)
56 // Bug Fix (#14) -- FCS
58 return MOD_RES_PASSTHRU;
61 char *ident = strtok(NULL," ");
62 char *local = strtok(NULL," ");
63 char *remote = strtok(NULL," :");
64 char *gecos = strtok(NULL,"\r\n");
66 if (!ident || !local || !remote || !gecos)
67 return MOD_RES_PASSTHRU;
69 for (char* j = remote; *j; j++)
71 if (((*j < '0') || (*j > '9')) && (*j != '.'))
79 std::string strgecos = std::string(gecos) + "[Possible bottler, ident: " + std::string(ident) + "]";
80 std::vector<std::string> modified;
81 modified.push_back("bottler");
82 modified.push_back(local);
83 modified.push_back(remote);
84 modified.push_back(strgecos);
85 ServerInstance->Parser->CallHandler("USER", modified, user);
89 return MOD_RES_PASSTHRU;
93 MODULE_INIT(ModuleAntiBottler)