1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2008 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 * ---------------------------------------------------
17 /* $ModDesc: Provides /tline command used to test who a mask matches */
21 class CommandTline : public Command
24 CommandTline (InspIRCd* Instance) : Command(Instance,"TLINE", "o", 1)
26 this->source = "m_tline.so";
27 this->syntax = "<mask>";
30 CmdResult Handle (const char* const* parameters, int pcnt, User *user)
34 float n_match_host = 0;
37 for (user_hash::const_iterator u = ServerInstance->Users->clientlist->begin(); u != ServerInstance->Users->clientlist->end(); u++)
40 if (match(u->second->GetFullRealHost(),parameters[0]))
48 snprintf(host, MAXBUF, "%s@%s", u->second->ident, u->second->GetIPString());
49 if (match(host, parameters[0], true))
57 user->WriteServ( "NOTICE %s :*** TLINE: Counted %0.0f user(s). Matched '%s' against %0.0f user(s) (%0.2f%% of the userbase). %0.0f by hostname and %0.0f by IP address.",user->nick, n_counted, parameters[0], n_matched, (n_matched/n_counted)*100, n_match_host, n_match_ip);
59 user->WriteServ( "NOTICE %s :*** TLINE: Counted %0.0f user(s). Matched '%s' against no user(s).", user->nick, n_counted, parameters[0]);
65 class ModuleTLine : public Module
67 CommandTline* newcommand;
69 ModuleTLine(InspIRCd* Me)
73 newcommand = new CommandTline(ServerInstance);
74 ServerInstance->AddCommand(newcommand);
79 virtual ~ModuleTLine()
83 virtual Version GetVersion()
85 return Version(1, 2, 0, 0, VF_VENDOR,API_VERSION);
89 MODULE_INIT(ModuleTLine)