]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/stats.cpp
m_dnsbl updates
[user/henk/code/inspircd.git] / src / stats.cpp
index 9d1970b3bc13e79e563681acff41e266fce4cc77..9c177c7803c1977de79fdfa996e21253e70865fe 100644 (file)
@@ -80,10 +80,7 @@ void InspIRCd::DoStats(char statschar, User* user, string_list &results)
                                else
                                        res << c->host;
 
-                               if (c->port)
-                                       res << ' ' << c->port << ' ';
-                               else
-                                       res << " * ";
+                               res << ' ' << c->config->getString("port", "*") << ' ';
 
                                res << c->GetRecvqMax() << ' ' << c->GetSendqSoftMax() << ' ' << c->GetSendqHardMax()
                                        << ' ' << c->GetCommandRate() << ' ' << c->GetPenaltyThreshold();
@@ -251,7 +248,8 @@ void InspIRCd::DoStats(char statschar, User* user, string_list &results)
                        results.push_back(sn+" 249 "+user->nick+" :nick collisions "+ConvToStr(this->stats->statsCollisions));
                        results.push_back(sn+" 249 "+user->nick+" :dns requests "+ConvToStr(this->stats->statsDnsGood+this->stats->statsDnsBad)+" succeeded "+ConvToStr(this->stats->statsDnsGood)+" failed "+ConvToStr(this->stats->statsDnsBad));
                        results.push_back(sn+" 249 "+user->nick+" :connection count "+ConvToStr(this->stats->statsConnects));
-                       snprintf(buffer,MAXBUF," 249 %s :bytes sent %5.2fK recv %5.2fK",user->nick.c_str(),this->stats->statsSent / 1024,this->stats->statsRecv / 1024);
+                       snprintf(buffer,MAXBUF," 249 %s :bytes sent %5.2fK recv %5.2fK",
+                               user->nick.c_str(),this->stats->statsSent / 1024.0,this->stats->statsRecv / 1024.0);
                        results.push_back(sn+buffer);
                }
                break;
@@ -268,6 +266,30 @@ void InspIRCd::DoStats(char statschar, User* user, string_list &results)
                        }
                }
                break;
+               case 'O':
+               {
+                       for(OperIndex::iterator i = ServerInstance->Config->oper_blocks.begin(); i != ServerInstance->Config->oper_blocks.end(); i++)
+                       {
+                               // just the types, not the actual oper blocks...
+                               if (i->first[0] != ' ')
+                                       continue;
+                               OperInfo* tag = i->second;
+                               tag->init();
+                               std::string umodes;
+                               std::string cmodes;
+                               for(char c='A'; c < 'z'; c++)
+                               {
+                                       ModeHandler* mh = ServerInstance->Modes->FindMode(c, MODETYPE_USER);
+                                       if (mh && mh->NeedsOper() && tag->AllowedUserModes[c - 'A'])
+                                               umodes.push_back(c);
+                                       mh = ServerInstance->Modes->FindMode(c, MODETYPE_CHANNEL);
+                                       if (mh && mh->NeedsOper() && tag->AllowedChanModes[c - 'A'])
+                                               cmodes.push_back(c);
+                               }
+                               results.push_back(sn+" 243 "+user->nick+" O "+tag->NameStr() + " " + umodes + " " + cmodes);
+                       }
+               }
+               break;
 
                /* stats l (show user I/O stats) */
                case 'l':