]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_tline.cpp
Only assign NewServices once the duplicate check is done.
[user/henk/code/inspircd.git] / src / modules / m_tline.cpp
index 64beb31203c5db6adcd5a7425cf238af80b88b7b..6cb1f0d369c7b0448be1a86971abcd18adce5b82 100644 (file)
@@ -1,8 +1,13 @@
 /*
  * InspIRCd -- Internet Relay Chat Daemon
  *
+ *   Copyright (C) 2013, 2018 Sadie Powell <sadie@witchery.services>
+ *   Copyright (C) 2012, 2019 Robby <robby@chatbelgie.be>
+ *   Copyright (C) 2012, 2014 Attila Molnar <attilamolnar@hush.com>
+ *   Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
+ *   Copyright (C) 2007-2008 Robin Burchell <robin+git@viroteck.net>
  *   Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
- *   Copyright (C) 2006-2007 Craig Edwards <craigedwards@brainbox.cc>
+ *   Copyright (C) 2006, 2008, 2010 Craig Edwards <brain@inspircd.org>
  *
  * This file is part of InspIRCd.  InspIRCd is free software: you can
  * redistribute it and/or modify it under the terms of the GNU General Public
@@ -30,13 +35,14 @@ class CommandTline : public Command
                flags_needed = 'o'; this->syntax = "<mask>";
        }
 
-       CmdResult Handle (const std::vector<std::string> &parameters, User *user)
+       CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE
        {
                unsigned int n_matched = 0;
                unsigned int n_match_host = 0;
                unsigned int n_match_ip = 0;
 
-               for (user_hash::const_iterator u = ServerInstance->Users->clientlist->begin(); u != ServerInstance->Users->clientlist->end(); u++)
+               const user_hash& users = ServerInstance->Users->GetUsers();
+               for (user_hash::const_iterator u = users.begin(); u != users.end(); ++u)
                {
                        if (InspIRCd::Match(u->second->GetFullRealHost(),parameters[0]))
                        {
@@ -54,7 +60,7 @@ class CommandTline : public Command
                        }
                }
 
-               unsigned long n_counted = ServerInstance->Users->clientlist->size();
+               unsigned long n_counted = users.size();
                if (n_matched)
                {
                        float p = (n_matched / (float)n_counted) * 100;
@@ -78,7 +84,7 @@ class ModuleTLine : public Module
 
        Version GetVersion() CXX11_OVERRIDE
        {
-               return Version("Provides /tline command used to test who a mask matches", VF_VENDOR);
+               return Version("Adds the /TLINE command which allows server operators to determine how many users would be affected by an X-line on a specified pattern.", VF_VENDOR);
        }
 };