]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_check.cpp
Merge pull request #1018 from SaberUK/insp20+hidekills
[user/henk/code/inspircd.git] / src / modules / m_check.cpp
index cabfd02bcfe782f2128f4ceb57b93427820e95b0..9c5c414f195473386d4b7bf2b2ad95061a694d10 100644 (file)
@@ -20,9 +20,9 @@
  */
 
 
-#include "inspircd.h"
+/* $ModDesc: Provides the /CHECK command to retrieve information on a user, channel, hostname or IP address */
 
-/* $ModDesc: Provides the /check command to retrieve information on a user, channel, or IP address */
+#include "inspircd.h"
 
 /** Handle /CHECK
  */
@@ -38,11 +38,13 @@ class CommandCheck : public Command
        {
                char timebuf[60];
                struct tm *mytime = gmtime(&time);
-               strftime(timebuf, 59, "%Y-%m-%d %H:%M:%S UTC (%s)", mytime);
-               return std::string(timebuf);
+               strftime(timebuf, 59, "%Y-%m-%d %H:%M:%S UTC (", mytime);
+               std::string ret(timebuf);
+               ret.append(ConvToStr(time)).push_back(')');
+               return ret;
        }
 
-       void dumpExt(User* user, std::string checkstr, Extensible* ext)
+       void dumpExt(User* user, const std::string& checkstr, Extensible* ext)
        {
                std::stringstream dumpkeys;
                for(Extensible::ExtensibleStore::const_iterator i = ext->GetExtList().begin(); i != ext->GetExtList().end(); i++)
@@ -68,7 +70,7 @@ class CommandCheck : public Command
                std::string checkstr;
                std::string chliststr;
 
-               checkstr = std::string(":") + ServerInstance->Config->ServerName + " 304 " + std::string(user->nick) + " :CHECK";
+               checkstr = ":" + ServerInstance->Config->ServerName + " 304 " + user->nick + " :CHECK";
 
                targuser = ServerInstance->FindNick(parameters[0]);
                targchan = ServerInstance->FindChan(parameters[0]);
@@ -114,7 +116,7 @@ class CommandCheck : public Command
                                {
                                        std::string umodes;
                                        std::string cmodes;
-                                       for(char c='A'; c < 'z'; c++)
+                                       for(char c='A'; c <= 'z'; c++)
                                        {
                                                ModeHandler* mh = ServerInstance->Modes->FindMode(c, MODETYPE_USER);
                                                if (mh && mh->NeedsOper() && loctarg->HasModePermission(c, MODETYPE_USER))
@@ -199,7 +201,6 @@ class CommandCheck : public Command
                        }
 
                        irc::modestacker modestack(true);
-                       std::string letter_b("b");
                        for(BanList::iterator b = targchan->bans.begin(); b != targchan->bans.end(); ++b)
                        {
                                modestack.Push('b', b->data);
@@ -225,13 +226,13 @@ class CommandCheck : public Command
                                if (InspIRCd::Match(a->second->host, parameters[0], ascii_case_insensitive_map) || InspIRCd::Match(a->second->dhost, parameters[0], ascii_case_insensitive_map))
                                {
                                        /* host or vhost matches mask */
-                                       user->SendText(checkstr + " match " + ConvToStr(++x) + " " + a->second->GetFullRealHost());
+                                       user->SendText(checkstr + " match " + ConvToStr(++x) + " " + a->second->GetFullRealHost() + " " + a->second->GetIPString() + " " + a->second->fullname);
                                }
                                /* IP address */
                                else if (InspIRCd::MatchCIDR(a->second->GetIPString(), parameters[0]))
                                {
                                        /* same IP. */
-                                       user->SendText(checkstr + " match " + ConvToStr(++x) + " " + a->second->GetFullRealHost());
+                                       user->SendText(checkstr + " match " + ConvToStr(++x) + " " + a->second->GetFullRealHost() + " " + a->second->GetIPString() + " " + a->second->fullname);
                                }
                        }
 
@@ -288,7 +289,7 @@ class ModuleCheck : public Module
 
        Version GetVersion()
        {
-               return Version("CHECK command, view user/channel details", VF_VENDOR|VF_OPTCOMMON);
+               return Version("CHECK command, view user, channel, IP address or hostname information", VF_VENDOR|VF_OPTCOMMON);
        }
 };