]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/addline.cpp
m_spanningtree Remove SpanningTreeUtilities* fields and parameters
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / addline.cpp
index db9a7f2d6e49fc4cfdfecf91f371d7f6a3bee0e6..2ef76a351ce7e8fc2b1da52fffdd658363254619 100644 (file)
 #include "treeserver.h"
 #include "utils.h"
 
-/* $ModDep: m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */
-
 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());
+               const std::string& servername = MyRoot->GetName();
+               ServerInstance->SNO->WriteToSnoMask('d', "%s sent me a malformed ADDLINE", servername.c_str());
                return true;
        }
 
@@ -44,7 +43,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 +55,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
                {