Traffic API breakage again

The last commit broke the order in which the traffic stats used to be displayed
and it turns out that KiNgMaR cannot live with that, so now we are back to the
old order.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1523 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2009-05-27 10:49:48 +00:00
parent d724a4776c
commit 85dce87d6a
3 changed files with 39 additions and 14 deletions

View File

@@ -928,9 +928,10 @@ void CClient::UserCommand(const CString& sLine) {
PutStatus("BufferCount for [" + sChan + "] set to [" + CString(pChan->GetBufferCount()) + "]");
} else if (m_pUser->IsAdmin() && sCommand.Equals("TRAFFIC")) {
map<CString, std::pair<unsigned long long, unsigned long long> >::const_iterator it;
map<CString, std::pair<unsigned long long, unsigned long long> > traffic =
CZNC::Get().GetTrafficStats();
CZNC::TrafficStatsPair Users, ZNC, Total;
CZNC::TrafficStatsMap traffic = CZNC::Get().GetTrafficStats(Users, ZNC, Total);
CZNC::TrafficStatsMap::const_iterator it;
CTable Table;
Table.AddColumn("Username");
Table.AddColumn("In");
@@ -945,6 +946,24 @@ void CClient::UserCommand(const CString& sLine) {
Table.SetCell("Total", CString::ToByteStr(it->second.first + it->second.second));
}
Table.AddRow();
Table.SetCell("Username", "<Users>");
Table.SetCell("In", CString::ToByteStr(Users.first));
Table.SetCell("Out", CString::ToByteStr(Users.second));
Table.SetCell("Total", CString::ToByteStr(Users.first + Users.second));
Table.AddRow();
Table.SetCell("Username", "<ZNC>");
Table.SetCell("In", CString::ToByteStr(ZNC.first));
Table.SetCell("Out", CString::ToByteStr(ZNC.second));
Table.SetCell("Total", CString::ToByteStr(ZNC.first + ZNC.second));
Table.AddRow();
Table.SetCell("Username", "<Total>");
Table.SetCell("In", CString::ToByteStr(Total.first));
Table.SetCell("Out", CString::ToByteStr(Total.second));
Table.SetCell("Total", CString::ToByteStr(Total.first + Total.second));
PutStatus(Table);
} else if (m_pUser->IsAdmin() && sCommand.Equals("UPTIME")) {
PutStatus("Running for " + CZNC::Get().GetUptime());