Anope IRC Services  Version 2.0
cert.cpp
Go to the documentation of this file.
1 /*
2  * (C) 2003-2014 Anope Team
3  * Contact us at team@anope.org
4  *
5  * Please read COPYING and README for further details.
6  */
7 
8 #include "../../webcpanel.h"
9 #include "modules/ns_cert.h"
10 
12 {
13 }
14 
16 {
17  if (message.post_data.count("certfp") > 0)
18  {
19  std::vector<Anope::string> params;
20  params.push_back("ADD");
21  params.push_back(message.post_data["certfp"]);
22 
23  WebPanel::RunCommand(na->nc->display, na->nc, "NickServ", "nickserv/cert", params, replacements);
24  }
25  else if (message.get_data.count("del") > 0 && message.get_data.count("mask") > 0)
26  {
27  std::vector<Anope::string> params;
28  params.push_back("DEL");
29  params.push_back(message.get_data["mask"]);
30 
31  WebPanel::RunCommand(na->nc->display, na->nc, "NickServ", "nickserv/cert", params, replacements);
32  }
33 
34  NSCertList *cl = na->nc->GetExt<NSCertList>("certificates");
35  if (cl)
36  for (unsigned i = 0; i < cl->GetCertCount(); ++i)
37  replacements["CERTS"] = cl->GetCert(i);
38 
39  TemplateFileServer page("nickserv/cert.html");
40  page.Serve(server, page_name, client, message, reply, replacements);
41  return true;
42 }
43 
Serialize::Reference< NickCore > nc
Definition: account.h:47
void Serve(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, Replacements &)
bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override
Definition: cert.cpp:15
void RunCommand(const Anope::string &user, NickCore *nc, const Anope::string &service, const Anope::string &c, const std::vector< Anope::string > &params, TemplateFileServer::Replacements &r, const Anope::string &key)
Definition: webcpanel.cpp:234
std::map< Anope::string, Anope::string > post_data
Definition: httpd.h:81
virtual Anope::string GetCert(unsigned entry) const =0
virtual unsigned GetCertCount() const =0
std::map< Anope::string, Anope::string > get_data
Definition: httpd.h:80
Cert(const Anope::string &cat, const Anope::string &u)
Definition: cert.cpp:11