]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree.cpp
Added 005 stuff after VERSION
[user/henk/code/inspircd.git] / src / modules / m_spanningtree.cpp
index ea5d0664afb981230167afe884559be31b740534..1e597c9104284cac16926e0a70457dfbaeb21d29 100644 (file)
@@ -1569,7 +1569,7 @@ class TreeSocket : public InspSocket
                        if (params.size() == 1)
                        {
                                userrec* x = Srv->FindNick(params[0]);
-                               if (x->fd > -1)
+                               if ((x) && (x->fd > -1))
                                {
                                        userrec* x = Srv->FindNick(params[0]);
                                        log(DEBUG,"Got IDLE");
@@ -1595,7 +1595,7 @@ class TreeSocket : public InspSocket
                        {
                                std::string who_did_the_whois = params[0];
                                userrec* who_to_send_to = Srv->FindNick(who_did_the_whois);
-                               if (who_to_send_to->fd > -1)
+                               if ((who_to_send_to) && (who_to_send_to->fd > -1))
                                {
                                        log(DEBUG,"Got final IDLE");
                                        // an incoming reply to a whois we sent out
@@ -2468,7 +2468,9 @@ class ModuleSpanningTree : public Module
                        memset(spacer,' ',40);
                        if ((40 - Current->GetName().length() - depth) > 1) {
                                spacer[40 - Current->GetName().length() - depth] = '\0';
-                       } else {
+                       }
+                       else
+                       {
                                spacer[5] = '\0';
                        }
 
@@ -2477,10 +2479,12 @@ class ModuleSpanningTree : public Module
                        if (clientlist.size() == 0) {
                                // If there are no users, WHO THE HELL DID THE /MAP?!?!?!
                                percent = 0;
-                       } else {
+                       }
+                       else
+                       {
                                percent = ((float)Current->GetUserCount() / (float)clientlist.size()) * 100;
                        }
-                       snprintf(text, 80, "%s %s%d [%.2f%%]", Current->GetName().c_str(), spacer, Current->GetUserCount(), percent);
+                       snprintf(text, 80, "%s %s%5d [%5.2f%%]", Current->GetName().c_str(), spacer, Current->GetUserCount(), percent);
                        strlcpy(&matrix[line][depth],text,80);
                        line++;
                        for (unsigned int q = 0; q < Current->ChildCount(); q++)
@@ -2659,6 +2663,25 @@ class ModuleSpanningTree : public Module
                {
                        std::string Version = found->GetVersion();
                        WriteServ(user->fd,"351 %s :%s",user->nick,Version.c_str());
+                       if (found == TreeRoot)
+                       {
+                               std::stringstream out(Config->data005);
+                               std::string token = "";
+                               std::string line5 = "";
+                               int token_counter = 0;
+                               while (!out.eof())
+                               {
+                                       out >> token;
+                                       line5 = line5 + token + " ";   
+                                       token_counter++;
+                                       if ((token_counter >= 13) || (out.eof() == true))
+                                       {
+                                               WriteServ(user->fd,"005 %s %s:are supported by this server",user->nick,line5.c_str());
+                                               line5 = "";
+                                               token_counter = 0;
+                                       }
+                               }
+                       }
                }
                else
                {