929
931
PutStatus("BufferCount for [" + sChan + "] set to [" + CString(pChan->GetBufferCount()) + "]");
930
932
} else if (m_pUser->IsAdmin() && sCommand.Equals("TRAFFIC")) {
931
CZNC::Get().UpdateTrafficStats();
932
const map<CString, CUser*>& msUsers = CZNC::Get().GetUserMap();
933
CZNC::TrafficStatsPair Users, ZNC, Total;
934
CZNC::TrafficStatsMap traffic = CZNC::Get().GetTrafficStats(Users, ZNC, Total);
935
CZNC::TrafficStatsMap::const_iterator it;
934
938
Table.AddColumn("Username");
935
939
Table.AddColumn("In");
936
940
Table.AddColumn("Out");
937
941
Table.AddColumn("Total");
938
unsigned long long users_total_in = 0;
939
unsigned long long users_total_out = 0;
940
for (map<CString, CUser*>::const_iterator it = msUsers.begin(); it != msUsers.end(); it++) {
943
for (it = traffic.begin(); it != traffic.end(); it++) {
942
945
Table.SetCell("Username", it->first);
943
Table.SetCell("In", CString::ToByteStr(it->second->BytesRead()));
944
Table.SetCell("Out", CString::ToByteStr(it->second->BytesWritten()));
945
Table.SetCell("Total", CString::ToByteStr(it->second->BytesRead() + it->second->BytesWritten()));
946
users_total_in += it->second->BytesRead();
947
users_total_out += it->second->BytesWritten();
946
Table.SetCell("In", CString::ToByteStr(it->second.first));
947
Table.SetCell("Out", CString::ToByteStr(it->second.second));
948
Table.SetCell("Total", CString::ToByteStr(it->second.first + it->second.second));
950
952
Table.SetCell("Username", "<Users>");
951
Table.SetCell("In", CString::ToByteStr(users_total_in));
952
Table.SetCell("Out", CString::ToByteStr(users_total_out));
953
Table.SetCell("Total", CString::ToByteStr(users_total_in + users_total_out));
953
Table.SetCell("In", CString::ToByteStr(Users.first));
954
Table.SetCell("Out", CString::ToByteStr(Users.second));
955
Table.SetCell("Total", CString::ToByteStr(Users.first + Users.second));
956
958
Table.SetCell("Username", "<ZNC>");
957
Table.SetCell("In", CString::ToByteStr(CZNC::Get().BytesRead()));
958
Table.SetCell("Out", CString::ToByteStr(CZNC::Get().BytesWritten()));
959
Table.SetCell("Total", CString::ToByteStr(CZNC::Get().BytesRead() + CZNC::Get().BytesWritten()));
959
Table.SetCell("In", CString::ToByteStr(ZNC.first));
960
Table.SetCell("Out", CString::ToByteStr(ZNC.second));
961
Table.SetCell("Total", CString::ToByteStr(ZNC.first + ZNC.second));
962
964
Table.SetCell("Username", "<Total>");
963
Table.SetCell("In", CString::ToByteStr(users_total_in + CZNC::Get().BytesRead()));
964
Table.SetCell("Out", CString::ToByteStr(users_total_out + CZNC::Get().BytesWritten()));
965
Table.SetCell("Total", CString::ToByteStr(users_total_in + CZNC::Get().BytesRead() + users_total_out + CZNC::Get().BytesWritten()));
965
Table.SetCell("In", CString::ToByteStr(Total.first));
966
Table.SetCell("Out", CString::ToByteStr(Total.second));
967
Table.SetCell("Total", CString::ToByteStr(Total.first + Total.second));
967
969
PutStatus(Table);
968
} else if (m_pUser->IsAdmin() && sCommand.Equals("UPTIME")) {
970
} else if (sCommand.Equals("UPTIME")) {
969
971
PutStatus("Running for " + CZNC::Get().GetUptime());
971
973
PutStatus("Unknown command [" + sCommand + "] try 'Help'");
1190
1197
Table.SetCell("Description", "Show basic traffic stats for all znc users");
1192
1199
Table.AddRow();
1193
Table.SetCell("Command", "Uptime");
1194
Table.SetCell("Arguments", "");
1195
Table.SetCell("Description", "Show how long ZNC is already running");
1198
1200
Table.SetCell("Command", "Broadcast");
1199
1201
Table.SetCell("Arguments", "[message]");
1200
1202
Table.SetCell("Description", "Broadcast a message to all users");