mirror of
https://github.com/znc/znc.git
synced 2026-08-01 06:23:32 +02:00
Add a web interface to listsockets
Thanks to kylef for the patch and again sorry for svn. ;) git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2212 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -72,6 +72,41 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool WebRequiresAdmin() { return true; }
|
||||
virtual CString GetWebMenuTitle() { return "List sockets"; }
|
||||
|
||||
virtual bool OnWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) {
|
||||
if (sPageName.empty() || sPageName == "index") {
|
||||
CSockManager& m = CZNC::Get().GetManager();
|
||||
if (!m.size()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::priority_queue<CSocketSorter> socks;
|
||||
|
||||
for (unsigned int a = 0; a < m.size(); a++) {
|
||||
socks.push(m[a]);
|
||||
}
|
||||
|
||||
while (!socks.empty()) {
|
||||
Csock* pSocket = socks.top().GetSock();
|
||||
socks.pop();
|
||||
|
||||
CTemplate& Row = Tmpl.AddRow("SocketsLoop");
|
||||
Row["Name"] = pSocket->GetSockName();
|
||||
Row["Created"] = GetCreatedTime(pSocket);
|
||||
Row["State"] = GetSocketState(pSocket);
|
||||
Row["SSL"] = pSocket->GetSSL() ? "Yes" : "No";
|
||||
Row["Local"] = GetLocalHost(pSocket, true);
|
||||
Row["Remote"] = GetRemoteHost(pSocket, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual void OnModCommand(const CString& sLine) {
|
||||
CString sCommand = sLine.Token(0);
|
||||
CString sArg = sLine.Token(1, true);
|
||||
|
||||
Reference in New Issue
Block a user