]> 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 2f83916ac666d6ccec6aba29408dac384590a836..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
@@ -2484,7 +2484,7 @@ class ModuleSpanningTree : public Module
                        {
                                percent = ((float)Current->GetUserCount() / (float)clientlist.size()) * 100;
                        }
-                       snprintf(text, 80, "%s %s%5d [%3.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++)
@@ -2663,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
                {