]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/override_map.cpp
NEVER use the two-param assign unless you want your string padding to len bytes with \0!
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / override_map.cpp
index d978c99ccb95d0d23633024f735f367494824ce5..01423b60a2a57b57c05b3f27106e0e4ee749b8e9 100644 (file)
@@ -26,7 +26,7 @@
 const std::string ModuleSpanningTree::MapOperInfo(TreeServer* Current)
 {
        time_t secs_up = ServerInstance->Time() - Current->age;
-       return (" [Up: " + TimeToStr(secs_up) + " Lag: " + (Current->rtt == 0 ? "<1ms" : ConvToStr(Current->rtt)) + "ms]");
+       return (" [Up: " + TimeToStr(secs_up) + " Lag: " + (Current->rtt == 0 ? "<1" : ConvToStr(Current->rtt)) + "ms]");
 }
                
 // WARNING: NOT THREAD SAFE - DONT GET ANY SMART IDEAS.
@@ -82,16 +82,16 @@ void ModuleSpanningTree::ShowMap(TreeServer* Current, User* user, int depth, cha
                        ServerInstance->Logs->Log("map",DEBUG,"Hidden? %d HideULines? %d GetName %s", Current->GetChild(q)->Hidden, Utils->HideULines, Current->GetChild(q)->GetName().c_str());
                        if ((Current->GetChild(q)->Hidden) || ((Utils->HideULines) && (ServerInstance->ULine(Current->GetChild(q)->GetName().c_str()))))
                        {
-                               if (*user->oper)
+                               if (IS_OPER(user))
                                {
-                                       ShowMap(Current->GetChild(q),user,(Utils->FlatLinks && (!*user->oper)) ? depth : depth+2,matrix,totusers,totservers);
+                                       ShowMap(Current->GetChild(q),user,(Utils->FlatLinks && (!IS_OPER(user))) ? depth : depth+2,matrix,totusers,totservers);
                                        ServerInstance->Logs->Log("map",DEBUG,"Show to oper");
                                }
                                ServerInstance->Logs->Log("map",DEBUG,"Fall through");
                        }
                        else
                        {
-                               ShowMap(Current->GetChild(q),user,(Utils->FlatLinks && (!*user->oper)) ? depth : depth+2,matrix,totusers,totservers);
+                               ShowMap(Current->GetChild(q),user,(Utils->FlatLinks && (!IS_OPER(user))) ? depth : depth+2,matrix,totusers,totservers);
                                ServerInstance->Logs->Log("map",DEBUG,"Show to non oper");
                        }
                }
@@ -108,16 +108,16 @@ void ModuleSpanningTree::ShowMap(TreeServer* Current, User* user, int depth, cha
 // and divisons, we instead render the map onto a backplane of characters
 // (a character matrix), then draw the branches as a series of "L" shapes
 // from the nodes. This is not only friendlier on CPU it uses less stack.
-int ModuleSpanningTree::HandleMap(const char* const* parameters, int pcnt, User* user)
+int ModuleSpanningTree::HandleMap(const std::vector<std::string>& parameters, User* user)
 {
-       if (pcnt > 0)
+       if (parameters.size() > 0)
        {
                /* Remote MAP, the server is within the 1st parameter */
                TreeServer* s = Utils->FindServerMask(parameters[0]);
                bool ret = false;
                if (!s)
                {
-                       user->WriteServ( "402 %s %s :No such server", user->nick, parameters[0]);
+                       user->WriteServ( "402 %s %s :No such server", user->nick.c_str(), parameters[0].c_str());
                        ret = true;
                }
                else if (s && s != Utils->TreeRoot)
@@ -196,10 +196,10 @@ int ModuleSpanningTree::HandleMap(const char* const* parameters, int pcnt, User*
                ServerInstance->Logs->Log("map",DEBUG,"local");
                for (int t = 0; t < line; t++)
                {
-                       user->WriteNumeric(6, "%s :%s",user->nick,&matrix[t][0]);
+                       user->WriteNumeric(6, "%s :%s",user->nick.c_str(),&matrix[t][0]);
                }
-               user->WriteNumeric(270, "%s :%.0f server%s and %.0f user%s, average %.2f users per server",user->nick,totservers,(totservers > 1 ? "s" : ""),totusers,(totusers > 1 ? "s" : ""),avg_users);
-               user->WriteNumeric(7, "%s :End of /MAP",user->nick);
+               user->WriteNumeric(270, "%s :%.0f server%s and %.0f user%s, average %.2f users per server",user->nick.c_str(),totservers,(totservers > 1 ? "s" : ""),totusers,(totusers > 1 ? "s" : ""),avg_users);
+               user->WriteNumeric(7, "%s :End of /MAP",user->nick.c_str());
        }
        else
        {