diff --git a/modules/lastseen.cpp b/modules/lastseen.cpp index 15182457..8efcf5eb 100644 --- a/modules/lastseen.cpp +++ b/modules/lastseen.cpp @@ -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") diff --git a/modules/lastseen/tmpl/WebadminUser.tmpl b/modules/lastseen/tmpl/WebadminUser.tmpl new file mode 100644 index 00000000..6efe21a6 --- /dev/null +++ b/modules/lastseen/tmpl/WebadminUser.tmpl @@ -0,0 +1,9 @@ +
+
+
+
Last login time:
+
" class="half" />
+
+
+
+