]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Make various self contained methods static.
authorPeter Powell <petpow@saberuk.com>
Sun, 15 Dec 2013 05:34:00 +0000 (05:34 +0000)
committerPeter Powell <petpow@saberuk.com>
Sun, 15 Dec 2013 06:46:44 +0000 (06:46 +0000)
- InspIRCd::IsValidMask
- InspIRCd::TimeString

17 files changed:
include/inspircd.h
src/channels.cpp
src/commands/cmd_eline.cpp
src/commands/cmd_gline.cpp
src/commands/cmd_kline.cpp
src/commands/cmd_qline.cpp
src/commands/cmd_whowas.cpp
src/commands/cmd_zline.cpp
src/modules/m_cban.cpp
src/modules/m_connectban.cpp
src/modules/m_dccallow.cpp
src/modules/m_dnsbl.cpp
src/modules/m_rline.cpp
src/modules/m_shun.cpp
src/modules/m_spanningtree/addline.cpp
src/modules/m_svshold.cpp
src/modules/m_timedbans.cpp

index e02a5deb54b52a277493736ad8ecc7ac75b6cd6c..d045b347b6ddf59539a22a17d66b9cf0a989f5e8 100644 (file)
@@ -565,7 +565,7 @@ class CoreExport InspIRCd
         * @param mask A nick!user\@host masak to match against
         * @return True i the mask is valid
         */
-       bool IsValidMask(const std::string &mask);
+       static bool IsValidMask(const std::string& mask);
 
        /** Strips all color codes from the given string
         * @param sentence The string to strip from
@@ -685,7 +685,7 @@ class CoreExport InspIRCd
 
        /** Return a time_t as a human-readable string.
         */
-       std::string TimeString(time_t curtime);
+       static std::string TimeString(time_t curtime);
 
        /** Begin execution of the server.
         * NOTE: this function NEVER returns. Internally,
index 4e266fb7c4ba860ad3c1ceb26eac32c4c336493d..563bc27044c204618735dc0cf1bf506a1d95b325 100644 (file)
@@ -849,7 +849,7 @@ Invitation* Invitation::Find(Channel* c, LocalUser* u, bool check_expired)
                if ((check_expired) && (inv->expiry != 0) && (inv->expiry <= ServerInstance->Time()))
                {
                        /* Expired invite, remove it. */
-                       std::string expiration = ServerInstance->TimeString(inv->expiry);
+                       std::string expiration = InspIRCd::TimeString(inv->expiry);
                        ServerInstance->Logs->Log("INVITATION", LOG_DEBUG, "Invitation::Find ecountered expired entry: %p expired %s", (void*) inv, expiration.c_str());
                        i = locallist.erase(i);
                        inv->cull();
index 67f67e9f09cdd79beb0c938454fb0e235e3e9dc2..8025ba15add1dcad60fcc637aa1de4531a8624ee 100644 (file)
@@ -80,7 +80,7 @@ CmdResult CommandEline::Handle (const std::vector<std::string>& parameters, User
                        else
                        {
                                time_t c_requires_crap = duration + ServerInstance->Time();
-                               std::string timestr = ServerInstance->TimeString(c_requires_crap);
+                               std::string timestr = InspIRCd::TimeString(c_requires_crap);
                                ServerInstance->SNO->WriteToSnoMask('x',"%s added timed E-line for %s, expires on %s: %s",user->nick.c_str(),target.c_str(),
                                                timestr.c_str(), parameters[2].c_str());
                        }
index bdb5c26b2bd3aff0585fd7acfd5c14d1b6db716d..bc81172d3087532186556a4ac2e24f974c86e915 100644 (file)
@@ -87,7 +87,7 @@ CmdResult CommandGline::Handle (const std::vector<std::string>& parameters, User
                        else
                        {
                                time_t c_requires_crap = duration + ServerInstance->Time();
-                               std::string timestr = ServerInstance->TimeString(c_requires_crap);
+                               std::string timestr = InspIRCd::TimeString(c_requires_crap);
                                ServerInstance->SNO->WriteToSnoMask('x',"%s added timed G-line for %s, expires on %s: %s",user->nick.c_str(),target.c_str(),
                                                timestr.c_str(), parameters[2].c_str());
                        }
index 20afae2a910ff2339b6749a3394821b36b6f9df9..e95a7ca66d17585963daf2d4c15221f8255f984c 100644 (file)
@@ -87,7 +87,7 @@ CmdResult CommandKline::Handle (const std::vector<std::string>& parameters, User
                        else
                        {
                                time_t c_requires_crap = duration + ServerInstance->Time();
-                               std::string timestr = ServerInstance->TimeString(c_requires_crap);
+                               std::string timestr = InspIRCd::TimeString(c_requires_crap);
                                ServerInstance->SNO->WriteToSnoMask('x',"%s added timed K-line for %s, expires on %s: %s",user->nick.c_str(),target.c_str(),
                                                timestr.c_str(), parameters[2].c_str());
                        }
index bfc9e451948aa2841f92a7403743f1fef9f3dd68..06b0e74f1b7e1321397bfba5886656feaa3383ed 100644 (file)
@@ -63,7 +63,7 @@ CmdResult CommandQline::Handle (const std::vector<std::string>& parameters, User
                        else
                        {
                                time_t c_requires_crap = duration + ServerInstance->Time();
-                               std::string timestr = ServerInstance->TimeString(c_requires_crap);
+                               std::string timestr = InspIRCd::TimeString(c_requires_crap);
                                ServerInstance->SNO->WriteToSnoMask('x',"%s added timed Q-line for %s, expires on %s: %s",user->nick.c_str(),parameters[0].c_str(),
                                                timestr.c_str(), parameters[2].c_str());
                        }
index bdd16b5208fba345aeeaf5f7c27bda9dfe1d51e4..fab65aae319bbabf0147152a4758f74c804a5716 100644 (file)
@@ -62,7 +62,7 @@ CmdResult CommandWhowas::Handle (const std::vector<std::string>& parameters, Use
                                        user->WriteNumeric(RPL_WHOWASIP, "%s :was connecting from *@%s",
                                                parameters[0].c_str(), u->host.c_str());
 
-                               std::string signon = ServerInstance->TimeString(u->signon);
+                               std::string signon = InspIRCd::TimeString(u->signon);
                                bool hide_server = (!ServerInstance->Config->HideWhoisServer.empty() && !user->HasPrivPermission("servers/auspex"));
                                user->WriteNumeric(RPL_WHOISSERVER, "%s %s :%s", parameters[0].c_str(), (hide_server ? ServerInstance->Config->HideWhoisServer.c_str() : u->server.c_str()), signon.c_str());
                        }
index fdb156e0ab51a93049b4ffcd1f5f68607fe02026..2c5997558a4346b307827e5b1e9c9b80e389d2cc 100644 (file)
@@ -83,7 +83,7 @@ CmdResult CommandZline::Handle (const std::vector<std::string>& parameters, User
                        else
                        {
                                time_t c_requires_crap = duration + ServerInstance->Time();
-                               std::string timestr = ServerInstance->TimeString(c_requires_crap);
+                               std::string timestr = InspIRCd::TimeString(c_requires_crap);
                                ServerInstance->SNO->WriteToSnoMask('x',"%s added timed Z-line for %s, expires on %s: %s",user->nick.c_str(),ipaddr,
                                                timestr.c_str(), parameters[2].c_str());
                        }
index 5f3f1c7f16cc4168e19210f8df961fc19559c59f..4fb0653a91b1014e6da68ff377f9d17dfa5947df 100644 (file)
@@ -121,7 +121,7 @@ class CommandCBan : public Command
                                else
                                {
                                        time_t c_requires_crap = duration + ServerInstance->Time();
-                                       std::string timestr = ServerInstance->TimeString(c_requires_crap);
+                                       std::string timestr = InspIRCd::TimeString(c_requires_crap);
                                        ServerInstance->SNO->WriteGlobalSno('x', "%s added timed CBan for %s, expires on %s: %s", user->nick.c_str(), parameters[0].c_str(), timestr.c_str(), reason);
                                }
                        }
index 39639927ce4dd6b81e95d85a5c758dd37f6b8694..0b61ec668757e8fda26e6612cf1cafd6b5196930 100644 (file)
@@ -80,7 +80,7 @@ class ModuleConnectBan : public Module
                                }
                                ServerInstance->XLines->ApplyLines();
                                std::string maskstr = mask.str();
-                               std::string timestr = ServerInstance->TimeString(zl->expiry);
+                               std::string timestr = InspIRCd::TimeString(zl->expiry);
                                ServerInstance->SNO->WriteGlobalSno('x',"Module m_connectban added Z:line on *@%s to expire on %s: Connect flooding",
                                        maskstr.c_str(), timestr.c_str());
                                ServerInstance->SNO->WriteGlobalSno('a', "Connect flooding from IP range %s (%d)", maskstr.c_str(), threshold);
index e5c8df6aa9ab8f2bba0e3fd519ed5818e2e80c4b..487e4a7ed23fca65038e1d6a473ebe9de56f18ba 100644 (file)
@@ -168,7 +168,7 @@ class CommandDccallow : public Command
                                                length = InspIRCd::Duration(parameters[1]);
                                        }
 
-                                       if (!ServerInstance->IsValidMask(mask))
+                                       if (!InspIRCd::IsValidMask(mask))
                                        {
                                                return CMD_FAILURE;
                                        }
index fa9e73bd4b03828921b942b0532a9e93c008caae..48ce1d791ae88c3e0b02429dfc6dde4ebdd0582d 100644 (file)
@@ -136,7 +136,7 @@ class DNSBLResolver : public DNS::Request
                                                        "*", them->GetIPString());
                                        if (ServerInstance->XLines->AddLine(kl,NULL))
                                        {
-                                               std::string timestr = ServerInstance->TimeString(kl->expiry);
+                                               std::string timestr = InspIRCd::TimeString(kl->expiry);
                                                ServerInstance->SNO->WriteGlobalSno('x',"K:line added due to DNSBL match on *@%s to expire on %s: %s",
                                                        them->GetIPString().c_str(), timestr.c_str(), reason.c_str());
                                                ServerInstance->XLines->ApplyLines();
@@ -151,7 +151,7 @@ class DNSBLResolver : public DNS::Request
                                                        "*", them->GetIPString());
                                        if (ServerInstance->XLines->AddLine(gl,NULL))
                                        {
-                                               std::string timestr = ServerInstance->TimeString(gl->expiry);
+                                               std::string timestr = InspIRCd::TimeString(gl->expiry);
                                                ServerInstance->SNO->WriteGlobalSno('x',"G:line added due to DNSBL match on *@%s to expire on %s: %s",
                                                        them->GetIPString().c_str(), timestr.c_str(), reason.c_str());
                                                ServerInstance->XLines->ApplyLines();
@@ -166,7 +166,7 @@ class DNSBLResolver : public DNS::Request
                                                        them->GetIPString());
                                        if (ServerInstance->XLines->AddLine(zl,NULL))
                                        {
-                                               std::string timestr = ServerInstance->TimeString(zl->expiry);
+                                               std::string timestr = InspIRCd::TimeString(zl->expiry);
                                                ServerInstance->SNO->WriteGlobalSno('x',"Z:line added due to DNSBL match on *@%s to expire on %s: %s",
                                                        them->GetIPString().c_str(), timestr.c_str(), reason.c_str());
                                                ServerInstance->XLines->ApplyLines();
index 0bfdc35653b9229cd5dd7755a94eef02902a605c..35f88ea93cf6daae26ce804f62bdaa0223acbcb2 100644 (file)
@@ -78,7 +78,7 @@ class RLine : public XLine
                        ZLine* zl = new ZLine(ServerInstance->Time(), duration ? expiry - ServerInstance->Time() : 0, ServerInstance->Config->ServerName.c_str(), reason.c_str(), u->GetIPString());
                        if (ServerInstance->XLines->AddLine(zl, NULL))
                        {
-                               std::string timestr = ServerInstance->TimeString(zl->expiry);
+                               std::string timestr = InspIRCd::TimeString(zl->expiry);
                                ServerInstance->SNO->WriteToSnoMask('x', "Z-line added due to R-line match on *@%s%s%s: %s",
                                        zl->ipaddr.c_str(), zl->duration ? " to expire on " : "", zl->duration ? timestr.c_str() : "", zl->reason.c_str());
                                added_zline = true;
@@ -168,7 +168,7 @@ class CommandRLine : public Command
                                        else
                                        {
                                                time_t c_requires_crap = duration + ServerInstance->Time();
-                                               std::string timestr = ServerInstance->TimeString(c_requires_crap);
+                                               std::string timestr = InspIRCd::TimeString(c_requires_crap);
                                                ServerInstance->SNO->WriteToSnoMask('x', "%s added timed R-line for %s to expire on %s: %s", user->nick.c_str(), parameters[0].c_str(), timestr.c_str(), parameters[2].c_str());
                                        }
 
index f0524435b6a1363d8ee829494620a8aa7338bb1f..075b80eb7a47101eebb3860dbc9989cdf83f7512 100644 (file)
@@ -140,7 +140,7 @@ class CommandShun : public Command
                                else
                                {
                                        time_t c_requires_crap = duration + ServerInstance->Time();
-                                       std::string timestr = ServerInstance->TimeString(c_requires_crap);
+                                       std::string timestr = InspIRCd::TimeString(c_requires_crap);
                                        ServerInstance->SNO->WriteToSnoMask('x', "%s added timed SHUN for %s to expire on %s: %s",
                                                user->nick.c_str(), target.c_str(), timestr.c_str(), expr.c_str());
                                }
index d063176743548427129d96778382925c7f414623..f4485030ae6aa5688c1a0e790f06f90ff76e6c67 100644 (file)
@@ -50,7 +50,7 @@ CmdResult CommandAddLine::Handle(User* usr, std::vector<std::string>& params)
        {
                if (xl->duration)
                {
-                       std::string timestr = ServerInstance->TimeString(xl->expiry);
+                       std::string timestr = InspIRCd::TimeString(xl->expiry);
                        ServerInstance->SNO->WriteToSnoMask('X',"%s added %s%s on %s to expire on %s: %s",setter.c_str(),params[0].c_str(),params[0].length() == 1 ? "-line" : "",
                                        params[1].c_str(), timestr.c_str(), params[5].c_str());
                }
index 7d40f0cc09c13f97aa0460f67b1953361a51b3aa..bb2fcdbc083ae2252ad2c886bd027d628757666e 100644 (file)
@@ -123,7 +123,7 @@ class CommandSvshold : public Command
                                else
                                {
                                        time_t c_requires_crap = duration + ServerInstance->Time();
-                                       std::string timestr = ServerInstance->TimeString(c_requires_crap);
+                                       std::string timestr = InspIRCd::TimeString(c_requires_crap);
                                        ServerInstance->SNO->WriteGlobalSno('x', "%s added timed SVSHOLD for %s, expires on %s: %s", user->nick.c_str(), parameters[0].c_str(), timestr.c_str(), parameters[2].c_str());
                                }
                        }
index 2441f1aa812ed4506f42b5efadf8fa42a10127db..40cc162c15019ab99fae527cdaf74d5abb634ec6 100644 (file)
@@ -75,7 +75,7 @@ class CommandTban : public Command
                setban.push_back(parameters[0]);
                setban.push_back("+b");
                bool isextban = ((mask.size() > 2) && (mask[1] == ':'));
-               if (!isextban && !ServerInstance->IsValidMask(mask))
+               if (!isextban && !InspIRCd::IsValidMask(mask))
                        mask.append("!*@*");
 
                setban.push_back(mask);