diff options
Diffstat (limited to 'modules/extra')
| -rw-r--r-- | modules/extra/cs_appendtopic.cpp | 14 | ||||
| -rw-r--r-- | modules/extra/cs_enforce.cpp | 10 | ||||
| -rw-r--r-- | modules/extra/cs_entrymsg.cpp | 12 | ||||
| -rw-r--r-- | modules/extra/cs_set_misc.cpp | 16 | ||||
| -rw-r--r-- | modules/extra/cs_tban.cpp | 12 | ||||
| -rw-r--r-- | modules/extra/db_mysql.cpp | 87 | ||||
| -rw-r--r-- | modules/extra/hs_request.cpp | 47 | ||||
| -rw-r--r-- | modules/extra/m_alias.cpp | 9 | ||||
| -rw-r--r-- | modules/extra/m_dnsbl.cpp | 44 | ||||
| -rw-r--r-- | modules/extra/m_helpchan.cpp | 9 | ||||
| -rw-r--r-- | modules/extra/m_ldap.cpp | 4 | ||||
| -rw-r--r-- | modules/extra/m_ldap_authentication.cpp | 19 | ||||
| -rw-r--r-- | modules/extra/m_ldap_oper.cpp | 4 | ||||
| -rw-r--r-- | modules/extra/m_mysql.cpp | 4 | ||||
| -rw-r--r-- | modules/extra/m_xmlrpc.cpp | 6 | ||||
| -rw-r--r-- | modules/extra/m_xmlrpc_main.cpp | 7 | ||||
| -rw-r--r-- | modules/extra/ns_maxemail.cpp | 10 | ||||
| -rw-r--r-- | modules/extra/ns_set_misc.cpp | 13 | ||||
| -rw-r--r-- | modules/extra/os_defcon.cpp | 693 |
19 files changed, 873 insertions, 147 deletions
diff --git a/modules/extra/cs_appendtopic.cpp b/modules/extra/cs_appendtopic.cpp index b02717d92..dc3b40288 100644 --- a/modules/extra/cs_appendtopic.cpp +++ b/modules/extra/cs_appendtopic.cpp @@ -17,8 +17,7 @@ /*************************************************************************/ #include "module.h" - -#define AUTHOR "SGR" +#include "chanserv.h" /* ------------------------------------------------------------ * Name: cs_appendtopic @@ -110,12 +109,15 @@ class CSAppendTopic : public Module public: CSAppendTopic(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { - me = this; - - this->SetAuthor(AUTHOR); + this->SetAuthor("SGR"); this->SetType(SUPPORTED); - this->AddCommand(ChanServ, &commandcsappendtopic); + if (!chanserv) + throw ModuleException("ChanServ is not loaded!"); + + me = this; + + this->AddCommand(chanserv->Bot(), &commandcsappendtopic); } }; diff --git a/modules/extra/cs_enforce.cpp b/modules/extra/cs_enforce.cpp index 3a8e11735..6e39f33f3 100644 --- a/modules/extra/cs_enforce.cpp +++ b/modules/extra/cs_enforce.cpp @@ -14,6 +14,7 @@ */ #include "module.h" +#include "chanserv.h" static Module *me; @@ -217,12 +218,15 @@ class CSEnforce : public Module public: CSEnforce(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { - me = this; - this->SetAuthor("Anope"); this->SetType(SUPPORTED); - this->AddCommand(ChanServ, &commandcsenforce); + if (!chanserv) + throw ModuleException("ChanServ is not loaded!"); + + me = this; + + this->AddCommand(chanserv->Bot(), &commandcsenforce); } }; diff --git a/modules/extra/cs_entrymsg.cpp b/modules/extra/cs_entrymsg.cpp index 649fd69f8..f424baede 100644 --- a/modules/extra/cs_entrymsg.cpp +++ b/modules/extra/cs_entrymsg.cpp @@ -12,6 +12,7 @@ /*************************************************************************/ #include "module.h" +#include "chanserv.h" struct EntryMsg { @@ -162,13 +163,16 @@ class CSEntryMessage : public Module { this->SetAuthor("Anope"); this->SetType(CORE); + + if (!chanserv) + throw ModuleException("ChanServ is not loaded!"); Implementation i[] = { I_OnJoinChannel, I_OnReload, I_OnDatabaseReadMetadata, I_OnDatabaseWriteMetadata }; ModuleManager::Attach(i, this, 4); - this->AddCommand(ChanServ, &commandentrymsg); + this->AddCommand(chanserv->Bot(), &commandentrymsg); - this->OnReload(false); + this->OnReload(); } void OnJoinChannel(User *u, Channel *c) @@ -179,11 +183,11 @@ class CSEntryMessage : public Module if (c->ci->GetExtRegular("cs_entrymsg", messages)) for (unsigned i = 0; i < messages.size(); ++i) - u->SendMessage(whosends(c->ci), "[%s] %s", c->ci->name.c_str(), messages[i].message.c_str()); + u->SendMessage(c->ci->WhoSends(), "[%s] %s", c->ci->name.c_str(), messages[i].message.c_str()); } } - void OnReload(bool) + void OnReload() { ConfigReader config; EntryMsg::MaxEntries = config.ReadInteger("cs_entrymsg", "maxentries", "5", 0, true); diff --git a/modules/extra/cs_set_misc.cpp b/modules/extra/cs_set_misc.cpp index cb654a9a1..4bd7a772a 100644 --- a/modules/extra/cs_set_misc.cpp +++ b/modules/extra/cs_set_misc.cpp @@ -11,6 +11,7 @@ /*************************************************************************/ #include "module.h" +#include "chanserv.h" class CommandCSSetMisc : public Command { @@ -77,8 +78,8 @@ class CSSetMisc : public Module if (Commands.empty()) return; - Command *set = FindCommand(ChanServ, "SET"); - Command *saset = FindCommand(ChanServ, "SASET"); + Command *set = FindCommand(chanserv->Bot(), "SET"); + Command *saset = FindCommand(chanserv->Bot(), "SASET"); if (!set && !saset) return; @@ -114,10 +115,13 @@ class CSSetMisc : public Module this->SetAuthor("Anope"); this->SetType(CORE); + if (!chanserv) + throw ModuleException("ChanServ is not loaded!"); + Implementation i[] = { I_OnReload, I_OnChanInfo, I_OnDatabaseWriteMetadata, I_OnDatabaseReadMetadata }; ModuleManager::Attach(i, this, 4); - OnReload(true); + OnReload(); } ~CSSetMisc() @@ -125,12 +129,12 @@ class CSSetMisc : public Module RemoveAll(); } - void OnReload(bool) + void OnReload() { RemoveAll(); - Command *set = FindCommand(ChanServ, "SET"); - Command *saset = FindCommand(ChanServ, "SASET"); + Command *set = FindCommand(chanserv->Bot(), "SET"); + Command *saset = FindCommand(chanserv->Bot(), "SASET"); if (!set && !saset) return; diff --git a/modules/extra/cs_tban.cpp b/modules/extra/cs_tban.cpp index e3470504d..04d608246 100644 --- a/modules/extra/cs_tban.cpp +++ b/modules/extra/cs_tban.cpp @@ -16,6 +16,7 @@ /*************************************************************************/ #include "module.h" +#include "chanserv.h" static Module *me; @@ -110,12 +111,15 @@ class CSTBan : public Module public: CSTBan(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { - me = this; - - this->AddCommand(ChanServ, &commandcstban); - this->SetAuthor("Anope"); this->SetType(SUPPORTED); + + if (!chanserv) + throw ModuleException("ChanServ is not loaded!"); + + me = this; + + this->AddCommand(chanserv->Bot(), &commandcstban); } }; diff --git a/modules/extra/db_mysql.cpp b/modules/extra/db_mysql.cpp index 9a2c44d47..30a71c809 100644 --- a/modules/extra/db_mysql.cpp +++ b/modules/extra/db_mysql.cpp @@ -1,5 +1,7 @@ #include "module.h" +#include "operserv.h" #include "sql.h" +#include "os_session.h" static Anope::string ToString(const std::vector<Anope::string> &strings) { @@ -89,6 +91,7 @@ class DBMySQL : public Module service_reference<SQLProvider> SQL; public: + service_reference<SessionService> SessionInterface; time_t lastwarn; bool ro; @@ -99,7 +102,8 @@ class DBMySQL : public Module if (readonly && this->ro) { readonly = this->ro = false; - ircdproto->SendGlobops(OperServ, "Found SQL again, going out of readonly mode..."); + if (operserv) + ircdproto->SendGlobops(operserv->Bot(), "Found SQL again, going out of readonly mode..."); } SQL->Run(&sqlinterface, query); @@ -108,7 +112,8 @@ class DBMySQL : public Module { if (Anope::CurTime - Config->UpdateTimeout > lastwarn) { - ircdproto->SendGlobops(OperServ, "Unable to locate SQL reference, is m_mysql loaded? Going to readonly..."); + if (operserv) + ircdproto->SendGlobops(operserv->Bot(), "Unable to locate SQL reference, is m_mysql loaded? Going to readonly..."); readonly = this->ro = true; this->lastwarn = Anope::CurTime; } @@ -120,7 +125,7 @@ class DBMySQL : public Module return SQL ? SQL->Escape(query) : query; } - DBMySQL(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator), sqlinterface(this), SQL("mysql/main") + DBMySQL(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator), sqlinterface(this), SQL("mysql/main"), SessionInterface("session") { me = this; @@ -134,7 +139,8 @@ class DBMySQL : public Module }; ModuleManager::Attach(i, this, 2); - this->AddCommand(OperServ, &commandsqlsync); + if (operserv) + this->AddCommand(operserv->Bot(), &commandsqlsync); if (uplink_server) OnServerConnect(); @@ -542,12 +548,9 @@ class DBMySQL : public Module time_t seton = r.Get(i, "seton").is_pos_number_only() ? convertTo<time_t>(r.Get(i, "seton")) : Anope::CurTime; time_t expires = r.Get(i, "expires").is_pos_number_only() ? convertTo<time_t>(r.Get(i, "expires")) : Anope::CurTime; - XLine *x = SGLine->Add(NULL, NULL, user + "@" + host, expires, reason); + XLine *x = SGLine->Add(user + "@" + host, by, expires, reason); if (x) - { - x->By = by; x->Created = seton; - } } } @@ -562,16 +565,13 @@ class DBMySQL : public Module XLine *x = NULL; if (SNLine && r.Get(i, "type").equals_cs("SNLINE")) - x = SNLine->Add(NULL, NULL, mask, expires, reason); + x = SNLine->Add(mask, by, expires, reason); else if (SQLine && r.Get(i, "type").equals_cs("SQLINE")) - x = SQLine->Add(NULL, NULL, mask, expires, reason); + x = SQLine->Add(mask, by, expires, reason); else if (SZLine && r.Get(i, "type").equals_cs("SZLINE")) - x = SZLine->Add(NULL, NULL, mask, expires, reason); + x = SZLine->Add(mask, by, expires, reason); if (x) - { - x->By = by; x->Created = seton; - } } r = SQL->RunQuery("SELECT * FROM `anope_os_exceptions`"); @@ -583,7 +583,16 @@ class DBMySQL : public Module Anope::string reason = r.Get(i, "reason"); time_t expires = convertTo<time_t>(r.Get(i, "expires")); - exception_add(NULL, mask, limit, reason, creator, expires); + if (SessionInterface) + { + Exception *e = new Exception(); + e->mask = mask; + e->limit = limit; + e->who = creator; + e->reason = reason; + e->time = expires; + SessionInterface->AddException(e); + } } r = SQL->RunQuery("SELECT * FROM `anope_extra`"); @@ -661,7 +670,7 @@ class DBMySQL : public Module BotInfo *service = command->service; ChannelInfo *ci = source.ci; - if (service == NickServ) + if (service->nick == Config->s_NickServ) { if (u->Account() && ((command->name.equals_ci("SET") && !params.empty()) || (command->name.equals_ci("SASET") && u->HasCommand("nickserv/saset") && params.size() > 1))) { @@ -691,7 +700,7 @@ class DBMySQL : public Module } } } - else if (service == ChanServ) + else if (service->nick == Config->s_ChanServ) { if (command->name.equals_ci("SET") && u->Account() && params.size() > 1) { @@ -721,7 +730,7 @@ class DBMySQL : public Module } } } - else if (service == BotServ) + else if (service->nick == Config->s_BotServ) { if (command->name.equals_ci("KICK") && params.size() > 2) { @@ -773,7 +782,7 @@ class DBMySQL : public Module } } } - else if (service == MemoServ) + else if (service->nick == Config->s_MemoServ) { if (command->name.equals_ci("IGNORE") && params.size() > 0) { @@ -1049,18 +1058,12 @@ class DBMySQL : public Module this->RunQuery(query); } - void OnMemoSend(User *, NickCore *nc, Memo *m) - { - this->RunQuery("INSERT INTO `anope_ms_info` (receiver, flags, time, sender, text, serv) VALUES('" + - this->Escape(nc->display) + "', '" + ToString(m->ToString()) + "', " + stringify(m->time) + ", '" + - this->Escape(m->sender) + "', '" + this->Escape(m->text) + "', 'NICK')"); - } - - void OnMemoSend(User *, ChannelInfo *ci, Memo *m) + void OnMemoSend(const Anope::string &source, const Anope::string &target, MemoInfo *mi, Memo *m) { + const Anope::string &mtype = (!target.empty() && target[0] == '#' ? "CHAN" : "NICK"); this->RunQuery("INSERT INTO `anope_ms_info` (receiver, flags, time, sender, text, serv) VALUES('" + - this->Escape(ci->name) + "', '" + ToString(m->ToString()) + "', " + stringify(m->time) + ", '" + - this->Escape(m->sender) + "', '" + this->Escape(m->text) + "', 'CHAN')"); + this->Escape(target) + "', '" + ToString(m->ToString()) + "', " + stringify(m->time) + ", '" + + this->Escape(source) + "', '" + this->Escape(m->text) + "', '" + mtype + "')"); } void OnMemoDel(const NickCore *nc, MemoInfo *mi, Memo *m) @@ -1079,7 +1082,7 @@ class DBMySQL : public Module this->RunQuery("DELETE FROM `anope_ms_info` WHERE `receiver` = '" + this->Escape(ci->name) + "'"); } - EventReturn OnAddAkill(User *, XLine *ak) + EventReturn OnAddAkill(XLine *ak) { this->RunQuery("INSERT INTO `anope_os_akills` (user, host, xby, reason, seton, expire) VALUES('" + this->Escape(ak->GetUser()) + "', '" + this->Escape(ak->GetHost()) + "', '" + this->Escape(ak->By) + "', '" + @@ -1095,7 +1098,7 @@ class DBMySQL : public Module this->RunQuery("TRUNCATE TABLE `anope_os_akills`"); } - EventReturn OnExceptionAdd(User *, Exception *ex) + EventReturn OnExceptionAdd(Exception *ex) { this->RunQuery("INSERT INTO `anope_os_exceptions` (mask, slimit, who, reason, time, expires) VALUES('" + this->Escape(ex->mask) + "', " + stringify(ex->limit) + ", '" + this->Escape(ex->who) + "', '" + this->Escape(ex->reason) + "', " + @@ -1108,7 +1111,7 @@ class DBMySQL : public Module this->RunQuery("DELETE FROM `anope_os_exceptions` WHERE `mask` = '" + this->Escape(ex->mask) + "'"); } - EventReturn OnAddXLine(User *, XLine *x, XLineType Type) + EventReturn OnAddXLine(XLine *x, XLineType Type) { this->RunQuery(Anope::string("INSERT INTO `anope_os_xlines` (type, mask, xby, reason, seton, expire) VALUES('") + (Type == X_SNLINE ? "SNLINE" : (Type == X_SQLINE ? "SQLINE" : "SZLINE")) + "', '" + @@ -1216,7 +1219,7 @@ static void SaveDatabases() { Memo *m = nc->memos.memos[j]; - me->OnMemoSend(NULL, nc, m); + me->OnMemoSend(m->sender, nc->display, &nc->memos, m); } } @@ -1267,35 +1270,35 @@ static void SaveDatabases() { Memo *m = ci->memos.memos[j]; - me->OnMemoSend(NULL, ci, m); + me->OnMemoSend(m->sender, ci->name, &ci->memos, m); } } if (SGLine) for (unsigned i = 0, end = SGLine->GetCount(); i < end; ++i) - me->OnAddAkill(NULL, SGLine->GetEntry(i)); + me->OnAddAkill(SGLine->GetEntry(i)); if (SZLine) for (unsigned i = 0, end = SZLine->GetCount(); i < end; ++i) - me->OnAddXLine(NULL, SZLine->GetEntry(i), X_SZLINE); + me->OnAddXLine(SZLine->GetEntry(i), X_SZLINE); if (SQLine) for (unsigned i = 0, end = SQLine->GetCount(); i < end; ++i) - me->OnAddXLine(NULL, SQLine->GetEntry(i), X_SQLINE); + me->OnAddXLine(SQLine->GetEntry(i), X_SQLINE); if (SNLine) for (unsigned i = 0, end = SNLine->GetCount(); i < end; ++i) - me->OnAddXLine(NULL, SNLine->GetEntry(i), X_SNLINE); + me->OnAddXLine(SNLine->GetEntry(i), X_SNLINE); - for (unsigned i = 0, end = exceptions.size(); i < end; ++i) - me->OnExceptionAdd(NULL, exceptions[i]); + if (me->SessionInterface) + for (SessionService::ExceptionVector::iterator it = me->SessionInterface->GetExceptions().begin(); it != me->SessionInterface->GetExceptions().end(); ++it) + me->OnExceptionAdd(*it); } CommandReturn CommandSQLSync::Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; SaveDatabases(); - u->SendMessage(OperServ, _("Updating MySQL.")); + source.Reply(_("Updating MySQL.")); return MOD_CONT; } diff --git a/modules/extra/hs_request.cpp b/modules/extra/hs_request.cpp index 4978035d3..f208d72b3 100644 --- a/modules/extra/hs_request.cpp +++ b/modules/extra/hs_request.cpp @@ -16,6 +16,8 @@ */ #include "module.h" +#include "hostserv.h" +#include "memoserv.h" static bool HSRequestMemoUser = false; static bool HSRequestMemoOper = false; @@ -152,8 +154,8 @@ class CommandHSActivate : public Command na->hostinfo.SetVhost(it->second->ident, it->second->host, u->nick, it->second->time); FOREACH_MOD(I_OnSetVhost, OnSetVhost(na)); - if (HSRequestMemoUser) - memo_send(source, na->nick, _("[auto memo] Your requested vHost has been approved."), 2); + if (HSRequestMemoUser && memoserv) + memoserv->Send(Config->s_HostServ, na->nick, _("[auto memo] Your requested vHost has been approved."), true); me->SendMessage(source, _("vHost for %s has been activated"), na->nick.c_str()); Log(LOG_COMMAND, u, this, NULL) << "for " << na->nick << " for vhost " << (!it->second->ident.empty() ? it->second->ident + "@" : "") << it->second->host; @@ -207,15 +209,15 @@ class CommandHSReject : public Command delete it->second; Requests.erase(it); - if (HSRequestMemoUser) + if (HSRequestMemoUser && memoserv) { - char message[BUFSIZE]; + Anope::string message; if (!reason.empty()) - snprintf(message, sizeof(message), _("[auto memo] Your requested vHost has been rejected. Reason: %s"), reason.c_str()); + message = Anope::printf(_("[auto memo] Your requested vHost has been rejected. Reason: %s"), reason.c_str()); else - snprintf(message, sizeof(message), "%s", _("[auto memo] Your requested vHost has been rejected.")); + message = _("[auto memo] Your requested vHost has been rejected."); - memo_send(source, nick, message, 2); + memoserv->Send(Config->s_HostServ, nick, message, true); } me->SendMessage(source, _("vHost for %s has been rejected"), nick.c_str()); @@ -312,18 +314,21 @@ class HSRequest : public Module { me = this; - this->AddCommand(HostServ, &commandhsrequest); - this->AddCommand(HostServ, &commandhsactive); - this->AddCommand(HostServ, &commandhsreject); - this->AddCommand(HostServ, &commandhswaiting); + if (!hostserv) + throw ModuleException("HostServ is not loaded!"); + + this->AddCommand(hostserv->Bot(), &commandhsrequest); + this->AddCommand(hostserv->Bot(), &commandhsactive); + this->AddCommand(hostserv->Bot(), &commandhsreject); + this->AddCommand(hostserv->Bot(), &commandhswaiting); this->SetAuthor("Anope"); this->SetType(SUPPORTED); - this->OnReload(false); - Implementation i[] = { I_OnPreCommand, I_OnDatabaseRead, I_OnDatabaseWrite, I_OnReload }; ModuleManager::Attach(i, this, 4); + + this->OnReload(); } ~HSRequest() @@ -339,7 +344,7 @@ class HSRequest : public Module EventReturn OnPreCommand(CommandSource &source, Command *command, const std::vector<Anope::string> ¶ms) { BotInfo *service = source.owner; - if (service == HostServ) + if (service->nick == Config->s_HostServ) { if (command->name.equals_ci("LIST")) { @@ -348,7 +353,7 @@ class HSRequest : public Module if (!key.empty() && key.equals_ci("+req")) { std::vector<Anope::string> emptyParams; - Command *c = FindCommand(HostServ, "WAITING"); + Command *c = FindCommand(hostserv->Bot(), "WAITING"); if (!c) throw CoreException("No waiting command?"); c->Execute(source, emptyParams); @@ -356,7 +361,7 @@ class HSRequest : public Module } } } - else if (service == NickServ) + else if (service->nick == Config->s_NickServ) { if (command->name.equals_ci("DROP")) { @@ -402,7 +407,7 @@ class HSRequest : public Module } } - void OnReload(bool) + void OnReload() { ConfigReader config; HSRequestMemoUser = config.ReadFlag("hs_request", "memouser", "no", 0); @@ -422,7 +427,7 @@ void req_send_memos(CommandSource &source, const Anope::string &vIdent, const An else host = vHost; - if (HSRequestMemoOper == 1) + if (HSRequestMemoOper == 1 && memoserv) for (unsigned i = 0; i < Config->Opers.size(); ++i) { Oper *o = Config->Opers[i]; @@ -431,9 +436,9 @@ void req_send_memos(CommandSource &source, const Anope::string &vIdent, const An if (!na) continue; - char message[BUFSIZE]; - snprintf(message, sizeof(message), _("[auto memo] vHost \002%s\002 has been requested."), host.c_str()); - memo_send(source, na->nick, message, 2); + Anope::string message = Anope::printf(_("[auto memo] vHost \002%s\002 has been requested by %s."), host.c_str(), source.u->GetMask().c_str()); + + memoserv->Send(Config->s_HostServ, na->nick, message, true); } } diff --git a/modules/extra/m_alias.cpp b/modules/extra/m_alias.cpp index c5f52bef2..025a53df0 100644 --- a/modules/extra/m_alias.cpp +++ b/modules/extra/m_alias.cpp @@ -6,6 +6,7 @@ */ #include "module.h" +#include "chanserv.h" struct CommandAlias { @@ -26,10 +27,10 @@ class ModuleAlias : public Module Implementation i[] = { I_OnReload, I_OnPreCommandRun, I_OnBotFantasy }; ModuleManager::Attach(i, this, 3); - OnReload(false); + OnReload(); } - void OnReload(bool) + void OnReload() { ConfigReader config; @@ -102,10 +103,10 @@ class ModuleAlias : public Module BotInfo *target = findbot(alias.target_client); if (!target) - target = ChanServ; + target = chanserv->Bot(); Anope::string full_message = alias.target_command; - if (target == ChanServ || target == BotServ) + if (target == chanserv->Bot() || target->nick == Config->s_BotServ) { Command *target_c = FindCommand(target, alias.target_command); if (target_c && !target_c->HasFlag(CFLAG_STRIP_CHANNEL)) diff --git a/modules/extra/m_dnsbl.cpp b/modules/extra/m_dnsbl.cpp index 5c88e75b5..f2572e694 100644 --- a/modules/extra/m_dnsbl.cpp +++ b/modules/extra/m_dnsbl.cpp @@ -6,10 +6,11 @@ */ #include "module.h" +#include "operserv.h" struct FakeAkill : public Command { - FakeAkill() : Command("AKILL", 0, 0) { this->service = OperServ; } + FakeAkill() : Command("AKILL", 0, 0) { this->service = findbot(Config->s_OperServ); } CommandReturn Execute(CommandSource &, const std::vector<Anope::string> &) { return MOD_CONT; } } fake_akill; @@ -61,18 +62,18 @@ class DNSBLResolver : public DNSRequest reason = reason.replace_all_cs("%N", Config->NetworkName); XLine *x = NULL; - if (this->add_to_akill && SGLine && (x = SGLine->Add(NULL, NULL, Anope::string("*@") + user->host, Anope::CurTime + this->blacklist.bantime, reason))) + if (this->add_to_akill && SGLine && (x = SGLine->Add(Anope::string("*@") + user->host, Config->s_OperServ, Anope::CurTime + this->blacklist.bantime, reason))) { - Log(LOG_COMMAND, OperServ, &fake_akill) << "for " << user->GetMask() << " (Listed in " << this->blacklist.name << ")"; + Log(LOG_COMMAND, operserv->Bot(), &fake_akill) << "for " << user->GetMask() << " (Listed in " << this->blacklist.name << ")"; /* If AkillOnAdd is disabled send it anyway, noone wants bots around... */ if (!Config->AkillOnAdd) - ircdproto->SendAkill(*user, x); + ircdproto->SendAkill(user, x); } else { - Log(OperServ) << "DNSBL: " << user->GetMask() << " appears in " << this->blacklist.name; - XLine xline(Anope::string("*@") + user->host, OperServ ? OperServ->nick : "OperServ", Anope::CurTime + this->blacklist.bantime, reason); - ircdproto->SendAkill(*user, &xline); + Log(operserv->Bot()) << "DNSBL: " << user->GetMask() << " appears in " << this->blacklist.name; + XLine xline(Anope::string("*@") + user->host, Config->s_OperServ, Anope::CurTime + this->blacklist.bantime, reason); + ircdproto->SendAkill(user, &xline); } } }; @@ -90,13 +91,13 @@ class ModuleDNSBL : public Module this->SetAuthor("Anope"); this->SetType(SUPPORTED); - OnReload(false); - - Implementation i[] = { I_OnReload, I_OnPreUserConnect }; + Implementation i[] = { I_OnReload, I_OnUserConnect }; ModuleManager::Attach(i, this, 2); + + OnReload(); } - void OnReload(bool) + void OnReload() { ConfigReader config; @@ -127,17 +128,18 @@ class ModuleDNSBL : public Module } } - EventReturn OnPreUserConnect(User *u) + void OnUserConnect(dynamic_reference<User> &user, bool &exempt) { - if (!this->check_on_connect && !Me->IsSynced()) - return EVENT_CONTINUE; - if (!this->check_on_netburst && !u->server->IsSynced()) - return EVENT_CONTINUE; + if (exempt || !user || (!this->check_on_connect && !Me->IsSynced())) + return; + + if (!this->check_on_netburst && !user->server->IsSynced()) + return; /* At this time we only support IPv4 */ - if (u->ip.sa.sa_family != AF_INET) - return EVENT_CONTINUE; + if (user->ip.sa.sa_family != AF_INET) + return; - unsigned long ip = u->ip.sa4.sin_addr.s_addr; + unsigned long ip = user->ip.sa4.sin_addr.s_addr; unsigned long reverse_ip = ((ip & 0xFF) << 24) | ((ip & 0xFF00) << 8) | ((ip & 0xFF0000) >> 8) | ((ip & 0xFF000000) >> 24); sockaddrs user_ip; @@ -151,7 +153,7 @@ class ModuleDNSBL : public Module try { Anope::string dnsbl_host = user_ip.addr() + "." + b.name; - DNSBLResolver *res = new DNSBLResolver(this, u, b, dnsbl_host, this->add_to_akill); + DNSBLResolver *res = new DNSBLResolver(this, user, b, dnsbl_host, this->add_to_akill); res->Process(); } catch (const SocketException &ex) @@ -160,7 +162,7 @@ class ModuleDNSBL : public Module } } - return EVENT_CONTINUE; + return; } }; diff --git a/modules/extra/m_helpchan.cpp b/modules/extra/m_helpchan.cpp index 028e5e332..90a33ca79 100644 --- a/modules/extra/m_helpchan.cpp +++ b/modules/extra/m_helpchan.cpp @@ -6,6 +6,7 @@ */ #include "module.h" +#include "operserv.h" class HelpChannel : public Module { @@ -20,23 +21,23 @@ class HelpChannel : public Module Implementation i[] = { I_OnChannelModeSet, I_OnReload }; ModuleManager::Attach(i, this, 2); - OnReload(true); + OnReload(); } EventReturn OnChannelModeSet(Channel *c, ChannelModeName Name, const Anope::string ¶m) { - if (Name == CMODE_OP && c && c->ci && c->name.equals_ci(this->HelpChan)) + if (Name == CMODE_OP && operserv && c && c->ci && c->name.equals_ci(this->HelpChan)) { User *u = finduser(param); if (u && check_access(u, c->ci, CA_OPDEOPME)) - u->SetMode(OperServ, UMODE_HELPOP); + u->SetMode(operserv->Bot(), UMODE_HELPOP); } return EVENT_CONTINUE; } - void OnReload(bool) + void OnReload() { ConfigReader config; diff --git a/modules/extra/m_ldap.cpp b/modules/extra/m_ldap.cpp index c7f0914a0..157bc70ac 100644 --- a/modules/extra/m_ldap.cpp +++ b/modules/extra/m_ldap.cpp @@ -210,7 +210,7 @@ class ModuleLDAP : public Module, public Pipe Implementation i[] = { I_OnReload, I_OnModuleUnload }; ModuleManager::Attach(i, this, 2); - OnReload(true); + OnReload(); } ~ModuleLDAP() @@ -225,7 +225,7 @@ class ModuleLDAP : public Module, public Pipe LDAPServices.clear(); } - void OnReload(bool startup) + void OnReload() { ConfigReader config; int i, num; diff --git a/modules/extra/m_ldap_authentication.cpp b/modules/extra/m_ldap_authentication.cpp index fa60247e5..f2caac63d 100644 --- a/modules/extra/m_ldap_authentication.cpp +++ b/modules/extra/m_ldap_authentication.cpp @@ -1,4 +1,5 @@ #include "module.h" +#include "nickserv.h" #include "ldap.h" static Anope::string email_attribute; @@ -44,8 +45,8 @@ class IdentifyInterface : public LDAPInterface return; } - User *u = *ii->user; - Command *c = *ii->command; + User *u = ii->user; + Command *c = ii->command; u->Extend("m_ldap_authentication_authenticated"); @@ -56,7 +57,7 @@ class IdentifyInterface : public LDAPInterface if (Config->NSAddAccessOnReg) na->nc->AddAccess(create_mask(u)); - u->SendMessage(NickServ, _("Your account \002%s\002 has been successfully created."), na->nick.c_str()); + u->SendMessage(nickserv->Bot(), _("Your account \002%s\002 has been successfully created."), na->nick.c_str()); } enc_encrypt(ii->pass, na->nc->pass); @@ -83,8 +84,8 @@ class IdentifyInterface : public LDAPInterface return; } - User *u = *ii->user; - Command *c = *ii->command; + User *u = ii->user; + Command *c = ii->command; u->Extend("m_ldap_authentication_error"); @@ -128,7 +129,7 @@ class OnIdentifyInterface : public LDAPInterface if (!email.equals_ci(u->Account()->email)) { u->Account()->email = email; - u->SendMessage(NickServ, _("Your email has been updated to \002%s\002"), email.c_str()); + u->SendMessage(nickserv->Bot(), _("Your email has been updated to \002%s\002"), email.c_str()); Log() << "m_ldap_authentication: Updated email address for " << u->nick << " (" << u->Account()->display << ") to " << email; } } @@ -166,10 +167,10 @@ class NSIdentifyLDAP : public Module ModuleManager::Attach(i, this, 4); ModuleManager::SetPriority(this, PRIORITY_FIRST); - OnReload(false); + OnReload(); } - void OnReload(bool) + void OnReload() { ConfigReader config; @@ -182,7 +183,7 @@ class NSIdentifyLDAP : public Module EventReturn OnPreCommand(CommandSource &source, Command *command, const std::vector<Anope::string> ¶ms) { - if (this->disable_register && command->service == NickServ && command->name == "REGISTER") + if (this->disable_register && nickserv && command->service == nickserv->Bot() && command->name == "REGISTER") { source.Reply(_(this->disable_reason.c_str())); return EVENT_STOP; diff --git a/modules/extra/m_ldap_oper.cpp b/modules/extra/m_ldap_oper.cpp index b8a1d5f51..8010031cb 100644 --- a/modules/extra/m_ldap_oper.cpp +++ b/modules/extra/m_ldap_oper.cpp @@ -93,10 +93,10 @@ class LDAPOper : public Module Implementation i[] = { I_OnReload, I_OnNickIdentify, I_OnDelCore }; ModuleManager::Attach(i, this, 3); - OnReload(false); + OnReload(); } - void OnReload(bool) + void OnReload() { ConfigReader config; diff --git a/modules/extra/m_mysql.cpp b/modules/extra/m_mysql.cpp index 9895d025d..a54426b37 100644 --- a/modules/extra/m_mysql.cpp +++ b/modules/extra/m_mysql.cpp @@ -158,7 +158,7 @@ class ModuleSQL : public Module, public Pipe DThread = new DispatcherThread(); threadEngine.Start(DThread); - OnReload(tru |
