]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/addline.cpp
m_spanningtree atoi() to ConvToInt() conversion, add const where possible
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / addline.cpp
index db9a7f2d6e49fc4cfdfecf91f371d7f6a3bee0e6..a43112ce97e0316be0b11c6c7816f5debe13769e 100644 (file)
@@ -30,7 +30,8 @@ bool TreeSocket::AddLine(const std::string &prefix, parameterlist &params)
 {
        if (params.size() < 6)
        {
-               ServerInstance->SNO->WriteToSnoMask('d',"%s sent me a malformed ADDLINE of type %s.",prefix.c_str(),params[0].c_str());
+               std::string servername = MyRoot->GetName();
+               ServerInstance->SNO->WriteToSnoMask('d', "%s sent me a malformed ADDLINE", servername.c_str());
                return true;
        }
 
@@ -44,7 +45,7 @@ bool TreeSocket::AddLine(const std::string &prefix, parameterlist &params)
        {
                TreeServer* t = Utils->FindServer(prefix);
                if (t)
-                       setter = t->GetName().c_str();
+                       setter = t->GetName();
        }
 
        if (!xlf)
@@ -56,20 +57,21 @@ bool TreeSocket::AddLine(const std::string &prefix, parameterlist &params)
        XLine* xl = NULL;
        try
        {
-               xl = xlf->Generate(ServerInstance->Time(), atoi(params[4].c_str()), params[2], params[5], params[1]);
+               xl = xlf->Generate(ServerInstance->Time(), ConvToInt(params[4]), params[2], params[5], params[1]);
        }
        catch (ModuleException &e)
        {
                ServerInstance->SNO->WriteToSnoMask('d',"Unable to ADDLINE type %s from %s: %s", params[0].c_str(), setter.c_str(), e.GetReason());
                return true;
        }
-       xl->SetCreateTime(atoi(params[3].c_str()));
+       xl->SetCreateTime(ConvToInt(params[3]));
        if (ServerInstance->XLines->AddLine(xl, NULL))
        {
                if (xl->duration)
                {
+                       std::string timestr = ServerInstance->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(),ServerInstance->TimeString(xl->expiry).c_str(),params[5].c_str());
+                                       params[1].c_str(), timestr.c_str(), params[5].c_str());
                }
                else
                {