]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_rline.cpp
Fix broken linking over IPv4 on IPv6 capable systems.
[user/henk/code/inspircd.git] / src / modules / m_rline.cpp
index 1247e81d3956a6469ad8c9973cef47396504bae5..c7088a8554880814b9ec5e1f6dd8d302fb006f6d 100644 (file)
@@ -80,9 +80,9 @@ 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 = 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());
+                               std::string expirystr = zl->duration ? InspIRCd::Format(" to expire in %s (on %s)", InspIRCd::DurationString(zl->duration).c_str(), InspIRCd::TimeString(zl->expiry).c_str()) : "";
+                               ServerInstance->SNO->WriteToSnoMask('x', "Z-line added due to R-line match on %s%s: %s",
+                                       zl->ipaddr.c_str(), expirystr.c_str(), zl->reason.c_str());
                                added_zline = true;
                        }
                        else
@@ -137,7 +137,7 @@ class CommandRLine : public Command
  public:
        CommandRLine(Module* Creator, RLineFactory& rlf) : Command(Creator,"RLINE", 1, 3), factory(rlf)
        {
-               flags_needed = 'o'; this->syntax = "<regex> [<rline-duration>] :<reason>";
+               flags_needed = 'o'; this->syntax = "<regex> [<duration> :<reason>]";
        }
 
        CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE
@@ -174,9 +174,9 @@ class CommandRLine : public Command
                                        }
                                        else
                                        {
-                                               time_t c_requires_crap = duration + ServerInstance->Time();
-                                               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());
+                                               ServerInstance->SNO->WriteToSnoMask('x', "%s added timed R-line for %s to expire in %s (on %s): %s",
+                                                       user->nick.c_str(), parameters[0].c_str(), InspIRCd::DurationString(duration).c_str(),
+                                                       InspIRCd::TimeString(ServerInstance->Time() + duration).c_str(), parameters[2].c_str());
                                        }
 
                                        ServerInstance->XLines->ApplyLines();
@@ -190,9 +190,11 @@ class CommandRLine : public Command
                }
                else
                {
-                       if (ServerInstance->XLines->DelLine(parameters[0].c_str(), "R", user))
+                       std::string reason;
+
+                       if (ServerInstance->XLines->DelLine(parameters[0].c_str(), "R", reason, user))
                        {
-                               ServerInstance->SNO->WriteToSnoMask('x',"%s removed R-line on %s",user->nick.c_str(),parameters[0].c_str());
+                               ServerInstance->SNO->WriteToSnoMask('x', "%s removed R-line on %s: %s", user->nick.c_str(), parameters[0].c_str(), reason.c_str());
                        }
                        else
                        {