Anope IRC Services  Version 2.0
drop.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 "utils.h"
10 
12 {
13 }
14 
15 
17 {
18 
19  if (message.post_data.count("channel") > 0 && message.post_data.count("confChan") > 0)
20  {
21  if (message.post_data["channel"] == message.post_data["confChan"])
22  {
23  std::vector<Anope::string> params;
24  const Anope::string &channel = HTTPUtils::URLDecode(message.post_data["channel"]);
25  params.push_back(channel);
26  params.push_back(channel);
27 
28  WebPanel::RunCommand(na->nc->display, na->nc, "ChanServ", "chanserv/drop", params, replacements);
29  }
30  else
31  replacements["MESSAGES"] = "Invalid Confirmation";
32  }
33 
34  std::deque<ChannelInfo *> queue;
35  na->nc->GetChannelReferences(queue);
36  for (unsigned i = 0; i < queue.size(); ++i)
37  {
38  ChannelInfo *ci = queue[i];
39  if ((ci->HasExt("SECUREFOUNDER") ? ci->AccessFor(na->nc).founder : ci->AccessFor(na->nc).HasPriv("FOUNDER")) || (na->nc->IsServicesOper() && na->nc->o->ot->HasCommand("chanserv/drop")))
40  {
41  replacements["CHANNEL_NAMES"] = ci->name;
42  replacements["ESCAPED_CHANNEL_NAMES"] = HTTPUtils::URLEncode(ci->name);
43  }
44  }
45 
46  if (message.get_data.count("channel") > 0)
47  {
48  const Anope::string &chname = message.get_data["channel"];
49 
50  replacements["CHANNEL_DROP"] = chname;
51  replacements["ESCAPED_CHANNEL"] = HTTPUtils::URLEncode(chname);
52  }
53 
54  TemplateFileServer page("chanserv/drop.html");
55  page.Serve(server, page_name, client, message, reply, replacements);
56  return true;
57 
58 }
Serialize::Reference< NickCore > nc
Definition: account.h:47
void Serve(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, Replacements &)
Definition: hashcomp.h:84
Anope::string name
Definition: regchannel.h:63
Anope::string URLEncode(const Anope::string &url)
Definition: httpd.h:187
bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override
Definition: drop.cpp:16
bool founder
Definition: access.h:150
bool HasPriv(const Anope::string &priv) const
Definition: access.cpp:384
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
Drop(const Anope::string &cat, const Anope::string &u)
Definition: drop.cpp:11
AccessGroup AccessFor(const User *u)
Definition: regchannel.cpp:413
std::map< Anope::string, Anope::string > post_data
Definition: httpd.h:81
Anope::string URLDecode(const Anope::string &url)
Definition: httpd.h:163
std::map< Anope::string, Anope::string > get_data
Definition: httpd.h:80
bool HasExt(const Anope::string &name) const
Definition: extensible.cpp:31