diff options
author | Adam <Adam@anope.org> | 2014-05-28 12:07:29 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2014-05-28 12:07:54 -0400 |
commit | f29e1cf383529a1a29f02b0669d973f5ee0b7a66 (patch) | |
tree | 3c33db276dc9328235bbd572641521ed44458176 /modules/webcpanel/pages/index.cpp | |
parent | 1253c70e0682fa1490c99c3d2869049a0e3fa2e0 (diff) |
Move most of the core pseudoclient logic to modules
Diffstat (limited to 'modules/webcpanel/pages/index.cpp')
-rw-r--r-- | modules/webcpanel/pages/index.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/modules/webcpanel/pages/index.cpp b/modules/webcpanel/pages/index.cpp index 0b2ce3d9c..d2a99becd 100644 --- a/modules/webcpanel/pages/index.cpp +++ b/modules/webcpanel/pages/index.cpp @@ -6,8 +6,9 @@ */ #include "../webcpanel.h" +#include "modules/nickserv.h" -class WebpanelRequest : public IdentifyRequest +class WebpanelRequest : public NickServ::IdentifyRequestListener { HTTPReply reply; HTTPMessage message; @@ -17,16 +18,16 @@ class WebpanelRequest : public IdentifyRequest TemplateFileServer::Replacements replacements; public: - WebpanelRequest(Module *o, HTTPReply &r, HTTPMessage &m, HTTPProvider *s, const Anope::string &p_n, HTTPClient *c, TemplateFileServer::Replacements &re, const Anope::string &user, const Anope::string &pass) : IdentifyRequest(o, user, pass), reply(r), message(m), server(s), page_name(p_n), client(c), replacements(re) { } + WebpanelRequest(HTTPReply &r, HTTPMessage &m, HTTPProvider *s, const Anope::string &p_n, HTTPClient *c, TemplateFileServer::Replacements &re) : reply(r), message(m), server(s), page_name(p_n), client(c), replacements(re) { } - void OnSuccess() override + void OnSuccess(NickServ::IdentifyRequest *req) override { if (!client || !server) return; - NickAlias *na = NickAlias::Find(this->GetAccount()); + ::NickServ::Nick *na = ::NickServ::FindNick(req->GetAccount()); if (!na) { - this->OnFail(); + this->OnFail(req); return; } @@ -50,7 +51,7 @@ class WebpanelRequest : public IdentifyRequest reply.cookies.push_back(c); } - { + { HTTPReply::cookie c; c.push_back(std::make_pair("id", id)); c.push_back(std::make_pair("Path", "/")); @@ -63,7 +64,7 @@ class WebpanelRequest : public IdentifyRequest client->SendReply(&reply); } - void OnFail() override + void OnFail(NickServ::IdentifyRequest *req) override { if (!client || !server) return; @@ -82,11 +83,11 @@ bool WebCPanel::Index::OnRequest(HTTPProvider *server, const Anope::string &page replacements["TITLE"] = page_title; - if (!user.empty() && !pass.empty()) + if (!user.empty() && !pass.empty() && ::NickServ::service) { - // Rate limit check. + // XXX Rate limit check. - WebpanelRequest *req = new WebpanelRequest(me, reply, message, server, page_name, client, replacements, user, pass); + ::NickServ::IdentifyRequest *req = ::NickServ::service->CreateIdentifyRequest(new WebpanelRequest(reply, message, server, page_name, client, replacements), me, user, pass); Event::OnCheckAuthentication(&Event::CheckAuthentication::OnCheckAuthentication, nullptr, req); req->Dispatch(); return false; |