Lastseen module embeds info about last login time to webadmin user page.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2130 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
darthgandalf
2010-09-11 18:52:51 +00:00
parent 8d5921f966
commit 45c7561485
2 changed files with 27 additions and 0 deletions
+18
View File
@@ -150,6 +150,24 @@ public:
return false;
}
virtual bool OnEmbeddedWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) {
if (sPageName == "webadmin/user" && WebSock.GetSession()->IsAdmin()) {
CUser* pUser = CZNC::Get().FindUser(Tmpl["Username"]);
if (pUser) {
time_t last = GetTime(pUser);
if (last) {
char buf[1024] = {0};
strftime(buf, sizeof(buf), "%c", localtime(&last));
Tmpl["LastSeen"] = buf;
}
}
return true;
}
return false;
}
};
GLOBALMODULEDEFS(CLastSeenMod, "Collects data about when a user last logged in")