diff options
| author | MatthewM <mcm@they-got.us> | 2012-12-14 16:44:14 -0500 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2012-12-14 16:44:14 -0500 |
| commit | 1075f3b457d9e144b883166b202cba919069f82b (patch) | |
| tree | b3dd6c9ff7b721953349172fe15850fb2e33e22e /modules/extra/webcpanel/pages | |
| parent | c1077faa281c5635f85b892e605e23bd6c8fcc3b (diff) | |
Allow opers to drop channels
Added chanserv drop to web panel
Allow long lists of akills to scroll
Diffstat (limited to 'modules/extra/webcpanel/pages')
| -rw-r--r-- | modules/extra/webcpanel/pages/chanserv/drop.cpp | 45 | ||||
| -rw-r--r-- | modules/extra/webcpanel/pages/chanserv/drop.h | 25 |
2 files changed, 70 insertions, 0 deletions
diff --git a/modules/extra/webcpanel/pages/chanserv/drop.cpp b/modules/extra/webcpanel/pages/chanserv/drop.cpp new file mode 100644 index 000000000..f0fc0d5c2 --- /dev/null +++ b/modules/extra/webcpanel/pages/chanserv/drop.cpp @@ -0,0 +1,45 @@ +/* + * (C) 2003-2012 Anope Team + * Contact us at team@anope.org + * + * Please read COPYING and README for further details. + */ + +#include "../../webcpanel.h" + +WebCPanel::ChanServ::Drop::Drop(const Anope::string &cat, const Anope::string &u) : WebPanelProtectedPage (cat, u) +{ +} + + +bool WebCPanel::ChanServ::Drop::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements) +{ + + if (message.post_data.count("channel") > 0 && message.post_data.count("confChan") > 0) + { + if (message.post_data["channel"] == message.post_data["confChan"]) { + std::vector<Anope::string> params; + params.push_back(HTTPUtils::URLDecode(message.post_data["channel"])); + + WebPanel::RunCommand(na->nc->display, na->nc, Config->ChanServ, "chanserv/drop", params, replacements); + } + else replacements["MESSAGES"] = "Invalid Confirmation"; + } + // XXX this is slightly inefficient + for (registered_channel_map::const_iterator it = RegisteredChannelList->begin(), it_end = RegisteredChannelList->end(); it != it_end; ++it) + { + ChannelInfo *ci = it->second; + if ((ci->HasFlag(CI_SECUREFOUNDER) ? ci->AccessFor(na->nc).founder : ci->AccessFor(na->nc).HasPriv("FOUNDER")) || (na->nc->IsServicesOper() && na->nc->o->ot->HasCommand("chanserv/drop"))) + { + replacements["CHANNEL_NAMES"] = ci->name; + replacements["ESCAPED_CHANNEL_NAMES"] = HTTPUtils::URLEncode(ci->name); + } + } + + if (message.get_data.count("channel") > 0) { + replacements["CHANNEL_DROP"] = message.get_data["channel"]; + } + TemplateFileServer page("chanserv/drop.html"); + page.Serve(server, page_name, client, message, reply, replacements); + return true; +} diff --git a/modules/extra/webcpanel/pages/chanserv/drop.h b/modules/extra/webcpanel/pages/chanserv/drop.h new file mode 100644 index 000000000..9fd4be720 --- /dev/null +++ b/modules/extra/webcpanel/pages/chanserv/drop.h @@ -0,0 +1,25 @@ +/* + * (C) 2003-2012 Anope Team + * Contact us at team@anope.org + * + * Please read COPYING and README for further details. + */ + +namespace WebCPanel +{ + + namespace ChanServ + { + + class Drop : public WebPanelProtectedPage + { + public: + Drop(const Anope::string &cat, const Anope::string &u); + + bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override; + + }; + + } + +} |
