summaryrefslogtreecommitdiff
path: root/modules/extra
diff options
context:
space:
mode:
Diffstat (limited to 'modules/extra')
-rw-r--r--modules/extra/httpd.h21
-rw-r--r--modules/extra/m_httpd.cpp7
-rw-r--r--modules/extra/m_ldap_authentication.cpp123
-rw-r--r--modules/extra/m_sql_authentication.cpp111
-rw-r--r--modules/extra/m_xmlrpc_main.cpp50
-rw-r--r--modules/extra/webcpanel/pages/chanserv/access.cpp9
-rw-r--r--modules/extra/webcpanel/pages/chanserv/access.h2
-rw-r--r--modules/extra/webcpanel/pages/chanserv/akick.cpp9
-rw-r--r--modules/extra/webcpanel/pages/chanserv/akick.h2
-rw-r--r--modules/extra/webcpanel/pages/chanserv/info.cpp4
-rw-r--r--modules/extra/webcpanel/pages/chanserv/info.h2
-rw-r--r--modules/extra/webcpanel/pages/chanserv/set.cpp7
-rw-r--r--modules/extra/webcpanel/pages/chanserv/set.h2
-rw-r--r--modules/extra/webcpanel/pages/confirm.cpp3
-rw-r--r--modules/extra/webcpanel/pages/confirm.h2
-rw-r--r--modules/extra/webcpanel/pages/index.cpp118
-rw-r--r--modules/extra/webcpanel/pages/index.h2
-rw-r--r--modules/extra/webcpanel/pages/logout.cpp3
-rw-r--r--modules/extra/webcpanel/pages/logout.h2
-rw-r--r--modules/extra/webcpanel/pages/memoserv/memos.cpp3
-rw-r--r--modules/extra/webcpanel/pages/memoserv/memos.h2
-rw-r--r--modules/extra/webcpanel/pages/nickserv/access.cpp3
-rw-r--r--modules/extra/webcpanel/pages/nickserv/access.h2
-rw-r--r--modules/extra/webcpanel/pages/nickserv/alist.cpp3
-rw-r--r--modules/extra/webcpanel/pages/nickserv/alist.h2
-rw-r--r--modules/extra/webcpanel/pages/nickserv/cert.cpp3
-rw-r--r--modules/extra/webcpanel/pages/nickserv/cert.h2
-rw-r--r--modules/extra/webcpanel/pages/nickserv/info.cpp3
-rw-r--r--modules/extra/webcpanel/pages/nickserv/info.h2
-rw-r--r--modules/extra/webcpanel/pages/operserv/akill.cpp3
-rw-r--r--modules/extra/webcpanel/pages/operserv/akill.h2
-rw-r--r--modules/extra/webcpanel/pages/register.cpp3
-rw-r--r--modules/extra/webcpanel/pages/register.h2
-rw-r--r--modules/extra/webcpanel/static_fileserver.cpp5
-rw-r--r--modules/extra/webcpanel/static_fileserver.h2
-rw-r--r--modules/extra/webcpanel/template_fileserver.cpp1
-rw-r--r--modules/extra/webcpanel/webcpanel.h10
-rw-r--r--modules/extra/xmlrpc.h2
38 files changed, 283 insertions, 251 deletions
diff --git a/modules/extra/httpd.h b/modules/extra/httpd.h
index 684c11512..d9e800d13 100644
--- a/modules/extra/httpd.h
+++ b/modules/extra/httpd.h
@@ -21,6 +21,23 @@ struct HTTPReply
HTTPReply() : error(HTTP_ERROR_OK), length(0) { }
+ HTTPReply(const HTTPReply& other) : error(other.error), length(other.length)
+ {
+ content_type = other.content_type;
+ headers = other.headers;
+ cookies = other.cookies;
+
+ for (unsigned i = 0; i < other.out.size(); ++i)
+ out.push_back(new Data(other.out[i]->buf, other.out[i]->len));
+ }
+
+ ~HTTPReply()
+ {
+ for (unsigned i = 0; i < out.size(); ++i)
+ delete out[i];
+ out.clear();
+ }
+
struct Data
{
char *buf;
@@ -87,10 +104,10 @@ class HTTPPage : public Base
* @param The HTTP header sent from the client to request the page
* @param The HTTP header that will be sent back to the client
*/
- virtual void OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &) = 0;
+ virtual bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &) = 0;
};
-class HTTPClient : public ClientSocket, public BufferedSocket, public BinarySocket
+class HTTPClient : public ClientSocket, public BufferedSocket, public BinarySocket, public Base
{
protected:
void WriteClient(const Anope::string &message)
diff --git a/modules/extra/m_httpd.cpp b/modules/extra/m_httpd.cpp
index 626a62e8c..e802ed055 100644
--- a/modules/extra/m_httpd.cpp
+++ b/modules/extra/m_httpd.cpp
@@ -35,7 +35,7 @@ static Anope::string GetStatusFromCode(HTTPError err)
return "501 Not Implemented";
}
-class MyHTTPClient : public HTTPClient, public Base
+class MyHTTPClient : public HTTPClient
{
HTTPProvider *provider;
HTTPMessage header;
@@ -78,9 +78,8 @@ class MyHTTPClient : public HTTPClient, public Base
HTTPReply reply;
- this->page->OnRequest(this->provider, this->page_name, this, this->header, reply);
-
- this->SendReply(&reply);
+ if (this->page->OnRequest(this->provider, this->page_name, this, this->header, reply))
+ this->SendReply(&reply);
}
public:
diff --git a/modules/extra/m_ldap_authentication.cpp b/modules/extra/m_ldap_authentication.cpp
index 7fcd67e5d..2ca08f975 100644
--- a/modules/extra/m_ldap_authentication.cpp
+++ b/modules/extra/m_ldap_authentication.cpp
@@ -2,6 +2,8 @@
#include "nickserv.h"
#include "ldap.h"
+static Module *me;
+
static Anope::string basedn;
static Anope::string search_filter;
static Anope::string object_class;
@@ -10,17 +12,21 @@ static Anope::string username_attribute;
struct IdentifyInfo
{
- dynamic_reference<Command> command;
- CommandSource source;
- std::vector<Anope::string> params;
- Anope::string account;
- Anope::string pass;
- Anope::string dn;
+ dynamic_reference<User> user;
+ IdentifyRequest *req;
service_reference<LDAPProvider> lprov;
bool admin_bind;
+ Anope::string dn;
- IdentifyInfo(Command *c, CommandSource &s, const std::vector<Anope::string> &pa, const Anope::string &a, const Anope::string &p, service_reference<LDAPProvider> &lp) :
- command(c), source(s), params(pa), account(a), pass(p), lprov(lp), admin_bind(true) { }
+ IdentifyInfo(User *u, IdentifyRequest *r, service_reference<LDAPProvider> &lp) : user(u), req(r), lprov(lp), admin_bind(true)
+ {
+ req->Hold(me);
+ }
+
+ ~IdentifyInfo()
+ {
+ req->Release(me);
+ }
};
class IdentifyInterface : public LDAPInterface
@@ -46,9 +52,9 @@ class IdentifyInterface : public LDAPInterface
IdentifyInfo *ii = it->second;
this->requests.erase(it);
- if (!ii->source.GetUser() || !ii->command || !ii->lprov)
+ if (!ii->lprov)
{
- delete this;
+ delete ii;
return;
}
@@ -63,69 +69,55 @@ class IdentifyInterface : public LDAPInterface
const LDAPAttributes &attr = r.get(0);
ii->dn = attr.get("dn");
Log(LOG_DEBUG) << "m_ldap_authenticationn: binding as " << ii->dn;
- LDAPQuery id = ii->lprov->Bind(this, ii->dn, ii->pass);
+ LDAPQuery id = ii->lprov->Bind(this, ii->dn, ii->req->GetPassword());
this->Add(id, ii);
+ return;
}
catch (const LDAPException &ex)
{
Log() << "m_ldap_authentication: Error binding after search: " << ex.GetReason();
- delete ii;
}
}
- else
- {
- User *u = ii->source.GetUser();
- Command *c = ii->command;
-
- u->Extend("m_ldap_authentication_error", NULL);
-
- c->Execute(ii->source, ii->params);
-
- delete ii;
- }
break;
}
case LDAPResult::QUERY_BIND:
{
if (ii->admin_bind)
{
- Anope::string sf = search_filter.replace_all_cs("%account", ii->account).replace_all_cs("%object_class", object_class);
+ Anope::string sf = search_filter.replace_all_cs("%account", ii->req->GetAccount()).replace_all_cs("%object_class", object_class);
Log(LOG_DEBUG) << "m_ldap_authentication: searching for " << sf;
LDAPQuery id = ii->lprov->Search(this, basedn, sf);
this->Add(id, ii);
ii->admin_bind = false;
+ return;
}
else
{
- User *u = ii->source.GetUser();
- Command *c = ii->command;
-
- u->Extend("m_ldap_authentication_authenticated", NULL);
-
- NickAlias *na = findnick(ii->account);
+ NickAlias *na = findnick(ii->req->GetAccount());
if (na == NULL)
{
- na = new NickAlias(ii->account, new NickCore(ii->account));
- if (Config->NSAddAccessOnReg)
- na->nc->AddAccess(create_mask(u));
-
- BotInfo *bi = findbot(Config->NickServ);
- if (bi)
- u->SendMessage(bi, _("Your account \002%s\002 has been successfully created."), na->nick.c_str());
+ na = new NickAlias(ii->req->GetAccount(), new NickCore(ii->req->GetAccount()));
+ if (ii->user)
+ {
+ if (Config->NSAddAccessOnReg)
+ na->nc->AddAccess(create_mask(ii->user));
+
+ const BotInfo *bi = findbot(Config->NickServ);
+ if (bi)
+ ii->user->SendMessage(bi, _("Your account \002%s\002 has been successfully created."), na->nick.c_str());
+ }
}
-
na->nc->Extend("m_ldap_authentication_dn", new ExtensibleItemClass<Anope::string>(ii->dn));
-
- enc_encrypt(ii->pass, na->nc->pass);
-
- c->Execute(ii->source, ii->params);
- delete ii;
+
+ ii->req->Success(me);
}
break;
}
default:
- delete ii;
+ break;
}
+
+ delete ii;
}
void OnError(const LDAPResult &r) anope_override
@@ -135,20 +127,6 @@ class IdentifyInterface : public LDAPInterface
return;
IdentifyInfo *ii = it->second;
this->requests.erase(it);
-
- if (!ii->source.GetUser() || !ii->command)
- {
- delete ii;
- return;
- }
-
- User *u = ii->source.GetUser();
- Command *c = ii->command;
-
- u->Extend("m_ldap_authentication_error", NULL);
-
- c->Execute(ii->source, ii->params);
-
delete ii;
}
};
@@ -235,6 +213,8 @@ class NSIdentifyLDAP : public Module
{
this->SetAuthor("Anope");
+ me = this;
+
Implementation i[] = { I_OnReload, I_OnPreCommand, I_OnCheckAuthentication, I_OnNickIdentify, I_OnNickRegister };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
ModuleManager::SetPriority(this, PRIORITY_FIRST);
@@ -267,28 +247,12 @@ class NSIdentifyLDAP : public Module
return EVENT_CONTINUE;
}
- EventReturn OnCheckAuthentication(Command *c, CommandSource *source, const std::vector<Anope::string> &params, const Anope::string &account, const Anope::string &password) anope_override
+ void OnCheckAuthentication(User *u, IdentifyRequest *req) anope_override
{
+ if (!this->ldap)
+ return;
- if (c == NULL || source == NULL || !this->ldap)
- return EVENT_CONTINUE;
-
- User *u = source->GetUser();
- if (!u)
- return EVENT_CONTINUE;
-
- if (u->HasExt("m_ldap_authentication_authenticated"))
- {
- u->Shrink("m_ldap_authentication_authenticated");
- return EVENT_ALLOW;
- }
- else if (u->HasExt("m_ldap_authentication_error"))
- {
- u->Shrink("m_ldap_authentication_error");
- return EVENT_CONTINUE;
- }
-
- IdentifyInfo *ii = new IdentifyInfo(c, *source, params, account, password, this->ldap);
+ IdentifyInfo *ii = new IdentifyInfo(u, req, this->ldap);
try
{
LDAPQuery id = this->ldap->BindAsAdmin(&this->iinterface);
@@ -298,10 +262,7 @@ class NSIdentifyLDAP : public Module
{
delete ii;
Log() << "ns_identify_ldap: " << ex.GetReason();
- return EVENT_CONTINUE;
}
-
- return EVENT_STOP;
}
void OnNickIdentify(User *u) anope_override
diff --git a/modules/extra/m_sql_authentication.cpp b/modules/extra/m_sql_authentication.cpp
index 957258fcb..9375615ee 100644
--- a/modules/extra/m_sql_authentication.cpp
+++ b/modules/extra/m_sql_authentication.cpp
@@ -1,71 +1,71 @@
#include "module.h"
#include "sql.h"
+static Module *me;
+
class SQLAuthenticationResult : public SQLInterface
{
- dynamic_reference<Command> cmd;
- CommandSource source;
- std::vector<Anope::string> params;
dynamic_reference<User> user;
- Anope::string account;
+ IdentifyRequest *req;
public:
- SQLAuthenticationResult(Module *m, Command *c, CommandSource &s, const std::vector<Anope::string> &p, User *u, const Anope::string &a) : SQLInterface(m), cmd(c), source(s), params(p), user(u), account(a) { }
+ SQLAuthenticationResult(User *u, IdentifyRequest *r) : SQLInterface(me), user(u), req(r)
+ {
+ req->Hold(me);
+ }
+
+ ~SQLAuthenticationResult()
+ {
+ req->Release(me);
+ }
void OnResult(const SQLResult &r) anope_override
{
- if (user && cmd)
+ if (r.Rows() == 0)
{
- Anope::string email;
+ Log(LOG_DEBUG) << "m_sql_authentication: Unsuccessful authentication for " << req->GetAccount();
+ delete this;
+ return;
+ }
- if (r.Rows() > 0)
- {
- user->Extend("m_sql_authentication_success", NULL);
+ Log(LOG_DEBUG) << "m_sql_authentication: Successful authentication for " << req->GetAccount();
- try
- {
- email = r.Get(0, "email");
- }
- catch (const SQLException &) { }
- }
- else
- user->Extend("m_sql_authentication_failed", NULL);
+ Anope::string email;
+ try
+ {
+ email = r.Get(0, "email");
+ }
+ catch (const SQLException &) { }
- BotInfo *bi = findbot(Config->NickServ);
- NickAlias *na = findnick(account);
- if (na == NULL)
+ const BotInfo *bi = findbot(Config->NickServ);
+ NickAlias *na = findnick(req->GetAccount());
+ if (na == NULL)
+ {
+ na = new NickAlias(req->GetAccount(), new NickCore(req->GetAccount()));
+ if (user)
{
- na = new NickAlias(account, new NickCore(account));
if (Config->NSAddAccessOnReg)
na->nc->AddAccess(create_mask(user));
if (bi)
user->SendMessage(bi, _("Your account \002%s\002 has been successfully created."), na->nick.c_str());
}
+ }
- if (!email.empty() && email != na->nc->email)
- {
- na->nc->email = email;
- if (bi)
- user->SendMessage(bi, _("Your email has been updated to \002%s\002."), email.c_str());
- }
-
- cmd->Execute(source, params);
+ if (!email.empty() && email != na->nc->email)
+ {
+ na->nc->email = email;
+ if (user && bi)
+ user->SendMessage(bi, _("Your email has been updated to \002%s\002."), email.c_str());
}
+ req->Success(me);
delete this;
}
void OnError(const SQLResult &r) anope_override
{
Log() << "m_sql_authentication: Error executing query " << r.GetQuery().query << ": " << r.GetError();
-
- if (user && cmd)
- {
- user->Extend("m_sql_authentication_failed", NULL);
- cmd->Execute(source, params);
- }
-
delete this;
}
};
@@ -84,6 +84,8 @@ class ModuleSQLAuthentication : public Module
{
this->SetAuthor("Anope");
+ me = this;
+
Implementation i[] = { I_OnReload, I_OnPreCommand, I_OnCheckAuthentication };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
@@ -113,37 +115,32 @@ class ModuleSQLAuthentication : public Module
return EVENT_CONTINUE;
}
- EventReturn OnCheckAuthentication(Command *c, CommandSource *source, const std::vector<Anope::string> &params, const Anope::string &account, const Anope::string &password) anope_override
+ void OnCheckAuthentication(User *u, IdentifyRequest *req) anope_override
{
- if (!source || !source->GetUser())
- return EVENT_CONTINUE;
- else if (!this->SQL)
+ if (!this->SQL)
{
Log() << "m_sql_authentication: Unable to find SQL engine";
- return EVENT_CONTINUE;
+ return;
}
- else if (source->GetUser()->HasExt("m_sql_authentication_success"))
+
+ SQLQuery q(this->query);
+ q.setValue("a", req->GetAccount());
+ q.setValue("p", req->GetPassword());
+ if (u)
{
- source->GetUser()->Shrink("m_sql_authentication_success");
- return EVENT_ALLOW;
+ q.setValue("n", u->nick);
+ q.setValue("i", u->ip);
}
- else if (source->GetUser()->HasExt("m_sql_authentication_failed"))
+ else
{
- source->GetUser()->Shrink("m_sql_authentication_failed");
- return EVENT_CONTINUE;
+ q.setValue("n", "");
+ q.setValue("i", "");
}
- SQLQuery q(this->query);
- q.setValue("a", account);
- q.setValue("p", password);
- q.setValue("n", source->GetNick());
- q.setValue("i", source->GetUser()->ip);
-
- this->SQL->Run(new SQLAuthenticationResult(this, c, *source, params, source->GetUser(), account), q);
- Log(LOG_DEBUG) << "m_sql_authentication: Checking authentication for " << account;
+ this->SQL->Run(new SQLAuthenticationResult(u, req), q);
- return EVENT_STOP;
+ Log(LOG_DEBUG) << "m_sql_authentication: Checking authentication for " << req->GetAccount();
}
};
diff --git a/modules/extra/m_xmlrpc_main.cpp b/modules/extra/m_xmlrpc_main.cpp
index dc12d565e..cd7b68967 100644
--- a/modules/extra/m_xmlrpc_main.cpp
+++ b/modules/extra/m_xmlrpc_main.cpp
@@ -1,6 +1,37 @@
#include "module.h"
#include "xmlrpc.h"
+class XMLRPCIdentifyRequest : public IdentifyRequest
+{
+ XMLRPCRequest request;
+ dynamic_reference<XMLRPCServiceInterface> xinterface;
+ dynamic_reference<XMLRPCClientSocket> source;
+
+ public:
+ XMLRPCIdentifyRequest(XMLRPCRequest& req, XMLRPCServiceInterface* iface, XMLRPCClientSocket* s, const Anope::string &acc, const Anope::string &pass) : IdentifyRequest(acc, pass), request(req), xinterface(iface), source(s) { }
+
+ void OnSuccess() anope_override
+ {
+ if (!xinterface || !source)
+ return;
+
+ request.reply("result", "Success");
+ request.reply("account", GetAccount());
+
+ xinterface->Reply(source, &request);
+ }
+
+ void OnFail() anope_override
+ {
+ if (!xinterface || !source)
+ return;
+
+ request.reply("error", "Invalid password");
+
+ xinterface->Reply(source, &request);
+ }
+};
+
class MyXMLRPCEvent : public XMLRPCEvent
{
public:
@@ -77,22 +108,9 @@ class MyXMLRPCEvent : public XMLRPCEvent
request->reply("error", "Invalid parameters");
else
{
- const NickAlias *na = findnick(username);
-
- if (!na)
- request->reply("error", "Invalid account");
- else
- {
- EventReturn MOD_RESULT;
- FOREACH_RESULT(I_OnCheckAuthentication, OnCheckAuthentication(NULL, NULL, std::vector<Anope::string>(), na->nc->display, password));
- if (MOD_RESULT == EVENT_ALLOW)
- {
- request->reply("result", "Success");
- request->reply("account", na->nc->display);
- }
- else
- request->reply("error", "Invalid password");
- }
+ XMLRPCIdentifyRequest *req = new XMLRPCIdentifyRequest(*request, iface, source, username, password);
+ FOREACH_MOD(I_OnCheckAuthentication, OnCheckAuthentication(NULL, req));
+ req->Dispatch();
}
}
diff --git a/modules/extra/webcpanel/pages/chanserv/access.cpp b/modules/extra/webcpanel/pages/chanserv/access.cpp
index d3ec2ad99..71fe1a7e9 100644
--- a/modules/extra/webcpanel/pages/chanserv/access.cpp
+++ b/modules/extra/webcpanel/pages/chanserv/access.cpp
@@ -11,7 +11,7 @@ WebCPanel::ChanServ::Access::Access(const Anope::string &cat, const Anope::strin
{
}
-void WebCPanel::ChanServ::Access::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
+bool WebCPanel::ChanServ::Access::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
{
const Anope::string &chname = message.get_data["channel"];
@@ -19,19 +19,19 @@ void WebCPanel::ChanServ::Access::OnRequest(HTTPProvider *server, const Anope::s
{
reply.error = HTTP_FOUND;
reply.headers["Location"] = "http://" + message.headers["Host"] + "/chanserv/info";
- return;
+ return true;
}
ChannelInfo *ci = cs_findchan(chname);
if (!ci)
- return;
+ return true;
AccessGroup u_access = ci->AccessFor(na->nc);
bool has_priv = na->nc->IsServicesOper() && na->nc->o->ot->HasPriv("chanserv/access/modify");
if (!u_access.HasPriv("ACCESS_LIST") && !has_priv)
- return;
+ return true;
const ChanAccess *highest = u_access.Highest();
@@ -136,6 +136,7 @@ void WebCPanel::ChanServ::Access::OnRequest(HTTPProvider *server, const Anope::s
TemplateFileServer page("chanserv/access.html");
page.Serve(server, page_name, client, message, reply, replacements);
+ return true;
}
std::set<Anope::string> WebCPanel::ChanServ::Access::GetData() anope_override
diff --git a/modules/extra/webcpanel/pages/chanserv/access.h b/modules/extra/webcpanel/pages/chanserv/access.h
index 50425aa40..d5fbbf68c 100644
--- a/modules/extra/webcpanel/pages/chanserv/access.h
+++ b/modules/extra/webcpanel/pages/chanserv/access.h
@@ -16,7 +16,7 @@ class Access : public WebPanelProtectedPage
public:
Access(const Anope::string &cat, const Anope::string &u);
- void OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override;
+ bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override;
std::set<Anope::string> GetData() anope_override;
};
diff --git a/modules/extra/webcpanel/pages/chanserv/akick.cpp b/modules/extra/webcpanel/pages/chanserv/akick.cpp
index bc80437cc..bb38c5e06 100644
--- a/modules/extra/webcpanel/pages/chanserv/akick.cpp
+++ b/modules/extra/webcpanel/pages/chanserv/akick.cpp
@@ -11,7 +11,7 @@ WebCPanel::ChanServ::Akick::Akick(const Anope::string &cat, const Anope::string
{
}
-void WebCPanel::ChanServ::Akick::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
+bool WebCPanel::ChanServ::Akick::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
{
const Anope::string &chname = message.get_data["channel"];
@@ -19,19 +19,19 @@ void WebCPanel::ChanServ::Akick::OnRequest(HTTPProvider *server, const Anope::st
{
reply.error = HTTP_FOUND;
reply.headers["Location"] = "http://" + message.headers["Host"] + "/chanserv/info";
- return;
+ return true;
}
ChannelInfo *ci = cs_findchan(chname);
if (!ci)
- return;
+ return true;
AccessGroup u_access = ci->AccessFor(na->nc);
bool has_priv = na->nc->IsServicesOper() && na->nc->o->ot->HasPriv("chanserv/access/modify");
if (!u_access.HasPriv("akick") && !has_priv)
- return;
+ return true;
if (message.get_data["del"].empty() == false && message.get_data["mask"].empty() == false)
{
@@ -70,6 +70,7 @@ void WebCPanel::ChanServ::Akick::OnRequest(HTTPProvider *server, const Anope::st
TemplateFileServer page("chanserv/akick.html");
page.Serve(server, page_name, client, message, reply, replacements);
+ return true;
}
std::set<Anope::string> WebCPanel::ChanServ::Akick::GetData() anope_override
diff --git a/modules/extra/webcpanel/pages/chanserv/akick.h b/modules/extra/webcpanel/pages/chanserv/akick.h
index ff4a4653e..cd8408934 100644
--- a/modules/extra/webcpanel/pages/chanserv/akick.h
+++ b/modules/extra/webcpanel/pages/chanserv/akick.h
@@ -16,7 +16,7 @@ class Akick : public WebPanelProtectedPage
public:
Akick(const Anope::string &cat, const Anope::string &u);
- void OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override;
+ bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override;
std::set<Anope::string> GetData() anope_override;
};
diff --git a/modules/extra/webcpanel/pages/chanserv/info.cpp b/modules/extra/webcpanel/pages/chanserv/info.cpp
index 8db88f496..44ae98537 100644
--- a/modules/extra/webcpanel/pages/chanserv/info.cpp
+++ b/modules/extra/webcpanel/pages/chanserv/info.cpp
@@ -11,7 +11,7 @@ WebCPanel::ChanServ::Info::Info(const Anope::string &cat, const Anope::string &u
{
}
-void WebCPanel::ChanServ::Info::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
+bool WebCPanel::ChanServ::Info::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
{
// XXX this is slightly inefficient
for (registered_channel_map::const_iterator it = RegisteredChannelList->begin(), it_end = RegisteredChannelList->end(); it != it_end; ++it)
@@ -25,8 +25,8 @@ void WebCPanel::ChanServ::Info::OnRequest(HTTPProvider *server, const Anope::str
}
}
-
TemplateFileServer page("chanserv/main.html");
page.Serve(server, page_name, client, message, reply, replacements);
+ return true;
}
diff --git a/modules/extra/webcpanel/pages/chanserv/info.h b/modules/extra/webcpanel/pages/chanserv/info.h
index 87dc9836b..c55e1b1eb 100644
--- a/modules/extra/webcpanel/pages/chanserv/info.h
+++ b/modules/extra/webcpanel/pages/chanserv/info.h
@@ -16,7 +16,7 @@ class Info : public WebPanelProtectedPage
public:
Info(const Anope::string &cat, const Anope::string &u);
- void OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override;
+ bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override;
};
}
diff --git a/modules/extra/webcpanel/pages/chanserv/set.cpp b/modules/extra/webcpanel/pages/chanserv/set.cpp
index 764eb13ac..7d144c6de 100644
--- a/modules/extra/webcpanel/pages/chanserv/set.cpp
+++ b/modules/extra/webcpanel/pages/chanserv/set.cpp
@@ -11,7 +11,7 @@ WebCPanel::ChanServ::Set::Set(const Anope::string &cat, const Anope::string &u)
{
}
-void WebCPanel::ChanServ::Set::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
+bool WebCPanel::ChanServ::Set::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
{
const Anope::string &chname = message.get_data["channel"];
@@ -19,13 +19,13 @@ void WebCPanel::ChanServ::Set::OnRequest(HTTPProvider *server, const Anope::stri
{
reply.error = HTTP_FOUND;
reply.headers["Location"] = "http://" + message.headers["Host"] + "/chanserv/info";
- return;
+ return true;
}
ChannelInfo *ci = cs_findchan(chname);
if (!ci || !ci->AccessFor(na->nc).HasPriv("SET"))
- return;
+ return true;
if (message.post_data.empty() == false)
{
@@ -125,6 +125,7 @@ void WebCPanel::ChanServ::Set::OnRequest(HTTPProvider *server, const Anope::stri
TemplateFileServer page("chanserv/