From 1075f3b457d9e144b883166b202cba919069f82b Mon Sep 17 00:00:00 2001 From: MatthewM Date: Fri, 14 Dec 2012 16:44:14 -0500 Subject: Allow opers to drop channels Added chanserv drop to web panel Allow long lists of akills to scroll --- modules/extra/webcpanel/pages/chanserv/drop.cpp | 45 +++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 modules/extra/webcpanel/pages/chanserv/drop.cpp (limited to 'modules/extra/webcpanel/pages/chanserv/drop.cpp') 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 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; +} -- cgit