summaryrefslogtreecommitdiff
path: root/modules/commands
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2014-05-28 12:07:29 -0400
committerAdam <Adam@anope.org>2014-05-28 12:07:54 -0400
commitf29e1cf383529a1a29f02b0669d973f5ee0b7a66 (patch)
tree3c33db276dc9328235bbd572641521ed44458176 /modules/commands
parent1253c70e0682fa1490c99c3d2869049a0e3fa2e0 (diff)
Move most of the core pseudoclient logic to modules
Diffstat (limited to 'modules/commands')
-rw-r--r--modules/commands/bs_assign.cpp18
-rw-r--r--modules/commands/bs_badwords.cpp28
-rw-r--r--modules/commands/bs_bot.cpp10
-rw-r--r--modules/commands/bs_control.cpp4
-rw-r--r--modules/commands/bs_info.cpp17
-rw-r--r--modules/commands/bs_kick.cpp68
-rw-r--r--modules/commands/bs_set.cpp6
-rw-r--r--modules/commands/cs_access.cpp155
-rw-r--r--modules/commands/cs_akick.cpp202
-rw-r--r--modules/commands/cs_ban.cpp8
-rw-r--r--modules/commands/cs_clone.cpp24
-rw-r--r--modules/commands/cs_drop.cpp2
-rw-r--r--modules/commands/cs_enforce.cpp20
-rw-r--r--modules/commands/cs_entrymsg.cpp18
-rw-r--r--modules/commands/cs_flags.cpp46
-rw-r--r--modules/commands/cs_getkey.cpp2
-rw-r--r--modules/commands/cs_info.cpp4
-rw-r--r--modules/commands/cs_invite.cpp2
-rw-r--r--modules/commands/cs_kick.cpp8
-rw-r--r--modules/commands/cs_list.cpp17
-rw-r--r--modules/commands/cs_log.cpp12
-rw-r--r--modules/commands/cs_mode.cpp48
-rw-r--r--modules/commands/cs_register.cpp8
-rw-r--r--modules/commands/cs_seen.cpp15
-rw-r--r--modules/commands/cs_set.cpp60
-rw-r--r--modules/commands/cs_set_misc.cpp8
-rw-r--r--modules/commands/cs_status.cpp11
-rw-r--r--modules/commands/cs_suspend.cpp14
-rw-r--r--modules/commands/cs_sync.cpp4
-rw-r--r--modules/commands/cs_topic.cpp16
-rw-r--r--modules/commands/cs_unban.cpp6
-rw-r--r--modules/commands/cs_updown.cpp4
-rw-r--r--modules/commands/cs_xop.cpp66
-rw-r--r--modules/commands/greet.cpp14
-rw-r--r--modules/commands/help.cpp6
-rw-r--r--modules/commands/hs_del.cpp6
-rw-r--r--modules/commands/hs_group.cpp12
-rw-r--r--modules/commands/hs_list.cpp4
-rw-r--r--modules/commands/hs_off.cpp2
-rw-r--r--modules/commands/hs_on.cpp2
-rw-r--r--modules/commands/hs_request.cpp20
-rw-r--r--modules/commands/hs_set.cpp10
-rw-r--r--modules/commands/ms_cancel.cpp36
-rw-r--r--modules/commands/ms_check.cpp33
-rw-r--r--modules/commands/ms_del.cpp18
-rw-r--r--modules/commands/ms_ignore.cpp10
-rw-r--r--modules/commands/ms_info.cpp20
-rw-r--r--modules/commands/ms_list.cpp18
-rw-r--r--modules/commands/ms_read.cpp28
-rw-r--r--modules/commands/ms_rsend.cpp12
-rw-r--r--modules/commands/ms_sendall.cpp4
-rw-r--r--modules/commands/ms_set.cpp26
-rw-r--r--modules/commands/ms_staff.cpp4
-rw-r--r--modules/commands/ns_access.cpp12
-rw-r--r--modules/commands/ns_ajoin.cpp26
-rw-r--r--modules/commands/ns_alist.cpp14
-rw-r--r--modules/commands/ns_cert.cpp34
-rw-r--r--modules/commands/ns_drop.cpp2
-rw-r--r--modules/commands/ns_getemail.cpp6
-rw-r--r--modules/commands/ns_getpass.cpp4
-rw-r--r--modules/commands/ns_group.cpp55
-rw-r--r--modules/commands/ns_identify.cpp22
-rw-r--r--modules/commands/ns_info.cpp6
-rw-r--r--modules/commands/ns_list.cpp20
-rw-r--r--modules/commands/ns_recover.cpp39
-rw-r--r--modules/commands/ns_register.cpp24
-rw-r--r--modules/commands/ns_resetpass.cpp12
-rw-r--r--modules/commands/ns_set.cpp56
-rw-r--r--modules/commands/ns_set_misc.cpp12
-rw-r--r--modules/commands/ns_status.cpp2
-rw-r--r--modules/commands/ns_suspend.cpp16
-rw-r--r--modules/commands/ns_update.cpp2
-rw-r--r--modules/commands/os_akill.cpp2
-rw-r--r--modules/commands/os_config.cpp2
-rw-r--r--modules/commands/os_defcon.cpp10
-rw-r--r--modules/commands/os_dns.cpp14
-rw-r--r--modules/commands/os_forbid.cpp10
-rw-r--r--modules/commands/os_ignore.cpp6
-rw-r--r--modules/commands/os_info.cpp16
-rw-r--r--modules/commands/os_logsearch.cpp2
-rw-r--r--modules/commands/os_mode.cpp2
-rw-r--r--modules/commands/os_module.cpp2
-rw-r--r--modules/commands/os_news.cpp2
-rw-r--r--modules/commands/os_oline.cpp2
-rw-r--r--modules/commands/os_oper.cpp16
-rw-r--r--modules/commands/os_session.cpp6
-rw-r--r--modules/commands/os_set.cpp2
-rw-r--r--modules/commands/os_stats.cpp6
88 files changed, 886 insertions, 794 deletions
diff --git a/modules/commands/bs_assign.cpp b/modules/commands/bs_assign.cpp
index 90fb7ed56..fe7938fc8 100644
--- a/modules/commands/bs_assign.cpp
+++ b/modules/commands/bs_assign.cpp
@@ -32,7 +32,7 @@ class CommandBSAssign : public Command
return;
}
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
@@ -46,7 +46,7 @@ class CommandBSAssign : public Command
return;
}
- AccessGroup access = source.AccessFor(ci);
+ ChanServ::AccessGroup access = source.AccessFor(ci);
if (ci->HasExt("BS_NOBOT") || (!access.HasPriv("ASSIGN") && !source.HasPriv("botserv/administration")))
{
source.Reply(ACCESS_DENIED);
@@ -100,14 +100,14 @@ class CommandBSUnassign : public Command
return;
}
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
- AccessGroup access = source.AccessFor(ci);
+ ChanServ::AccessGroup access = source.AccessFor(ci);
if (!source.HasPriv("botserv/administration") && !access.HasPriv("ASSIGN"))
{
source.Reply(ACCESS_DENIED);
@@ -157,7 +157,7 @@ class CommandBSSetNoBot : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
const Anope::string &value = params[1];
if (Anope::ReadOnly)
@@ -174,7 +174,7 @@ class CommandBSSetNoBot : public Command
if (value.equals_ci("ON"))
{
- Log(LOG_ADMIN, source, this, ci) << "to enable nobot";
+ Log(LOG_ADMIN, source, this, ci) << "to enable nobot";
ci->Extend<bool>("BS_NOBOT");
if (ci->bi)
@@ -183,7 +183,7 @@ class CommandBSSetNoBot : public Command
}
else if (value.equals_ci("OFF"))
{
- Log(LOG_ADMIN, source, this, ci) << "to disable nobot";
+ Log(LOG_ADMIN, source, this, ci) << "to disable nobot";
ci->Shrink<bool>("BS_NOBOT");
source.Reply(_("No-bot mode is now \002off\002 on channel %s."), ci->name.c_str());
@@ -230,7 +230,7 @@ class BSAssign : public Module
if (Anope::ReadOnly || !c->ci || targ->server != Me || !(bi = dynamic_cast<BotInfo *>(targ)))
return;
- AccessGroup access = c->ci->AccessFor(source);
+ ChanServ::AccessGroup access = c->ci->AccessFor(source);
if (nobot.HasExt(c->ci) || (!access.HasPriv("ASSIGN") && !source->HasPriv("botserv/administration")))
{
targ->SendMessage(bi, ACCESS_DENIED);
@@ -253,7 +253,7 @@ class BSAssign : public Module
targ->SendMessage(bi, _("Bot \002%s\002 has been assigned to %s."), bi->nick.c_str(), c->name.c_str());
}
- void OnBotInfo(CommandSource &source, BotInfo *bi, ChannelInfo *ci, InfoFormatter &info) override
+ void OnBotInfo(CommandSource &source, BotInfo *bi, ChanServ::Channel *ci, InfoFormatter &info) override
{
if (nobot.HasExt(ci))
info.AddOption(_("No bot"));
diff --git a/modules/commands/bs_badwords.cpp b/modules/commands/bs_badwords.cpp
index 082dae0bd..b410aced2 100644
--- a/modules/commands/bs_badwords.cpp
+++ b/modules/commands/bs_badwords.cpp
@@ -31,11 +31,11 @@ struct BadWordImpl : BadWord, Serializable
struct BadWordsImpl : BadWords
{
- Serialize::Reference<ChannelInfo> ci;
+ Serialize::Reference<ChanServ::Channel> ci;
typedef std::vector<BadWordImpl *> list;
Serialize::Checker<list> badwords;
- BadWordsImpl(Extensible *obj) : ci(anope_dynamic_static_cast<ChannelInfo *>(obj)), badwords("BadWord") { }
+ BadWordsImpl(Extensible *obj) : ci(anope_dynamic_static_cast<ChanServ::Channel *>(obj)), badwords("BadWord") { }
~BadWordsImpl();
@@ -72,7 +72,7 @@ struct BadWordsImpl : BadWords
{
if (this->badwords->empty() || index >= this->badwords->size())
return;
-
+
(*bwevents)(&Event::BadWordEvents::OnBadWordDel, ci, (*this->badwords)[index]);
delete this->badwords->at(index);
@@ -103,7 +103,7 @@ BadWordsImpl::~BadWordsImpl()
BadWordImpl::~BadWordImpl()
{
- ChannelInfo *ci = ChannelInfo::Find(chan);
+ ChanServ::Channel *ci = ChanServ::Find(chan);
if (ci)
{
BadWordsImpl *badwords = ci->GetExt<BadWordsImpl>("badwords");
@@ -123,13 +123,13 @@ Serializable* BadWordImpl::Unserialize(Serializable *obj, Serialize::Data &data)
data["ci"] >> sci;
data["word"] >> sword;
- ChannelInfo *ci = ChannelInfo::Find(sci);
+ ChanServ::Channel *ci = ChanServ::Find(sci);
if (!ci)
return NULL;
unsigned int n;
data["type"] >> n;
-
+
BadWordImpl *bw;
if (obj)
bw = anope_dynamic_static_cast<BadWordImpl *>(obj);
@@ -141,20 +141,20 @@ Serializable* BadWordImpl::Unserialize(Serializable *obj, Serialize::Data &data)
BadWordsImpl *bws = ci->Require<BadWordsImpl>("badwords");
bws->badwords->push_back(bw);
-
+
return bw;
}
class BadwordsDelCallback : public NumberList
{
CommandSource &source;
- ChannelInfo *ci;
+ ChanServ::Channel *ci;
BadWords *bw;
Command *c;
unsigned deleted;
bool override;
public:
- BadwordsDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, const Anope::string &list) : NumberList(list, true), source(_source), ci(_ci), c(_c), deleted(0), override(false)
+ BadwordsDelCallback(CommandSource &_source, ChanServ::Channel *_ci, Command *_c, const Anope::string &list) : NumberList(list, true), source(_source), ci(_ci), c(_c), deleted(0), override(false)
{
if (!source.AccessFor(ci).HasPriv("BADWORDS") && source.HasPriv("botserv/administration"))
this->override = true;
@@ -185,7 +185,7 @@ class BadwordsDelCallback : public NumberList
class CommandBSBadwords : public Command
{
private:
- void DoList(CommandSource &source, ChannelInfo *ci, const Anope::string &word)
+ void DoList(CommandSource &source, ChanServ::Channel *ci, const Anope::string &word)
{
bool override = !source.AccessFor(ci).HasPriv("BADWORDS");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "LIST";
@@ -259,7 +259,7 @@ class CommandBSBadwords : public Command
}
}
- void DoAdd(CommandSource &source, ChannelInfo *ci, const Anope::string &word)
+ void DoAdd(CommandSource &source, ChanServ::Channel *ci, const Anope::string &word)
{
size_t pos = word.rfind(' ');
BadWordType bwtype = BW_ANY;
@@ -308,7 +308,7 @@ class CommandBSBadwords : public Command
source.Reply(_("\002%s\002 added to %s bad words list."), realword.c_str(), ci->name.c_str());
}
- void DoDelete(CommandSource &source, ChannelInfo *ci, const Anope::string &word)
+ void DoDelete(CommandSource &source, ChanServ::Channel *ci, const Anope::string &word)
{
BadWords *badwords = ci->GetExt<BadWords>("badwords");
@@ -354,7 +354,7 @@ class CommandBSBadwords : public Command
badwords->Check();
}
- void DoClear(CommandSource &source, ChannelInfo *ci)
+ void DoClear(CommandSource &source, ChanServ::Channel *ci)
{
bool override = !source.AccessFor(ci).HasPriv("BADWORDS");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "CLEAR";
@@ -387,7 +387,7 @@ class CommandBSBadwords : public Command
return;
}
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
diff --git a/modules/commands/bs_bot.cpp b/modules/commands/bs_bot.cpp
index 9aa572f00..977d4b72f 100644
--- a/modules/commands/bs_bot.cpp
+++ b/modules/commands/bs_bot.cpp
@@ -73,7 +73,7 @@ class CommandBSBot : public Command
* if so. You need to drop the nick manually before you can use
* it as a bot nick from now on -GD
*/
- if (NickAlias::Find(nick))
+ if (NickServ::FindNick(nick))
{
source.Reply(NICK_ALREADY_REGISTERED, nick.c_str());
return;
@@ -176,7 +176,7 @@ class CommandBSBot : public Command
* if so. You need to drop the nick manually before you can use
* it as a bot nick from now on -GD
*/
- if (NickAlias::Find(nick))
+ if (NickServ::FindNick(nick))
{
source.Reply(NICK_ALREADY_REGISTERED, nick.c_str());
return;
@@ -210,10 +210,10 @@ class CommandBSBot : public Command
{
IRCD->SendClientIntroduction(bi);
unsigned minusers = Config->GetBlock("botserv")->Get<unsigned>("minusers");
- const std::set<ChannelInfo *> &channels = bi->GetChannels();
- for (std::set<ChannelInfo *>::const_iterator it = channels.begin(), it_end = channels.end(); it != it_end; ++it)
+ const std::set<ChanServ::Channel *> &channels = bi->GetChannels();
+ for (std::set<ChanServ::Channel *>::const_iterator it = channels.begin(), it_end = channels.end(); it != it_end; ++it)
{
- const ChannelInfo *ci = *it;
+ const ChanServ::Channel *ci = *it;
if (ci->c && ci->c->users.size() >= minusers)
bi->Join(ci->c);
diff --git a/modules/commands/bs_control.cpp b/modules/commands/bs_control.cpp
index 38745c191..0311a9df2 100644
--- a/modules/commands/bs_control.cpp
+++ b/modules/commands/bs_control.cpp
@@ -24,7 +24,7 @@ class CommandBSSay : public Command
{
const Anope::string &text = params[1];
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
@@ -84,7 +84,7 @@ class CommandBSAct : public Command
{
Anope::string message = params[1];
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
diff --git a/modules/commands/bs_info.cpp b/modules/commands/bs_info.cpp
index 49775a053..88ac15a48 100644
--- a/modules/commands/bs_info.cpp
+++ b/modules/commands/bs_info.cpp
@@ -20,18 +20,13 @@ class CommandBSInfo : public Command
void send_bot_channels(std::vector<Anope::string> &buffers, const BotInfo *bi)
{
Anope::string buf;
- for (registered_channel_map::const_iterator it = RegisteredChannelList->begin(), it_end = RegisteredChannelList->end(); it != it_end; ++it)
+ for (ChanServ::Channel *ci : bi->GetChannels())
{
- const ChannelInfo *ci = it->second;
-
- if (ci->bi == bi)
+ buf += " " + ci->name + " ";
+ if (buf.length() > 300)
{
- buf += " " + ci->name + " ";
- if (buf.length() > 300)
- {
- buffers.push_back(buf);
- buf.clear();
- }
+ buffers.push_back(buf);
+ buf.clear();
}
}
if (!buf.empty())
@@ -51,7 +46,7 @@ class CommandBSInfo : public Command
const Anope::string &query = params[0];
BotInfo *bi = BotInfo::Find(query, true);
- ChannelInfo *ci = ChannelInfo::Find(query);
+ ChanServ::Channel *ci = ChanServ::Find(query);
InfoFormatter info(source.nc);
if (bi)
diff --git a/modules/commands/bs_kick.cpp b/modules/commands/bs_kick.cpp
index 3a4d78c93..7ffd9d353 100644
--- a/modules/commands/bs_kick.cpp
+++ b/modules/commands/bs_kick.cpp
@@ -28,15 +28,15 @@ struct KickerDataImpl : KickerData
capsmin = capspercent = 0;
floodlines = floodsecs = 0;
repeattimes = 0;
-
+
dontkickops = dontkickvoices = false;
}
- void Check(ChannelInfo *ci) override
+ void Check(ChanServ::Channel *ci) override
{
if (amsgs || badwords || bolds || caps || colors || flood || italics || repeat || reverses || underlines)
return;
-
+
ci->Shrink<KickerData>("kickerdata");
}
@@ -46,10 +46,10 @@ struct KickerDataImpl : KickerData
void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const override
{
- if (s->GetSerializableType()->GetName() != "ChannelInfo")
+ if (s->GetSerializableType()->GetName() != "ChanServ::Channel")
return;
- const ChannelInfo *ci = anope_dynamic_static_cast<const ChannelInfo *>(e);
+ const ChanServ::Channel *ci = anope_dynamic_static_cast<const ChanServ::Channel *>(e);
KickerData *kd = this->Get(ci);
if (kd == NULL)
return;
@@ -76,10 +76,10 @@ struct KickerDataImpl : KickerData
void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) override
{
- if (s->GetSerializableType()->GetName() != "ChannelInfo")
+ if (s->GetSerializableType()->GetName() != "ChanServ::Channel")
return;
- ChannelInfo *ci = anope_dynamic_static_cast<ChannelInfo *>(e);
+ ChanServ::Channel *ci = anope_dynamic_static_cast<ChanServ::Channel *>(e);
KickerData *kd = ci->Require<KickerData>("kickerdata");
data["kickerdata:amsgs"] >> kd->amsgs;
@@ -173,12 +173,12 @@ class CommandBSKickBase : public Command
virtual bool OnHelp(CommandSource &source, const Anope::string &subcommand) override = 0;
protected:
- bool CheckArguments(CommandSource &source, const std::vector<Anope::string> &params, ChannelInfo* &ci)
+ bool CheckArguments(CommandSource &source, const std::vector<Anope::string> &params, ChanServ::Channel* &ci)
{
const Anope::string &chan = params[0];
const Anope::string &option = params[1];
- ci = ChannelInfo::Find(chan);
+ ci = ChanServ::Find(chan);
if (Anope::ReadOnly)
source.Reply(_("Sorry, kicker configuration is temporarily disabled."));
@@ -198,7 +198,7 @@ class CommandBSKickBase : public Command
return false;
}
- void Process(CommandSource &source, ChannelInfo *ci, const Anope::string &param, const Anope::string &ttb, size_t ttb_idx, const Anope::string &optname, KickerData *kd, bool &val)
+ void Process(CommandSource &source, ChanServ::Channel *ci, const Anope::string &param, const Anope::string &ttb, size_t ttb_idx, const Anope::string &optname, KickerData *kd, bool &val)
{
if (param.equals_ci("ON"))
{
@@ -257,7 +257,7 @@ class CommandBSKickAMSG : public CommandBSKickBase
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
- ChannelInfo *ci;
+ ChanServ::Channel *ci;
if (CheckArguments(source, params, ci))
{
KickerData *kd = ci->Require<KickerData>("kickerdata");
@@ -293,14 +293,14 @@ class CommandBSKickBadwords : public CommandBSKickBase
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
- ChannelInfo *ci;
+ ChanServ::Channel *ci;
if (CheckArguments(source, params, ci))
{
KickerData *kd = ci->Require<KickerData>("kickerdata");
Process(source, ci, params[1], params.size() > 2 ? params[2] : "", TTB_BADWORDS, "badwords", kd, kd->badwords);
kd->Check(ci);
}
-
+
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
@@ -332,7 +332,7 @@ class CommandBSKickBolds : public CommandBSKickBase
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
- ChannelInfo *ci;
+ ChanServ::Channel *ci;
if (CheckArguments(source, params, ci))
{
KickerData *kd = ci->Require<KickerData>("kickerdata");
@@ -366,7 +366,7 @@ class CommandBSKickCaps : public CommandBSKickBase
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
- ChannelInfo *ci;
+ ChanServ::Channel *ci;
if (!CheckArguments(source, params, ci))
return;
@@ -462,7 +462,7 @@ class CommandBSKickColors : public CommandBSKickBase
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
- ChannelInfo *ci;
+ ChanServ::Channel *ci;
if (CheckArguments(source, params, ci))
{
KickerData *kd = ci->Require<KickerData>("kickerdata");
@@ -496,7 +496,7 @@ class CommandBSKickFlood : public CommandBSKickBase
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
- ChannelInfo *ci;
+ ChanServ::Channel *ci;
if (!CheckArguments(source, params, ci))
return;
@@ -594,7 +594,7 @@ class CommandBSKickItalics : public CommandBSKickBase
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
- ChannelInfo *ci;
+ ChanServ::Channel *ci;
if (CheckArguments(source, params, ci))
{
KickerData *kd = ci->Require<KickerData>("kickerdata");
@@ -628,7 +628,7 @@ class CommandBSKickRepeat : public CommandBSKickBase
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
- ChannelInfo *ci;
+ ChanServ::Channel *ci;
if (!CheckArguments(source, params, ci))
return;
@@ -716,7 +716,7 @@ class CommandBSKickReverses : public CommandBSKickBase
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
- ChannelInfo *ci;
+ ChanServ::Channel *ci;
if (CheckArguments(source, params, ci))
{
KickerData *kd = ci->Require<KickerData>("kickerdata");
@@ -750,7 +750,7 @@ class CommandBSKickUnderlines : public CommandBSKickBase
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
- ChannelInfo *ci;
+ ChanServ::Channel *ci;
if (CheckArguments(source, params, ci))
{
KickerData *kd = ci->Require<KickerData>("kickerdata");
@@ -784,14 +784,14 @@ class CommandBSSetDontKickOps : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
- AccessGroup access = source.AccessFor(ci);
+ ChanServ::AccessGroup access = source.AccessFor(ci);
if (!source.HasPriv("botserv/administration") && !access.HasPriv("SET"))
{
source.Reply(ACCESS_DENIED);
@@ -808,7 +808,7 @@ class CommandBSSetDontKickOps : public Command
if (params[1].equals_ci("ON"))
{
bool override = !access.HasPriv("SET");
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable dontkickops";
+ Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable dontkickops";
kd->dontkickops = true;
source.Reply(_("Bot \002won't kick ops\002 on channel %s."), ci->name.c_str());
@@ -816,7 +816,7 @@ class CommandBSSetDontKickOps : public Command
else if (params[1].equals_ci("OFF"))
{
bool override = !access.HasPriv("SET");
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable dontkickops";
+ Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable dontkickops";
kd->dontkickops = false;
source.Reply(_("Bot \002will kick ops\002 on channel %s."), ci->name.c_str());
@@ -849,14 +849,14 @@ class CommandBSSetDontKickVoices : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
- AccessGroup access = source.AccessFor(ci);
+ ChanServ::AccessGroup access = source.AccessFor(ci);
if (!source.HasPriv("botserv/administration") && !access.HasPriv("SET"))
{
source.Reply(ACCESS_DENIED);
@@ -873,7 +873,7 @@ class CommandBSSetDontKickVoices : public Command
if (params[1].equals_ci("ON"))
{
bool override = !access.HasPriv("SET");
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable dontkickvoices";
+ Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable dontkickvoices";
kd->dontkickvoices = true;
source.Reply(_("Bot \002won't kick voices\002 on channel %s."), ci->name.c_str());
@@ -881,7 +881,7 @@ class CommandBSSetDontKickVoices : public Command
else if (params[1].equals_ci("OFF"))
{
bool override = !access.HasPriv("SET");
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable dontkickvoices";
+ Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable dontkickvoices";
kd->dontkickvoices = false;
source.Reply(_("Bot \002will kick voices\002 on channel %s."), ci->name.c_str());
@@ -1041,7 +1041,7 @@ class BSKick : public Module
return ud;
}
- void check_ban(ChannelInfo *ci, User *u, KickerData *kd, int ttbtype)
+ void check_ban(ChanServ::Channel *ci, User *u, KickerData *kd, int ttbtype)
{
/* Don't ban ulines or protected users */
if (u->IsProtected())
@@ -1065,7 +1065,7 @@ class BSKick : public Module
}
}
- void bot_kick(ChannelInfo *ci, User *u, const char *message, ...)
+ void bot_kick(ChanServ::Channel *ci, User *u, const char *message, ...)
{
va_list args;
char buf[1024];
@@ -1112,7 +1112,7 @@ class BSKick : public Module
}
- void OnBotInfo(CommandSource &source, BotInfo *bi, ChannelInfo *ci, InfoFormatter &info) override
+ void OnBotInfo(CommandSource &source, BotInfo *bi, ChanServ::Channel *ci, InfoFormatter &info) override
{
if (!ci)
return;
@@ -1237,7 +1237,7 @@ class BSKick : public Module
* But FIRST we check whether the user is protected in any
* way.
*/
- ChannelInfo *ci = c->ci;
+ ChanServ::Channel *ci = c->ci;
if (ci == NULL)
return;
KickerData *kd = kickerdata.Get(ci);
@@ -1370,7 +1370,7 @@ class BSKick : public Module
else
{
Anope::string wordbuf = " " + bw->word + " ";
-
+
if ((casesensitive && nbuf.find(wordbuf) != Anope::string::npos) || (!casesensitive && nbuf.find_ci(wordbuf) != Anope::string::npos))
mustkick = true;
}
diff --git a/modules/commands/bs_set.cpp b/modules/commands/bs_set.cpp
index 68aaf8d47..9c92e462c 100644
--- a/modules/commands/bs_set.cpp
+++ b/modules/commands/bs_set.cpp
@@ -85,14 +85,14 @@ class CommandBSSetBanExpire : public Command
const Anope::string &chan = params[0];
const Anope::string &arg = params[1];
- ChannelInfo *ci = ChannelInfo::Find(chan);
+ ChanServ::Channel *ci = ChanServ::Find(chan);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str());
return;
}
- AccessGroup access = source.AccessFor(ci);
+ ChanServ::AccessGroup access = source.AccessFor(ci);
if (!source.HasPriv("botserv/administration") && !access.HasPriv("SET"))
{
source.Reply(ACCESS_DENIED);
@@ -208,7 +208,7 @@ class BSSet : public Module
{
}
- void OnBotBan(User *u, ChannelInfo *ci, const Anope::string &mask) override
+ void OnBotBan(User *u, ChanServ::Channel *ci, const Anope::string &mask) override
{
if (!ci->banexpire)
return;
diff --git a/modules/commands/cs_access.cpp b/modules/commands/cs_access.cpp
index 3bfbde97d..83d00f6ae 100644
--- a/modules/commands/cs_access.cpp
+++ b/modules/commands/cs_access.cpp
@@ -10,29 +10,30 @@
*/
#include "module.h"
+#include "modules/chanserv.h"
#include "modules/cs_access.h"
static std::map<Anope::string, int16_t, ci::less> defaultLevels;
-static inline void reset_levels(ChannelInfo *ci)
+static inline void reset_levels(ChanServ::Channel *ci)
{
ci->ClearLevels();
for (std::map<Anope::string, int16_t, ci::less>::iterator it = defaultLevels.begin(), it_end = defaultLevels.end(); it != it_end; ++it)
ci->SetLevel(it->first, it->second);
}
-class AccessChanAccess : public ChanAccess
+class AccessChanAccess : public ChanServ::ChanAccess
{
public:
int level;
- AccessChanAccess(AccessProvider *p) : ChanAccess(p), level(0)
+ AccessChanAccess(ChanServ::AccessProvider *p) : ChanAccess(p), level(0)
{
}
bool HasPriv(const Anope::string &name) const override
{
- return this->ci->GetLevel(name) != ACCESS_INVALID && this->level >= this->ci->GetLevel(name);
+ return this->ci->GetLevel(name) != ChanServ::ACCESS_INVALID && this->level >= this->ci->GetLevel(name);
}
Anope::string AccessSerialize() const
@@ -51,15 +52,15 @@ class AccessChanAccess : public ChanAccess
}
}
- bool operator>(const ChanAccess &other) const override
+ bool operator>(const ChanServ::ChanAccess &other) const override
{
if (this->provider != other.provider)
- return ChanAccess::operator>(other);
+ return ChanServ::ChanAccess::operator>(other);
else
return this->level > anope_dynamic_static_cast<const AccessChanAccess *>(&other)->level;
}
- bool operator<(const ChanAccess &other) const override
+ bool operator<(const ChanServ::ChanAccess &other) const override
{
if (this->provider != other.provider)
return ChanAccess::operator<(other);
@@ -68,17 +69,17 @@ class AccessChanAccess : public ChanAccess
}
};
-class AccessAccessProvider : public AccessProvider
+class AccessAccessProvider : public ChanServ::AccessProvider
{
public:
static AccessAccessProvider *me;
- AccessAccessProvider(Module *o) : AccessProvider(o, "access/access")
+ AccessAccessProvider(Module *o) : ChanServ::AccessProvider(o, "access/access")
{
me = this;
}
- ChanAccess *Create() override
+ ChanServ::ChanAccess *Create() override
{
return new AccessChanAccess(this);
}
@@ -87,11 +88,11 @@ AccessAccessProvider* AccessAccessProvider::me;
class CommandCSAccess : public Command
{
- void DoAdd(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
+ void DoAdd(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
{
Anope::string mask = params[2];
- Privilege *p = NULL;
- int level = ACCESS_INVALID;
+ ChanServ::Privilege *p = NULL;
+ int level = ChanServ::ACCESS_INVALID;
try
{
@@ -99,7 +100,7 @@ class CommandCSAccess : public Command
}
catch (const ConvertException &)
{
- p = PrivilegeManager::FindPrivilege(params[3]);
+ p = ChanServ::service ? ChanServ::service->FindPrivilege(params[3]) : nullptr;
if (p != NULL && defaultLevels[p->name])
level = defaultLevels[p->name];
}
@@ -109,14 +110,14 @@ class CommandCSAccess : public Command
source.Reply(_("Access level must be non-zero."));
return;
}
- else if (level <= ACCESS_INVALID || level >= ACCESS_FOUNDER)
+ else if (level <= ChanServ::ACCESS_INVALID || level >= ChanServ::ACCESS_FOUNDER)
{
- source.Reply(CHAN_ACCESS_LEVEL_RANGE, ACCESS_INVALID + 1, ACCESS_FOUNDER - 1);
+ source.Reply(CHAN_ACCESS_LEVEL_RANGE, ChanServ::ACCESS_INVALID + 1, ChanServ::ACCESS_FOUNDER - 1);
return;
}
- AccessGroup u_access = source.AccessFor(ci);
- const ChanAccess *highest = u_access.Highest();
+ ChanServ::AccessGroup u_access = source.AccessFor(ci);
+ const ChanServ::ChanAccess *highest = u_access.Highest();
AccessChanAccess tmp_access(AccessAccessProvider::me);
tmp_access.ci = ci;
@@ -143,7 +144,7 @@ class CommandCSAccess : public Command
return;
}
- ChannelInfo *targ_ci = ChannelInfo::Find(mask);
+ ChanServ::Channel *targ_ci = ChanServ::Find(mask);
if (targ_ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, mask.c_str());
@@ -159,7 +160,7 @@ class CommandCSAccess : public Command
}
else
{
- const NickAlias *na = NickAlias::Find(mask);
+ const NickServ::Nick *na = NickServ::FindNick(mask);
if (!na && Config->GetModule("chanserv")->Get<bool>("disallow_hostmask_access"))
{
source.Reply(_("Masks and unregistered users may not be on access lists."));
@@ -180,7 +181,7 @@ class CommandCSAccess : public Command
for (unsigned i = ci->GetAccessCount(); i > 0; --i)
{
- const ChanAccess *access = ci->GetAccess(i - 1);
+ const ChanServ::ChanAccess *access = ci->GetAccess(i - 1);
if (mask.equals_ci(access->mask))
{
/* Don't allow lowering from a level >= u_level */
@@ -201,7 +202,7 @@ class CommandCSAccess : public Command
return;
}
- ServiceReference<AccessProvider> provider("AccessProvider", "access/access");
+ ServiceReference<ChanServ::AccessProvider> provider("AccessProvider", "access/access");
if (!provider)
return;
AccessChanAccess *access = anope_dynamic_static_cast<AccessChanAccess *>(provider->Create());
@@ -222,11 +223,11 @@ class CommandCSAccess : public Command
source.Reply(_("\002%s\002 added to %s access list at level \002%d\002."), access->mask.c_str(), ci->name.c_str(), level);
}
- void DoDel(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
+ void DoDel(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
{
Anope::string mask = params[2];
- if (!isdigit(mask[0]) && mask.find_first_of("#!*@") == Anope::string::npos && !NickAlias::Find(mask))
+ if (!isdigit(mask[0]) && mask.find_first_of("#!*@") == Anope::string::npos && !NickServ::FindNick(mask))
{
User *targ = User::Find(mask, true);
if (targ != NULL)
@@ -245,14 +246,14 @@ class CommandCSAccess : public Command
class AccessDelCallback : public NumberList
{
CommandSource &source;
- ChannelInfo *ci;
+ ChanServ::Channel *ci;
Command *c;
unsigned deleted;
Anope::string Nicks;
bool denied;
bool override;
public:
- AccessDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, const Anope::string &numlist) : NumberList(numlist, true), source(_source), ci(_ci), c(_c), deleted(0), denied(false), override(false)
+ AccessDelCallback(CommandSource &_source, ChanServ::Channel *_ci, Command *_c, const Anope::string &numlist) : NumberList(numlist, true), source(_source), ci(_ci), c(_c), deleted(0), denied(false), override(false)
{
if (!source.AccessFor(ci).HasPriv("ACCESS_CHANGE") && source.HasPriv("chanserv/access/modify"))
this->override = true;
@@ -280,10 +281,10 @@ class CommandCSAccess : public Command
if (!Number || Number > ci->GetAccessCount())
return;
- ChanAccess *access = ci->GetAccess(Number - 1);
+ ChanServ::ChanAccess *access = ci->GetAccess(Number - 1);
- AccessGroup ag = source.AccessFor(ci);
- const ChanAccess *u_highest = ag.Highest();
+ ChanServ::AccessGroup ag = source.AccessFor(ci);
+ const ChanServ::ChanAccess *u_highest = ag.Highest();
if ((!u_highest || *u_highest <= *access) && !ag.founder && !this->override && !access->mask.equals_ci(source.nc->display))
{
@@ -308,12 +309,12 @@ class CommandCSAccess : public Command
}
else
{
- AccessGroup u_access = source.AccessFor(ci);
- const ChanAccess *highest = u_access.Highest();
+ ChanServ::AccessGroup u_access = source.AccessFor(ci);
+ const ChanServ::ChanAccess *highest = u_access.Highest();
for (unsigned i = ci->GetAccessCount(); i > 0; --i)
{
- ChanAccess *access = ci->GetAccess(i - 1);
+ ChanServ::ChanAccess *access = ci->GetAccess(i - 1);
if (mask.equals_ci(access->mask))
{
if (!access->mask.equals_ci(source.nc->display) && !u_access.founder && (!highest || *highest <= *access) && !source.HasPriv("chanserv/access/modify"))
@@ -338,7 +339,7 @@ class CommandCSAccess : public Command
return;
}
- void ProcessList(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params, ListFormatter &list)
+ void ProcessList(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params, ListFormatter &list)
{
const Anope::string &nick = params.size() > 2 ? params[2] : "";
@@ -349,10 +350,10 @@ class CommandCSAccess : public Command
class AccessListCallback : public NumberList
{
ListFormatter &list;
- ChannelInfo *ci;
+ ChanServ::Channel *ci;
public:
- AccessListCallback(ListFormatter &_list, ChannelInfo *_ci, const Anope::string &numlist) : NumberList(numlist, false), list(_list), ci(_ci)
+ AccessListCallback(ListFormatter &_list, ChanServ::Channel *_ci, const Anope::string &numlist) : NumberList(numlist, false), list(_list), ci(_ci)
{
}
@@ -361,13 +362,13 @@ class CommandCSAccess : public Command
if (!number || number > ci->GetAccessCount())
return;
- const ChanAccess *access = ci->GetAccess(number - 1);
+ const ChanServ::ChanAccess *access = ci->GetAccess(number - 1);
Anope::string timebuf;
if (ci->c)
for (Channel::ChanUserList::const_iterator cit = ci->c->users.begin(), cit_end = ci->c->users.end(); cit != cit_end; ++cit)
{
- ChanAccess::Path p;
+ ChanServ::ChanAccess::Path p;
if (access->Matches(cit->second->user, cit->second->user->Account(), p))
timebuf = "Now";
}
@@ -395,7 +396,7 @@ class CommandCSAccess : public Command
{
for (unsigned i = 0, end = ci->GetAccessCount(); i < end; ++i)
{
- const ChanAccess *access = ci->GetAccess(i);
+ const ChanServ::ChanAccess *access = ci->GetAccess(i);
if (!nick.empty() && !Anope::Match(access->mask, nick))
continue;
@@ -404,7 +405,7 @@ class CommandCSAccess : public Command
if (ci->c)
for (Channel::ChanUserList::const_iterator cit = ci->c->users.begin(), cit_end = ci->c->users.end(); cit != cit_end; ++cit)
{
- ChanAccess::Path p;
+ ChanServ::ChanAccess::Path p;
if (access->Matches(cit->second->user, cit->second->user->Account(), p))
timebuf = "Now";
}
@@ -434,7 +435,7 @@ class CommandCSAccess : public Command
list.Process(replies);
source.Reply(_("Access list for %s:"), ci->name.c_str());
-
+
for (unsigned i = 0; i < replies.size(); ++i)
source.Reply(replies[i]);
@@ -444,7 +445,7 @@ class CommandCSAccess : public Command
return;
}
- void DoList(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
+ void DoList(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
{
if (!ci->GetAccessCount())
{
@@ -457,7 +458,7 @@ class CommandCSAccess : public Command
this->ProcessList(source, ci, params, list);
}
- void DoView(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
+ void DoView(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
{
if (!ci->GetAccessCount())
{
@@ -470,7 +471,7 @@ class CommandCSAccess : public Command
this->ProcessList(source, ci, params, list);
}
- void DoClear(CommandSource &source, ChannelInfo *ci)
+ void DoClear(CommandSource &source, ChanServ::Channel *ci)
{
if (!source.IsFounder(ci) && !source.HasPriv("chanserv/access/modify"))
source.Reply(ACCESS_DENIED);
@@ -506,7 +507,7 @@ class CommandCSAccess : public Command
const Anope::string &nick = params.size() > 2 ? params[2] : "";
const Anope::string &s = params.size() > 3 ? params[3] : "";
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
@@ -526,7 +527,7 @@ class CommandCSAccess : public Command
has_access = true;
else if (is_del)
{
- const NickAlias *na = NickAlias::Find(nick);
+ const NickServ::Nick *na = NickServ::FindNick(nick);
if (na && na->nc == source.GetAccount())
has_access = true;
}
@@ -612,7 +613,7 @@ class CommandCSAccess : public Command
class CommandCSLevels : public Command
{
- void DoSet(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
+ void DoSet(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
{
const Anope::string &what = params[2];
const Anope::string &lev = params[3];
@@ -620,7 +621,7 @@ class CommandCSLevels : public Command
int level;
if (lev.equals_ci("FOUNDER"))
- level = ACCESS_FOUNDER;
+ level = ChanServ::ACCESS_FOUNDER;
else
{
try
@@ -634,11 +635,11 @@ class CommandCSLevels : public Command
}
}
- if (level <= ACCESS_INVALID || level > ACCESS_FOUNDER)
- source.Reply(_("Level must be between %d and %d inclusive."), ACCESS_INVALID + 1, ACCESS_FOUNDER - 1);
+ if (level <= ChanServ::ACCESS_INVALID || level > ChanServ::ACCESS_FOUNDER)
+ source.Reply(_("Level must be between %d and %d inclusive."), ChanServ::ACCESS_INVALID + 1, ChanServ::ACCESS_FOUNDER - 1);
else
{
- Privilege *p = PrivilegeManager::FindPrivilege(what);
+ ChanServ::Privilege *p = ChanServ::service ? ChanServ::service->FindPrivilege(what) : nullptr;
if (p == NULL)
source.Reply(_("Setting \002%s\002 not known. Type \002%s%s HELP LEVELS\002 for a list of valid settings."), what.c_str(), Config->StrictPrivmsg.c_str(), source.service->nick.c_str());
else
@@ -649,7 +650,7 @@ class CommandCSLevels : public Command
ci->SetLevel(p->name, level);
this->onlevelchange(&Event::LevelChange::OnLevelChange, source, ci, p->name, level);
- if (level == ACCESS_FOUNDER)
+ if (level == ChanServ::ACCESS_FOUNDER)
source.Reply(_("Level for %s on channel %s changed to founder only."), p->name.c_str(), ci->name.c_str());
else
source.Reply(_("Level for \002%s\002 on channel %s changed to \002%d\002."), p->name.c_str(), ci->name.c_str(), level);
@@ -657,7 +658,7 @@ class CommandCSLevels : public Command
}
}
- void DoDisable(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
+ void DoDisable(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
{
const Anope::string &what = params[2];
@@ -668,14 +669,14 @@ class CommandCSLevels : public Command
return;
}
- Privilege *p = PrivilegeManager::FindPrivilege(what);
+ ChanServ::Privilege *p = ChanServ::service ? ChanServ::service->FindPrivilege(what) : nullptr;
if (p != NULL)
{
bool override = !source.AccessFor(ci).HasPriv("FOUNDER");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable " << p->name;
- ci->SetLevel(p->name, ACCESS_INVALID);
- this->onlevelchange(&Event::LevelChange::OnLevelChange, source, ci, p->name, ACCESS_INVALID);
+ ci->SetLevel(p->name, ChanServ::ACCESS_INVALID);
+ this->onlevelchange(&Event::LevelChange::OnLevelChange, source, ci, p->name, ChanServ::ACCESS_INVALID);
source.Reply(_("\002%s\002 disabled on channel %s."), p->name.c_str(), ci->name.c_str());
return;
@@ -684,26 +685,29 @@ class CommandCSLevels : public Command
source.Reply(_("Setting \002%s\002 not known. Type \002%s%s HELP LEVELS\002 for a list of valid settings."), what.c_str(), Config->StrictPrivmsg.c_str(), source.service->nick.c_str());
}
- void DoList(CommandSource &source, ChannelInfo *ci)
+ void DoList(CommandSource &source, ChanServ::Channel *ci)
{
+ if (!ChanServ::service)
+ return;
+
source.Reply(_("Access level settings for channel %s:"), ci->name.c_str());
ListFormatter list(source.GetAccount());
list.AddColumn(_("Name")).AddColumn(_("Level"));
- const std::vector<Privilege> &privs = PrivilegeManager::GetPrivileges();
+ const std::vector<ChanServ::Privilege> &privs = ChanServ::service->GetPrivileges();
for (unsigned i = 0; i < privs.size(); ++i)
{
- const Privilege &p = privs[i];
+ const ChanServ::Privilege &p = privs[i];
int16_t j = ci->GetLevel(p.name);
ListFormatter::ListEntry entry;
entry["Name"] = p.name;
- if (j == ACCESS_INVALID)
+ if (j == ChanServ::ACCESS_INVALID)
entry["Level"] = Language::Translate(source.GetAccount(), _("(disabled)"));
- else if (j == ACCESS_FOUNDER)
+ else if (j == ChanServ::ACCESS_FOUNDER)
entry["Level"] = Language::Translate(source.GetAccount(), _("(founder only)"));
else
entry["Level"] = stringify(j);
@@ -718,7 +722,7 @@ class CommandCSLevels : public Command
source.Reply(replies[i]);
}
- void DoReset(CommandSource &source, ChannelInfo *ci)
+ void DoReset(CommandSource &source, ChanServ::Channel *ci)
{
bool override = !source.AccessFor(ci).HasPriv("FOUNDER");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to reset all levels";
@@ -747,7 +751,7 @@ class CommandCSLevels : public Command
const Anope::string &what = params.size() > 2 ? params[2] : "";
const Anope::string &s = params.size() > 3 ? params[3] : "";
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
@@ -786,14 +790,17 @@ class CommandCSLevels : public Command
ListFormatter list(source.GetAccount());
list.AddColumn(_("Name")).AddColumn(_("Description"));
- const std::vector<Privilege> &privs = PrivilegeManager::GetPrivileges();
- for (unsigned i = 0; i < privs.size(); ++i)
+ if (ChanServ::service)
{
- const Privilege &p = privs[i];
- ListFormatter::ListEntry entry;
- entry["Name"] = p.name;
- entry["Description"] = Language::Translate(source.nc, p.desc.c_str());
- list.AddEntry(entry);
+ const std::vector<ChanServ::Privilege> &privs = ChanServ::service->GetPrivileges();
+ for (unsigned i = 0; i < privs.size(); ++i)
+ {
+ const ChanServ::Privilege &p = privs[i];
+ ListFormatter::ListEntry entry;
+ entry["Name"] = p.name;
+ entry["Description"] = Language::Translate(source.nc, p.desc.c_str());
+ list.AddEntry(entry);
+ }
}
std::vector<Anope::string> replies;
@@ -862,7 +869,7 @@ class CSAccess : public Module
const Anope::string &pname = priv->Get<const Anope::string>("name");
- Privilege *p = PrivilegeManager::FindPrivilege(pname);
+ ChanServ::Privilege *p = ChanServ::service ? ChanServ::service->FindPrivilege(pname) : nullptr;
if (p == NULL)
continue;
@@ -870,20 +877,20 @@ class CSAccess : public Module
if (value.empty())
continue;
else if (value.equals_ci("founder"))
- defaultLevels[p->name] = ACCESS_FOUNDER;
+ defaultLevels[p->name] = ChanServ::ACCESS_FOUNDER;
else if (value.equals_ci("disabled"))
- defaultLevels[p->name] = ACCESS_INVALID;
+ defaultLevels[p->name] = ChanServ::ACCESS_INVALID;
else
defaultLevels[p->name] = priv->Get<int16_t>("level");
}
}
- void OnCreateChan(ChannelInfo *ci) override
+ void OnCreateChan(ChanServ::Channel *ci) override
{
reset_levels(ci);
}
- EventReturn OnGroupCheckPriv(const AccessGroup *group, const Anope::string &priv) override
+ EventReturn OnGroupCheckPriv(const ChanServ::AccessGroup *group, const Anope::string &priv) override
{
if (group->ci == NULL)
return EVENT_CONTINUE;
diff --git a/modules/commands/cs_akick.cpp b/modules/commands/cs_akick.cpp
index 61bc23181..b548d87a9 100644
--- a/modules/commands/cs_akick.cpp
+++ b/modules/commands/cs_akick.cpp
@@ -12,15 +12,89 @@
#include "module.h"
#include "modules/cs_akick.h"
+class AutoKickImpl : public AutoKick
+{
+ public:
+ ~AutoKickImpl()
+ {
+ if (this->ci)
+ {
+ std::vector<AutoKick *>::iterator it = std::find(this->ci->akick->begin(), this->ci->akick->end(), this);
+ if (it != this->ci->akick->end())
+ this->ci->akick->erase(it);
+
+ const NickServ::Nick *na = NickServ::FindNick(this->mask);
+ if (na != NULL)
+ na->nc->RemoveChannelReference(this->ci);
+ }
+ }
+
+ void Serialize(Serialize::Data &data) const override
+ {
+ data["ci"] << this->ci->name;
+ if (this->nc)
+ data["nc"] << this->nc->display;
+ else
+ data["mask"] << this->mask;
+ data["reason"] << this->reason;
+ data["creator"] << this->creator;
+ data.SetType("addtime", Serialize::Data::DT_INT); data["addtime"] << this->addtime;
+ data.SetType("last_used", Serialize::Data::DT_INT); data["last_used"] << this->last_used;
+ }
+
+ static Serializable* Unserialize(Serializable *obj, Serialize::Data &data)
+ {
+ Anope::string sci, snc;
+
+ data["ci"] >> sci;
+ data["nc"] >> snc;
+
+ ChanServ::Channel *ci = ChanServ::Find(sci);
+ if (!ci)
+ return NULL;
+
+ AutoKick *ak;
+ NickServ::Account *nc = NickServ::FindAccount(snc);
+ if (obj)
+ {
+ ak = anope_dynamic_static_cast<AutoKick *>(obj);
+ data["creator"] >> ak->creator;
+ data["reason"] >> ak->reason;
+ ak->nc = NickServ::FindAccount(snc);
+ data["mask"] >> ak->mask;
+ data["addtime"] >> ak->addtime;
+ data["last_used"] >> ak->last_used;
+ }
+ else
+ {
+ time_t addtime, lastused;
+ data["addtime"] >> addtime;
+ data["last_used"] >> lastused;
+
+ Anope::string screator, sreason, smask;
+
+ data["creator"] >> screator;
+ data["reason"] >> sreason;
+ data["mask"] >> smask;
+
+ if (nc)
+ ak = ci->AddAkick(screator, nc, sreason, addtime, lastused);
+ else
+ ak = ci->AddAkick(screator, smask, sreason, addtime, lastused);
+ }
+
+ return ak;
+ }
+};
+
class CommandCSAKick : public Command
{
- void DoAdd(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
+ void DoAdd(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
{
Anope::string mask = params[2];
Anope::string reason = params.size() > 3 ? params[3] : "";
- const NickAlias *na = NickAlias::Find(mask);
- NickCore *nc = NULL;
- const AutoKick *akick;
+ const NickServ::Nick *na = NickServ::FindNick(mask);
+ NickServ::Account *nc = NULL;
unsigned reasonmax = Config->GetModule("chanserv")->Get<unsigned>("reasonmax", "200");
if (reason.length() > reasonmax)
@@ -59,7 +133,7 @@ class CommandCSAKick : public Command
}
Entry e("", mask);
-
+
mask = (e.nick.empty() ? "*" : e.nick) + "!"
+ (e.user.empty() ? "*" : e.user) + "@"
+ (e.host.empty() ? "*" : e.host);
@@ -94,7 +168,7 @@ class CommandCSAKick : public Command
* or whether the mask matches a user with higher/equal access - Viper */
else if (ci->HasExt("PEACE") && nc)
{
- AccessGroup nc_access = ci->AccessFor(nc), u_access = source.AccessFor(ci);
+ ChanServ::AccessGroup nc_access = ci->AccessFor(nc), u_access = source.AccessFor(ci);
if (nc == ci->GetFounder() || nc_access >= u_access)
{
source.Reply(ACCESS_DENIED);
@@ -103,13 +177,14 @@ class CommandCSAKick : public Command
}
else if (ci->HasExt("PEACE"))
{
+#if 0
/* Match against all currently online users with equal or
* higher access. - Viper */
for (user_map::const_iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it)
{
User *u2 = it->second;
- AccessGroup nc_access = ci->AccessFor(nc), u_access = source.AccessFor(ci);
+ ChanServ::AccessGroup nc_access = ci->AccessFor(nc), u_access = source.AccessFor(ci);
Entry entry_mask("", mask);
if ((ci->AccessFor(u2).HasPriv("FOUNDER") || nc_access >= u_access) && entry_mask.Matches(u2))
@@ -121,11 +196,11 @@ class CommandCSAKick : public Command
/* Match against the lastusermask of all nickalias's with equal
* or higher access. - Viper */
- for (nickalias_map::const_iterator it = NickAliasList->begin(), it_end = NickAliasList->end(); it != it_end; ++it)
+ for (nickalias_map::const_iterator it = NickServ::NickList->begin(), it_end = NickServ::NickList->end(); it != it_end; ++it)
{
na = it->second;
- AccessGroup nc_access = ci->AccessFor(na->nc), u_access = source.AccessFor(ci);
+ ChanServ::AccessGroup nc_access = ci->AccessFor(na->nc), u_access = source.AccessFor(ci);
if (na->nc && (na->nc == ci->GetFounder() || nc_access >= u_access))
{
Anope::string buf = na->nick + "!" + na->last_usermask;
@@ -136,14 +211,15 @@ class CommandCSAKick : public Command
}
}
}
+#endif
}
for (unsigned j = 0, end = ci->GetAkickCount(); j < end; ++j)
{
- akick = ci->GetAkick(j);
- if (akick->nc ? akick->nc == nc : mask.equals_ci(akick->mask))
+ AutoKick *ak = ci->GetAkick(j);
+ if (ak->nc ? ak->nc == nc : mask.equals_ci(ak->mask))
{
- source.Reply(_("\002%s\002 already exists on %s autokick list."), akick->nc ? akick->nc->display.c_str() : akick->mask.c_str(), ci->name.c_str());
+ source.Reply(_("\002%s\002 already exists on %s autokick list."), ak->nc ? ak->nc->display.c_str() : ak->mask.c_str(), ci->name.c_str());
return;
}
}
@@ -154,21 +230,22 @@ class CommandCSAKick : public Command
return;
}
+ AutoKick *ak;
if (nc)
- akick = ci->AddAkick(source.GetNick(), nc, reason);
+ ak = ci->AddAkick(source.GetNick(), nc, reason);
else
- akick = ci->AddAkick(source.GetNick(), mask, reason);
+ ak = ci->AddAkick(source.GetNick(), mask, reason);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to add " << mask << (reason == "" ? "" : ": ") << reason;
- this->akickevents(&Event::Akick::OnAkickAdd, source, ci, akick);
+ this->akickevents(&Event::Akick::OnAkickAdd, source, ci, ak);
source.Reply(_("\002%s\002 added to %s autokick list."), mask.c_str(), ci->name.c_str());
this->DoEnforce(source, ci);
}
- void DoDel(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
+ void DoDel(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
{
const Anope::string &mask = params[2];
unsigned i, end;
@@ -185,12 +262,12 @@ class CommandCSAKick : public Command
class AkickDelCallback : public NumberList
{
CommandSource &source;
- ChannelInfo *ci;
+ ChanServ::Channel *ci;
CommandCSAKick *c;
unsigned deleted;
- AccessGroup ag;
+ ChanServ::AccessGroup ag;
public:
- AkickDelCallback(CommandSource &_source, ChannelInfo *_ci, CommandCSAKick *_c, const Anope::string &list) : NumberList(list, true), source(_source), ci(_ci), c(_c), deleted(0), ag(source.AccessFor(ci))
+ AkickDelCallback(CommandSource &_source, ChanServ::Channel *_ci, CommandCSAKick *_c, const Anope::string &list) : NumberList(list, true), source(_source), ci(_ci), c(_c), deleted(0), ag(source.AccessFor(ci))
{
}
@@ -209,12 +286,12 @@ class CommandCSAKick : public Command
if (!number || number > ci->GetAkickCount())
return;
- const AutoKick *akick = ci->GetAkick(number - 1);
+ const AutoKick *ak = ci->GetAkick(number - 1);
- c->akickevents(&Event::Akick::OnAkickDel, source, ci, akick);
+ c->akickevents(&Event::Akick::OnAkickDel, source, ci, ak);
bool override = !ag.HasPriv("AKICK");
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, c, ci) << "to delete " << (akick->nc ? akick->nc->display : akick->mask);
+ Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, c, ci) << "to delete " << (ak->nc ? ak->nc->display : ak->mask);
++deleted;
ci->EraseAkick(number - 1);
@@ -225,14 +302,14 @@ class CommandCSAKick : public Command
}
else
{
- const NickAlias *na = NickAlias::Find(mask);
- const NickCore *nc = na ? *na->nc : NULL;
+ const NickServ::Nick *na = NickServ::FindNick(mask);
+ const NickServ::Account *nc = na ? *na->nc : NULL;
for (i = 0, end = ci->GetAkickCount(); i < end; ++i)
{
- const AutoKick *akick = ci->GetAkick(i);
+ const AutoKick *ak = ci->GetAkick(i);
- if (akick->nc ? akick->nc == nc : mask.equals_ci(akick->mask))
+ if (ak->nc ? ak->nc == nc : mask.equals_ci(ak->mask))
break;
}
@@ -253,7 +330,7 @@ class CommandCSAKick : public Command
}
}
- void ProcessList(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params, ListFormatter &list)
+ void ProcessList(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params, ListFormatter &list)
{
const Anope::string &mask = params.size() > 2 ? params[2] : "";
@@ -262,10 +339,10 @@ class CommandCSAKick : public Command
class AkickListCallback : public NumberList
{
ListFormatter &list;
- ChannelInfo *ci;
+ ChanServ::Channel *ci;
public:
- AkickListCallback(ListFormatter &_list, ChannelInfo *_ci, const Anope::string &numlist) : NumberList(numlist, false), list(_list), ci(_ci)
+ AkickListCallback(ListFormatter &_list, ChanServ::Channel *_ci, const Anope::string &numlist) : NumberList(numlist, false), list(_list), ci(_ci)
{
}
@@ -273,29 +350,29 @@ class CommandCSAKick : public Command
{
if (!number || number > ci->GetAkickCount())
return;
-
- const AutoKick *akick = ci->GetAkick(number - 1);
+
+ const AutoKick *ak = ci->GetAkick(number - 1);
Anope::string timebuf, lastused;
- if (akick->addtime)
- timebuf = Anope::strftime(akick->addtime, NULL, true);
+ if (ak->addtime)
+ timebuf = Anope::strftime(ak->addtime, NULL, true);
else
timebuf = UNKNOWN;
- if (akick->last_used)
- lastused = Anope::strftime(akick->last_used, NULL, true);
+ if (ak->last_used)
+ lastused = Anope::strftime(ak->last_used, NULL, true);
else
lastused = UNKNOWN;
ListFormatter::ListEntry entry;
entry["Number"] = stringify(number);
- if (akick->nc)
- entry["Mask"] = akick->nc->display;
+ if (ak->nc)
+ entry["Mask"] = ak->nc->display;
else
- entry["Mask"] = akick->mask;
- entry["Creator"] = akick->creator;
+ entry["Mask"] = ak->mask;
+ entry["Creator"] = ak->creator;
entry["Created"] = timebuf;
entry["Last used"] = lastused;
- entry["Reason"] = akick->reason;
+ entry["Reason"] = ak->reason;
this->list.AddEntry(entry);
}
}
@@ -306,36 +383,36 @@ class CommandCSAKick : public Command
{
for (unsigned i = 0, end = ci->GetAkickCount(); i < end; ++i)
{
- const AutoKick *akick = ci->GetAkick(i);
+ const AutoKick *ak = ci->GetAkick(i);
if (!mask.empty())
{
- if (!akick->nc && !Anope::Match(akick->mask, mask))
+ if (!ak->nc && !Anope::Match(ak->mask, mask))
continue;
- if (akick->nc && !Anope::Match(akick->nc->display, mask))
+ if (ak->nc && !Anope::Match(ak->nc->display, mask))
continue;
}
Anope::string timebuf, lastused;
- if (akick->addtime)
- timebuf = Anope::strftime(akick->addtime, NULL, true);
+ if (ak->addtime)
+ timebuf = Anope::strftime(ak->addtime, NULL, true);
else
timebuf = UNKNOWN;
- if (akick->last_used)
- lastused = Anope::strftime(akick->last_used, NULL, true);
+ if (ak->last_used)
+ lastused = Anope::strftime(ak->last_used, NULL, true);
else
lastused = UNKNOWN;
ListFormatter::ListEntry entry;
entry["Number"] = stringify(i + 1);
- if (akick->nc)
- entry["Mask"] = akick->nc->display;
+ if (ak->nc)
+ entry["Mask"] = ak->nc->display;
else
- entry["Mask"] = akick->mask;
- entry["Creator"] = akick->creator;
+ entry["Mask"] = ak->mask;
+ entry["Creator"] = ak->creator;
entry["Created"] = timebuf;
entry["Last used"] = lastused;
- entry["Reason"] = akick->reason;
+ entry["Reason"] = ak->reason;
list.AddEntry(entry);
}
}
@@ -348,7 +425,7 @@ class CommandCSAKick : public Command
list.Process(replies);
source.Reply(_("Autokick list for %s:"), ci->name.c_str());
-
+
for (unsigned i = 0; i < replies.size(); ++i)
source.Reply(replies[i]);
@@ -356,7 +433,7 @@ class CommandCSAKick : public Command
}
}
- void DoList(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
+ void DoList(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
{
if (!ci->GetAkickCount())
{
@@ -369,7 +446,7 @@ class CommandCSAKick : public Command
this->ProcessList(source, ci, params, list);
}
- void DoView(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
+ void DoView(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
{
if (!ci->GetAkickCount())
{
@@ -382,7 +459,7 @@ class CommandCSAKick : public Command
this->ProcessList(source, ci, params, list);
}
- void DoEnforce(CommandSource &source, ChannelInfo *ci)
+ void DoEnforce(CommandSource &source, ChanServ::Channel *ci)
{
Channel *c = ci->c;
int count = 0;
@@ -408,7 +485,7 @@ class CommandCSAKick : public Command
source.Reply(_("AKICK ENFORCE for \002%s\002 complete; \002%d\002 users were affected."), ci->name.c_str(), count);
}
- void DoClear(CommandSource &source, ChannelInfo *ci)
+ void DoClear(CommandSource &source, ChanServ::Channel *ci)
{
bool override = !source.AccessFor(ci).HasPriv("AKICK");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to clear the akick list";
@@ -437,7 +514,7 @@ class CommandCSAKick : public Command
Anope::string cmd = params[1];
Anope::string mask = params.size() > 2 ? params[2] : "";
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
@@ -512,17 +589,26 @@ class CommandCSAKick : public Command
};
class CSAKick : public Module
+ , public AutoKickService
, public EventHook<Event::CheckKick>
{
CommandCSAKick commandcsakick;
EventHandlers<Event::Akick> akickevents;
+ Serialize::Type akick_type;
public:
CSAKick(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR)
+ , AutoKickService(this)
, EventHook<Event::CheckKick>("OnCheckKick")
, commandcsakick(this, akickevents)
, akickevents(this, "Akick")
+ , akick_type("AutoKick", AutoKickImpl::Unserialize)
+ {
+ }
+
+ AutoKick* Create() override
{
+ return new AutoKickImpl();
}
EventReturn OnCheckKick(User *u, Channel *c, Anope::string &mask, Anope::string &reason) override
diff --git a/modules/commands/cs_ban.cpp b/modules/commands/cs_ban.cpp
index a6a1f4af6..e85afc4a0 100644
--- a/modules/commands/cs_ban.cpp
+++ b/modules/commands/cs_ban.cpp
@@ -44,7 +44,7 @@ class CommandCSBan : public Command
{
const Anope::string &chan = params[0];
- ChannelInfo *ci = ChannelInfo::Find(chan);
+ ChanServ::Channel *ci = ChanServ::Find(chan);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str());
@@ -101,13 +101,13 @@ class CommandCSBan : public Command
User *u = source.GetUser();
User *u2 = User::Find(target, true);
- AccessGroup u_access = source.AccessFor(ci);
+ ChanServ::AccessGroup u_access = source.AccessFor(ci);
if (!u_access.HasPriv("BAN") && !source.HasPriv("chanserv/kick"))
source.Reply(ACCESS_DENIED);
else if (u2)
{
- AccessGroup u2_access = ci->AccessFor(u2);
+ ChanServ::AccessGroup u2_access = ci->AccessFor(u2);
if (u != u2 && ci->HasExt("PEACE") && u2_access >= u_access && !source.HasPriv("chanserv/kick"))
source.Reply(ACCESS_DENIED);
@@ -172,7 +172,7 @@ class CommandCSBan : public Command
{
++matched;
- AccessGroup u2_access = ci->AccessFor(uc->user);
+ ChanServ::AccessGroup u2_access = ci->AccessFor(uc->user);
if (matched > 1 && !founder)
continue;
diff --git a/modules/commands/cs_clone.cpp b/modules/commands/cs_clone.cpp
index e7102091a..bd7a6c990 100644
--- a/modules/commands/cs_clone.cpp
+++ b/modules/commands/cs_clone.cpp
@@ -11,6 +11,7 @@
#include "module.h"
#include "modules/bs_badwords.h"
+#include "modules/cs_akick.h"
class CommandCSClone : public Command
{
@@ -34,7 +35,7 @@ public:
}
User *u = source.GetUser();
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
bool override = false;
if (ci == NULL)
@@ -43,7 +44,7 @@ public:
return;
}
- ChannelInfo *target_ci = ChannelInfo::Find(target);
+ ChanServ::Channel *target_ci = ChanServ::Find(target);
if (!target_ci)
{
source.Reply(CHAN_X_NOT_REGISTERED, target.c_str());
@@ -73,9 +74,10 @@ public:
if (what.empty())
{
delete target_ci;
- target_ci = new ChannelInfo(*ci);
+ target_ci = ChanServ::service->Create(*ci);
target_ci->name = target;
- (*RegisteredChannelList)[target_ci->name] = target_ci;
+ ChanServ::registered_channel_map& map = ChanServ::service->GetChannels();
+ map[target_ci->name] = target_ci;
target_ci->c = Channel::Find(target_ci->name);
target_ci->bi = NULL;
@@ -115,8 +117,8 @@ public:
for (unsigned i = 0; i < ci->GetAccessCount(); ++i)
{
- const ChanAccess *taccess = ci->GetAccess(i);
- AccessProvider *provider = taccess->provider;
+ const ChanServ::ChanAccess *taccess = ci->GetAccess(i);
+ ChanServ::AccessProvider *provider = taccess->provider;
if (access_max && target_ci->GetDeepAccessCount() >= access_max)
break;
@@ -125,7 +127,7 @@ public:
continue;
masks.insert(taccess->mask);
- ChanAccess *newaccess = provider->Create();
+ ChanServ::ChanAccess *newaccess = provider->Create();
newaccess->ci = target_ci;
newaccess->mask = taccess->mask;
newaccess->creator = taccess->creator;
@@ -145,11 +147,11 @@ public:
target_ci->ClearAkick();
for (unsigned i = 0; i < ci->GetAkickCount(); ++i)
{
- const AutoKick *akick = ci->GetAkick(i);
- if (akick->nc)
- target_ci->AddAkick(akick->creator, akick->nc, akick->reason, akick->addtime, akick->last_used);
+ const AutoKick *ak = ci->GetAkick(i);
+ if (ak->nc)
+ target_ci->AddAkick(ak->creator, ak->nc, ak->reason, ak->addtime, ak->last_used);
else
- target_ci->AddAkick(akick->creator, akick->mask, akick->reason, akick->addtime, akick->last_used);
+ target_ci->AddAkick(ak->creator, ak->mask, ak->reason, ak->addtime, ak->last_used);
}
source.Reply(_("All akick entries from \002%s\002 have been cloned to \002%s\002."), channel.c_str(), target.c_str());
diff --git a/modules/commands/cs_drop.cpp b/modules/commands/cs_drop.cpp
index 3b6c82ed0..55a28f294 100644
--- a/modules/commands/cs_drop.cpp
+++ b/modules/commands/cs_drop.cpp
@@ -33,7 +33,7 @@ class CommandCSDrop : public Command
return;
}
- ChannelInfo *ci = ChannelInfo::Find(chan);
+ ChanServ::Channel *ci = ChanServ::Find(chan);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
diff --git a/modules/commands/cs_enforce.cpp b/modules/commands/cs_enforce.cpp
index aa710ef03..52b9093ca 100644
--- a/modules/commands/cs_enforce.cpp
+++ b/modules/commands/cs_enforce.cpp
@@ -16,7 +16,7 @@
class CommandCSEnforce : public Command
{
private:
- void DoSecureOps(CommandSource &source, ChannelInfo *ci)
+ void DoSecureOps(CommandSource &source, ChanServ::Channel *ci)
{
bool override = !source.AccessFor(ci).HasPriv("AKICK") && source.HasPriv("chanserv/access/modify");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enforce secureops";
@@ -42,7 +42,7 @@ class CommandCSEnforce : public Command
source.Reply(_("Secureops enforced on %s."), ci->name.c_str());
}
- void DoRestricted(CommandSource &source, ChannelInfo *ci)
+ void DoRestricted(CommandSource &source, ChanServ::Channel *ci)
{
bool override = !source.AccessFor(ci).HasPriv("AKICK") && source.HasPriv("chanserv/access/modify");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enforce restricted";
@@ -61,7 +61,7 @@ class CommandCSEnforce : public Command
}
for (unsigned i = 0; i < users.size(); ++i)
- {
+ {
User *user = users[i];
Anope::string mask = ci->GetIdealBan(user);
@@ -73,7 +73,7 @@ class CommandCSEnforce : public Command
source.Reply(_("Restricted enforced on %s."), ci->name.c_str());
}
- void DoRegOnly(CommandSource &source, ChannelInfo *ci)
+ void DoRegOnly(CommandSource &source, ChanServ::Channel *ci)
{
bool override = !source.AccessFor(ci).HasPriv("AKICK") && source.HasPriv("chanserv/access/modify");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enforce registered only";
@@ -105,7 +105,7 @@ class CommandCSEnforce : public Command
source.Reply(_("Registered only enforced on %s."), ci->name.c_str());
}
- void DoSSLOnly(CommandSource &source, ChannelInfo *ci)
+ void DoSSLOnly(CommandSource &source, ChanServ::Channel *ci)
{
bool override = !source.AccessFor(ci).HasPriv("AKICK") && source.HasPriv("chanserv/access/modify");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enforce SSL only";
@@ -137,7 +137,7 @@ class CommandCSEnforce : public Command
source.Reply(_("SSL only enforced on %s."), ci->name.c_str());
}
- void DoBans(CommandSource &source, ChannelInfo *ci)
+ void DoBans(CommandSource &source, ChanServ::Channel *ci)
{
bool override = !source.AccessFor(ci).HasPriv("AKICK") && source.HasPriv("chanserv/access/modify");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enforce bans";
@@ -158,7 +158,7 @@ class CommandCSEnforce : public Command
for (unsigned i = 0; i < users.size(); ++i)
{
User *user = users[i];
-
+
Anope::string reason = Language::Translate(user, _("BANS enforced by ")) + source.GetNick();
ci->c->Kick(NULL, user, "%s", reason.c_str());
}
@@ -166,7 +166,7 @@ class CommandCSEnforce : public Command
source.Reply(_("Bans enforced on %s."), ci->name.c_str());
}
- void DoLimit(CommandSource &source, ChannelInfo *ci)
+ void DoLimit(CommandSource &source, ChanServ::Channel *ci)
{
bool override = !source.AccessFor(ci).HasPriv("AKICK") && source.HasPriv("chanserv/access/modify");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enforce limit";
@@ -213,7 +213,7 @@ class CommandCSEnforce : public Command
for (unsigned i = 0; i < users.size(); ++i)
{
User *user = users[i];
-
+
Anope::string reason = Language::Translate(user, _("LIMIT enforced by ")) + source.GetNick();
ci->c->Kick(NULL, user, "%s", reason.c_str());
}
@@ -232,7 +232,7 @@ class CommandCSEnforce : public Command
{
const Anope::string &what = params.size() > 1 ? params[1] : "";
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (!ci)
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
diff --git a/modules/commands/cs_entrymsg.cpp b/modules/commands/cs_entrymsg.cpp
index 676d7b74a..8e196d18b 100644
--- a/modules/commands/cs_entrymsg.cpp
+++ b/modules/commands/cs_entrymsg.cpp
@@ -18,7 +18,7 @@ struct EntryMsgImpl : EntryMsg, Serializable
{
}
- EntryMsgImpl(ChannelInfo *c, const Anope::string &cname, const Anope::string &cmessage, time_t ct = Anope::CurTime) : Serializable("EntryMsg")
+ EntryMsgImpl(ChanServ::Channel *c, const Anope::string &cname, const Anope::string &cmessage, time_t ct = Anope::CurTime) : Serializable("EntryMsg")
{
this->chan = c->name;
this->creator = cname;
@@ -51,7 +51,7 @@ struct EntryMessageListImpl : EntryMessageList
EntryMsgImpl::~EntryMsgImpl()
{
- ChannelInfo *ci = ChannelInfo::Find(this->chan);
+ ChanServ::Channel *ci = ChanServ::Find(this->chan);
if (!ci)
return;
@@ -74,7 +74,7 @@ Serializable* EntryMsgImpl::Unserialize(Serializable *obj, Serialize::Data &data
data["creator"] >> screator;
data["message"] >> smessage;
- ChannelInfo *ci = ChannelInfo::Find(sci);
+ ChanServ::Channel *ci = ChanServ::Find(sci);
if (!ci)
return NULL;
@@ -100,7 +100,7 @@ Serializable* EntryMsgImpl::Unserialize(Serializable *obj, Serialize::Data &data
class CommandEntryMessage : public Command
{
private:
- void DoList(CommandSource &source, ChannelInfo *ci)
+ void DoList(CommandSource &source, ChanServ::Channel *ci)
{
EntryMessageList *messages = ci->Require<EntryMessageList>("entrymsg");
@@ -133,8 +133,8 @@ class CommandEntryMessage : public Command
source.Reply(_("End of entry message list."));
}
-
- void DoAdd(CommandSource &source, ChannelInfo *ci, const Anope::string &message)
+
+ void DoAdd(CommandSource &source, ChanServ::Channel *ci, const Anope::string &message)
{
EntryMessageList *messages = ci->Require<EntryMessageList>("entrymsg");
@@ -148,7 +148,7 @@ class CommandEntryMessage : public Command
}
}
- void DoDel(CommandSource &source, ChannelInfo *ci, const Anope::string &message)
+ void DoDel(CommandSource &source, ChanServ::Channel *ci, const Anope::string &message)
{
EntryMessageList *messages = ci->Require<EntryMessageList>("entrymsg");
@@ -179,7 +179,7 @@ class CommandEntryMessage : public Command
}
}
- void DoClear(CommandSource &source, ChannelInfo *ci)
+ void DoClear(CommandSource &source, ChanServ::Channel *ci)
{
ci->Shrink<EntryMessageList>("entrymsg");
@@ -199,7 +199,7 @@ class CommandEntryMessage : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
diff --git a/modules/commands/cs_flags.cpp b/modules/commands/cs_flags.cpp
index 1298f74c5..2c5cfa547 100644
--- a/modules/commands/cs_flags.cpp
+++ b/modules/commands/cs_flags.cpp
@@ -13,12 +13,12 @@
static std::map<Anope::string, char> defaultFlags;
-class FlagsChanAccess : public ChanAccess
+class FlagsChanAccess : public ChanServ::ChanAccess
{
public:
std::set<char> flags;
- FlagsChanAccess(AccessProvider *p) : ChanAccess(p)
+ FlagsChanAccess(ChanServ::AccessProvider *p) : ChanAccess(p)
{
}
@@ -41,11 +41,11 @@ class FlagsChanAccess : public ChanAccess
this->flags.insert(data[i - 1]);
}
- static Anope::string DetermineFlags(const ChanAccess *access)
+ static Anope::string DetermineFlags(const ChanServ::ChanAccess *access)
{
if (access->provider->name == "access/flags")
return access->AccessSerialize();
-
+
std::set<char> buffer;
for (std::map<Anope::string, char>::iterator it = defaultFlags.begin(), it_end = defaultFlags.end(); it != it_end; ++it)
@@ -59,17 +59,17 @@ class FlagsChanAccess : public ChanAccess
}
};
-class FlagsAccessProvider : public AccessProvider
+class FlagsAccessProvider : public ChanServ::AccessProvider
{
public:
static FlagsAccessProvider *ap;
- FlagsAccessProvider(Module *o) : AccessProvider(o, "access/flags")
+ FlagsAccessProvider(Module *o) : ChanServ::AccessProvider(o, "access/flags")
{
ap = this;
}
- ChanAccess *Create() override
+ ChanServ::ChanAccess *Create() override
{
return new FlagsChanAccess(this);
}
@@ -78,7 +78,7 @@ FlagsAccessProvider* FlagsAccessProvider::ap;
class CommandCSFlags : public Command
{
- void DoModify(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
+ void DoModify(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
{
Anope::string mask = params.size() > 2 ? params[2] : "";
Anope::string flags = params.size() > 3 ? params[3] : "";
@@ -89,8 +89,8 @@ class CommandCSFlags : public Command
return;
}
- AccessGroup u_access = source.AccessFor(ci);
- const ChanAccess *highest = u_access.Highest();
+ ChanServ::AccessGroup u_access = source.AccessFor(ci);
+ const ChanServ::ChanAccess *highest = u_access.Highest();
if (IRCD->IsChannelValid(mask))
{
@@ -100,7 +100,7 @@ class CommandCSFlags : public Command
return;
}
- ChannelInfo *targ_ci = ChannelInfo::Find(mask);
+ ChanServ::Channel *targ_ci = ChanServ::Find(mask);
if (targ_ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, mask.c_str());
@@ -116,7 +116,7 @@ class CommandCSFlags : public Command
}
else
{
- const NickAlias *na = NickAlias::Find(mask);
+ const NickServ::Nick *na = NickServ::FindNick(mask);
if (!na && Config->GetModule("chanserv")->Get<bool>("disallow_hostmask_access"))
{
source.Reply(_("Masks and unregistered users may not be on access lists."));
@@ -135,13 +135,13 @@ class CommandCSFlags : public Command
}
}
- ChanAccess *current = NULL;
+ ChanServ::ChanAccess *current = NULL;
unsigned current_idx;
std::set<char> current_flags;
bool override = false;
for (current_idx = ci->GetAccessCount(); current_idx > 0; --current_idx)
{
- ChanAccess *access = ci->GetAccess(current_idx - 1);
+ ChanServ::ChanAccess *access = ci->GetAccess(current_idx - 1);
if (mask.equals_ci(access->mask))
{
// Flags allows removing others that have the same access as you,
@@ -174,7 +174,7 @@ class CommandCSFlags : public Command
return;
}
- Privilege *p = NULL;
+ ChanServ::Privilege *p = NULL;
bool add = true;
for (size_t i = 0; i < flags.length(); ++i)
{
@@ -210,7 +210,7 @@ class CommandCSFlags : public Command
}
break;
default:
- p = PrivilegeManager::FindPrivilege(flags.substr(i));
+ p = ChanServ::service ? ChanServ::service->FindPrivilege(flags.substr(i)) : nullptr;
if (p != NULL && defaultFlags[p->name])
{
f = defaultFlags[p->name];
@@ -256,7 +256,7 @@ class CommandCSFlags : public Command
return;
}
- ServiceReference<AccessProvider> provider("AccessProvider", "access/flags");
+ ServiceReference<ChanServ::AccessProvider> provider("AccessProvider", "access/flags");
if (!provider)
return;
FlagsChanAccess *access = anope_dynamic_static_cast<FlagsChanAccess *>(provider->Create());
@@ -286,7 +286,7 @@ class CommandCSFlags : public Command
source.Reply(_("Flags for \002%s\002 on %s set to +\002%s\002"), access->mask.c_str(), ci->name.c_str(), access->AccessSerialize().c_str());
}
- void DoList(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
+ void DoList(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
{
const Anope::string &arg = params.size() > 2 ? params[2] : "";
@@ -303,7 +303,7 @@ class CommandCSFlags : public Command
unsigned count = 0;
for (unsigned i = 0, end = ci->GetAccessCount(); i < end; ++i)
{
- const ChanAccess *access = ci->GetAccess(i);
+ const ChanServ::ChanAccess *access = ci->GetAccess(i);
const Anope::string &flags = FlagsChanAccess::DetermineFlags(access);
if (!arg.empty())
@@ -348,7 +348,7 @@ class CommandCSFlags : public Command
}
}
- void DoClear(CommandSource &source, ChannelInfo *ci)
+ void DoClear(CommandSource &source, ChanServ::Channel *ci)
{
if (!source.IsFounder(ci) && !source.HasPriv("chanserv/access/modify"))
source.Reply(ACCESS_DENIED);
@@ -381,7 +381,7 @@ class CommandCSFlags : public Command
const Anope::string &chan = params[0];
const Anope::string &cmd = params.size() > 1 ? params[1] : "";
- ChannelInfo *ci = ChannelInfo::Find(chan);
+ ChanServ::Channel *ci = ChanServ::Find(chan);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str());
@@ -441,7 +441,7 @@ class CommandCSFlags : public Command
for (reverse_map::iterator it = reverse.begin(), it_end = reverse.end(); it != it_end; ++it)
{
- Privilege *p = PrivilegeManager::FindPrivilege(it->second);
+ ChanServ::Privilege *p = ChanServ::service ? ChanServ::service->FindPrivilege(it->second) : nullptr;
if (p == NULL)
continue;
source.Reply(" %c - %s", it->first, Language::Translate(source.nc, p->desc.c_str()));
@@ -475,7 +475,7 @@ class CSFlags : public Module
const Anope::string &pname = priv->Get<const Anope::string>("name");
- Privilege *p = PrivilegeManager::FindPrivilege(pname);
+ ChanServ::Privilege *p = ChanServ::service ? ChanServ::service->FindPrivilege(pname) : nullptr;
if (p == NULL)
continue;
diff --git a/modules/commands/cs_getkey.cpp b/modules/commands/cs_getkey.cpp
index 6b714d093..122035acc 100644
--- a/modules/commands/cs_getkey.cpp
+++ b/modules/commands/cs_getkey.cpp
@@ -24,7 +24,7 @@ class CommandCSGetKey : public Command
{
const Anope::string &chan = params[0];
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
diff --git a/modules/commands/cs_info.cpp b/modules/commands/cs_info.cpp
index d0ae17a7e..2b974ef1d 100644
--- a/modules/commands/cs_info.cpp
+++ b/modules/commands/cs_info.cpp
@@ -28,8 +28,8 @@ class CommandCSInfo : public Command
{
const Anope::string &chan = params[0];
- NickCore *nc = source.nc;
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ NickServ::Account *nc = source.nc;
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
diff --git a/modules/commands/cs_invite.cpp b/modules/commands/cs_invite.cpp
index 6f19042cc..9e0168b53 100644
--- a/modules/commands/cs_invite.cpp
+++ b/modules/commands/cs_invite.cpp
@@ -33,7 +33,7 @@ class CommandCSInvite : public Command
return;
}
- ChannelInfo *ci = c->ci;
+ ChanServ::Channel *ci = c->ci;
if (!ci)
{
source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str());
diff --git a/modules/commands/cs_kick.cpp b/modules/commands/cs_kick.cpp
index bfaec6a29..9828c79fa 100644
--- a/modules/commands/cs_kick.cpp
+++ b/modules/commands/cs_kick.cpp
@@ -28,7 +28,7 @@ class CommandCSKick : public Command
Anope::string reason = params.size() > 2 ? params[2] : "Requested";
User *u = source.GetUser();
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
Channel *c = Channel::Find(params[0]);
User *u2 = User::Find(target, true);
@@ -47,13 +47,13 @@ class CommandCSKick : public Command
if (reason.length() > reasonmax)
reason = reason.substr(0, reasonmax);
- AccessGroup u_access = source.AccessFor(ci);
+ ChanServ::AccessGroup u_access = source.AccessFor(ci);
if (!u_access.HasPriv("KICK") && !source.HasPriv("chanserv/kick"))
source.Reply(ACCESS_DENIED);
else if (u2)
{
- AccessGroup u2_access = ci->AccessFor(u2);
+ ChanServ::AccessGroup u2_access = ci->AccessFor(u2);
if (u != u2 && ci->HasExt("PEACE") && u2_access >= u_access && !source.HasPriv("chanserv/kick"))
source.Reply(ACCESS_DENIED);
else if (u2->IsProtected())
@@ -85,7 +85,7 @@ class CommandCSKick : public Command
{
++matched;
- AccessGroup u2_access = ci->AccessFor(uc->user);
+ ChanServ::AccessGroup u2_access = ci->AccessFor(uc->user);
if (u != uc->user && ci->HasExt("PEACE") && u2_access >= u_access)
continue;
else if (uc->user->IsProtected())
diff --git a/modules/commands/cs_list.cpp b/modules/commands/cs_list.cpp
index 68cca6d42..f97e6e065 100644
--- a/modules/commands/cs_list.cpp
+++ b/modules/commands/cs_list.cpp
@@ -75,13 +75,14 @@ class CommandCSList : public Command
ListFormatter list(source.GetAccount());
list.AddColumn(_("Name")).AddColumn(_("Description"));
- Anope::map<ChannelInfo *> ordered_map;
- for (registered_channel_map::const_iterator it = RegisteredChannelList->begin(), it_end = RegisteredChannelList->end(); it != it_end; ++it)
- ordered_map[it->first] = it->second;
+ Anope::map<ChanServ::Channel *> ordered_map;
+ if (ChanServ::service)
+ for (auto& it : ChanServ::service->GetChannels())
+ ordered_map[it.first] = it.second;
- for (Anope::map<ChannelInfo *>::const_iterator it = ordered_map.begin(), it_end = ordered_map.end(); it != it_end; ++it)
+ for (Anope::map<ChanServ::Channel *>::const_iterator it = ordered_map.begin(), it_end = ordered_map.end(); it != it_end; ++it)
{
- const ChannelInfo *ci = it->second;
+ const ChanServ::Channel *ci = it->second;
if (!is_servadmin)
{
@@ -185,7 +186,7 @@ class CommandCSSetPrivate : public Command
return;
}
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
@@ -225,7 +226,7 @@ class CommandCSSetPrivate : public Command
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Enables or disables the \002private\002 option for a channel."));
-
+
BotInfo *bi;
Anope::string cmd;
if (Command::FindCommandFromService("chanserv/list", bi, cmd))
@@ -252,7 +253,7 @@ class CSList : public Module
{
}
- void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool show_all) override
+ void OnChanInfo(CommandSource &source, ChanServ::Channel *ci, InfoFormatter &info, bool show_all) override
{
if (!show_all)
return;
diff --git a/modules/commands/cs_log.cpp b/modules/commands/cs_log.cpp
index 678a2fd5f..39e6a31b5 100644
--- a/modules/commands/cs_log.cpp
+++ b/modules/commands/cs_log.cpp
@@ -21,7 +21,7 @@ struct LogSettingImpl : LogSetting, Serializable
~LogSettingImpl()
{
- ChannelInfo *ci = ChannelInfo::Find(chan);
+ ChanServ::Channel *ci = ChanServ::Find(chan);
if (ci)
{
LogSettings *ls = ci->GetExt<LogSettings>("logsettings");
@@ -51,10 +51,10 @@ struct LogSettingImpl : LogSetting, Serializable
Anope::string sci;
data["ci"] >> sci;
- ChannelInfo *ci = ChannelInfo::Find(sci);
+ ChanServ::Channel *ci = ChanServ::Find(sci);
if (ci == NULL)
return NULL;
-
+
LogSettingImpl *ls;
if (obj)
ls = anope_dynamic_static_cast<LogSettingImpl *>(obj);
@@ -112,7 +112,7 @@ public:
{
const Anope::string &channel = params[0];
- ChannelInfo *ci = ChannelInfo::Find(channel);
+ ChanServ::Channel *ci = ChanServ::Find(channel);
if (ci == NULL)
source.Reply(CHAN_X_NOT_REGISTERED, channel.c_str());
else if (!source.AccessFor(ci).HasPriv("SET") && !source.HasPriv("chanserv/administration"))
@@ -325,7 +325,7 @@ class CSLog : public Module
}
}
- void OnChanRegistered(ChannelInfo *ci) override
+ void OnChanRegistered(ChanServ::Channel *ci) override
{
if (defaults.empty())
return;
@@ -393,7 +393,7 @@ class CSLog : public Module
else if (log->method.equals_ci("MESSAGE") && l->ci->c)
{
IRCD->SendPrivmsg(l->ci->WhoSends(), log->extra + l->ci->c->name, "%s", buffer.c_str());
- l->ci->WhoSends()->lastmsg = Anope::CurTime;
+ //l->ci->WhoSends()->lastmsg = Anope::CurTime;
}
else if (log->method.equals_ci("NOTICE") && l->ci->c)
IRCD->SendNotice(l->ci->WhoSends(), log->extra + l->ci->c->name, "%s", buffer.c_str());
diff --git a/modules/commands/cs_mode.cpp b/modules/commands/cs_mode.cpp
index 2e858b382..9750cc031 100644
--- a/modules/commands/cs_mode.cpp
+++ b/modules/commands/cs_mode.cpp
@@ -23,7 +23,7 @@ struct ModeLockImpl : ModeLock, Serializable
~ModeLockImpl()
{
- ChannelInfo *chan = ChannelInfo::Find(ci);
+ ChanServ::Channel *chan = ChanServ::Find(ci);
if (chan)
{
ModeLocks *ml = chan->GetExt<ModeLocks>("modelocks");
@@ -38,10 +38,10 @@ struct ModeLockImpl : ModeLock, Serializable
struct ModeLocksImpl : ModeLocks
{
- Serialize::Reference<ChannelInfo> ci;
+ Serialize::Reference<ChanServ::Channel> ci;
Serialize::Checker<ModeList> mlocks;
- ModeLocksImpl(Extensible *obj) : ci(anope_dynamic_static_cast<ChannelInfo *>(obj)), mlocks("ModeLock")
+ ModeLocksImpl(Extensible *obj) : ci(anope_dynamic_static_cast<ChanServ::Channel *>(obj)), mlocks("ModeLock")
{
}
@@ -224,13 +224,13 @@ void ModeLockImpl::Serialize(Serialize::Data &data) const
Serializable* ModeLockImpl::Unserialize(Serializable *obj, Serialize::Data &data)
{
Anope::string sci;
-
+
data["ci"] >> sci;
- ChannelInfo *ci = ChannelInfo::Find(sci);
+ ChanServ::Channel *ci = ChanServ::Find(sci);
if (!ci)
return NULL;
-
+
ModeLockImpl *ml;
if (obj)
ml = anope_dynamic_static_cast<ModeLockImpl *>(obj);
@@ -254,7 +254,7 @@ Serializable* ModeLockImpl::Unserialize(Serializable *obj, Serialize::Data &data
class CommandCSMode : public Command
{
- bool CanSet(CommandSource &source, ChannelInfo *ci, ChannelMode *cm, bool self)
+ bool CanSet(CommandSource &source, ChanServ::Channel *ci, ChannelMode *cm, bool self)
{
if (!ci || !cm || cm->type != MODE_STATUS)
return false;
@@ -262,7 +262,7 @@ class CommandCSMode : public Command
return source.AccessFor(ci).HasPriv(cm->name + (self ? "ME" : ""));
}
- void DoLock(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
+ void DoLock(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
{
User *u = source.GetUser();
const Anope::string &subcommand = params[2];
@@ -332,7 +332,7 @@ class CommandCSMode : public Command
source.Reply(_("List for mode %c is full."), cm->mchar);
else
{
- modelocks->SetMLock(cm, adding, mode_param, source.GetNick());
+ modelocks->SetMLock(cm, adding, mode_param, source.GetNick());
if (adding)
{
@@ -460,8 +460,8 @@ class CommandCSMode : public Command
else
this->OnSyntaxError(source, subcommand);
}
-
- void DoSet(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
+
+ void DoSet(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
{
User *u = source.GetUser();
@@ -536,7 +536,7 @@ class CommandCSMode : public Command
if (!sep.GetToken(param))
param = source.GetNick();
- AccessGroup u_access = source.AccessFor(ci);
+ ChanServ::AccessGroup u_access = source.AccessFor(ci);
if (param.find_first_of("*?") != Anope::string::npos)
{
@@ -551,7 +551,7 @@ class CommandCSMode : public Command
ChanUserContainer *uc = it->second;
++it;
- AccessGroup targ_access = ci->AccessFor(uc->user);
+ ChanServ::AccessGroup targ_access = ci->AccessFor(uc->user);
if (uc->user->IsProtected() || (ci->HasExt("PEACE") && targ_access >= u_access && !can_override))
{
@@ -585,7 +585,7 @@ class CommandCSMode : public Command
if (source.GetUser() != target)
{
- AccessGroup targ_access = ci->AccessFor(target);
+ ChanServ::AccessGroup targ_access = ci->AccessFor(target);
if (ci->HasExt("PEACE") && targ_access >= u_access && !can_override)
{
source.Reply(_("You do not have the access to change %s's modes."), target->nick.c_str());
@@ -632,7 +632,7 @@ class CommandCSMode : public Command
}
}
- void DoClear(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
+ void DoClear(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
{
const Anope::string &param = params.size() > 2 ? params[2] : "";
@@ -689,7 +689,7 @@ class CommandCSMode : public Command
{
const Anope::string &subcommand = params[1];
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (!ci)
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
@@ -760,7 +760,7 @@ class CommandCSModes : public Command
{
User *u = source.GetUser(),
*targ = params.size() > 1 ? User::Find(params[1], true) : u;
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (!targ)
{
@@ -780,7 +780,7 @@ class CommandCSModes : public Command
return;
}
- AccessGroup u_access = source.AccessFor(ci), targ_access = ci->AccessFor(targ);
+ ChanServ::AccessGroup u_access = source.AccessFor(ci), targ_access = ci->AccessFor(targ);
const std::pair<bool, Anope::string> &m = modes[source.command];
bool can_override = source.HasPriv("chanserv/administration");
@@ -791,7 +791,7 @@ class CommandCSModes : public Command
source.Reply(ACCESS_DENIED);
return;
}
-
+
if (u == targ ? !u_access.HasPriv(m.second + "ME") : !u_access.HasPriv(m.second))
{
if (!can_override)
@@ -898,7 +898,7 @@ class CSMode : public Module
for (int i = 0; i < conf->CountBlock("command"); ++i)
{
Configuration::Block *block = conf->GetBlock("command", i);
-
+
const Anope::string &cname = block->Get<const Anope::string>("name"),
&cmd = block->Get<const Anope::string>("command");
@@ -907,7 +907,7 @@ class CSMode : public Module
const Anope::string &set = block->Get<const Anope::string>("set"),
&unset = block->Get<const Anope::string>("unset");
-
+
if (set.empty() && unset.empty())
continue;
@@ -952,7 +952,7 @@ class CSMode : public Module
if (c->HasMode(cm->name))
c->RemoveMode(NULL, cm, "", false);
}
-
+
}
else if (cm->type == MODE_LIST || cm->type == MODE_STATUS)
{
@@ -964,7 +964,7 @@ class CSMode : public Module
}
}
- void OnCreateChan(ChannelInfo *ci) override
+ void OnCreateChan(ChanServ::Channel *ci) override
{
ModeLocks *ml = modelocks.Require(ci);
Anope::string mlock;
@@ -990,7 +990,7 @@ class CSMode : public Module
ml->Check();
}
- void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool show_hidden) override
+ void OnChanInfo(CommandSource &source, ChanServ::Channel *ci, InfoFormatter &info, bool show_hidden) override
{
if (!show_hidden)
return;
diff --git a/modules/commands/cs_register.cpp b/modules/commands/cs_register.cpp
index 7b2899939..4e584b51c 100644
--- a/modules/commands/cs_register.cpp
+++ b/modules/commands/cs_register.cpp
@@ -27,9 +27,9 @@ class CommandCSRegister : public Command
unsigned maxregistered = Config->GetModule("chanserv")->Get<unsigned>("maxregistered");
User *u = source.GetUser();
- NickCore *nc = source.nc;
+ NickServ::Account *nc = source.nc;
Channel *c = Channel::Find(params[0]);
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (Anope::ReadOnly)
source.Reply(_("Sorry, channel registration is temporarily disabled."));
@@ -51,7 +51,9 @@ class CommandCSRegister : public Command
source.Reply(nc->channelcount > maxregistered ? CHAN_EXCEEDED_CHANNEL_LIMIT : CHAN_REACHED_CHANNEL_LIMIT, maxregistered);
else
{
- ci = new ChannelInfo(chan);
+ if (!ChanServ::service)
+ return;
+ ci = ChanServ::service->Create(chan);
ci->SetFounder(nc);
ci->desc = chdesc;
diff --git a/modules/commands/cs_seen.cpp b/modules/commands/cs_seen.cpp
index 595b999c9..873457b3a 100644
--- a/modules/commands/cs_seen.cpp
+++ b/modules/commands/cs_seen.cpp
@@ -58,7 +58,7 @@ struct SeenInfo : Serializable
static Serializable* Unserialize(Serializable *obj, Serialize::Data &data)
{
Anope::string snick;
-
+
data["nick"] >> snick;
SeenInfo *s;
@@ -99,7 +99,7 @@ static SeenInfo *FindInfo(const Anope::string &nick)
static bool ShouldHide(const Anope::string &channel, User *u)
{
Channel *targetchan = Channel::Find(channel);
- const ChannelInfo *targetchan_ci = targetchan ? *targetchan->ci : ChannelInfo::Find(channel);
+ const ChanServ::Channel *targetchan_ci = targetchan ? *targetchan->ci : ChanServ::Find(channel);
if (targetchan && targetchan->HasMode("SECRET"))
return true;
@@ -202,7 +202,7 @@ class CommandSeen : public Command
return;
}
- NickAlias *na = NickAlias::Find(params[0]);
+ NickServ::Nick *na = NickServ::FindNick(params[0]);
if (!na)
{
source.Reply(_("I don't know who %s is."), params[0].c_str());
@@ -235,11 +235,11 @@ class CommandSeen : public Command
}
}
- AccessGroup ag = source.c->ci->AccessFor(na->nc);
+ ChanServ::AccessGroup ag = source.c->ci->AccessFor(na->nc);
time_t last = 0;
for (unsigned i = 0; i < ag.size(); ++i)
{
- ChanAccess *a = ag[i];
+ ChanServ::ChanAccess *a = ag[i];
if (*a->nc == na->nc && a->last_seen > last)
last = a->last_seen;
@@ -378,7 +378,7 @@ class CSSeen : public Module
Serialize::Type seeninfo_type;
CommandSeen commandseen;
CommandOSSeen commandosseen;
-
+
public:
CSSeen(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR)
, EventHook<Event::ExpireTick>("OnExpireTick")
@@ -446,9 +446,10 @@ class CSSeen : public Module
UpdateUser(u, PART, u->nick, "", channel, msg);
}
- void OnPreUserKicked(const MessageSource &source, ChanUserContainer *cu, const Anope::string &msg) override
+ EventReturn OnPreUserKicked(const MessageSource &source, ChanUserContainer *cu, const Anope::string &msg) override
{
UpdateUser(cu->user, KICK, cu->user->nick, source.GetSource(), cu->chan->name, msg);
+ return EVENT_CONTINUE;
}
private:
diff --git a/modules/commands/cs_set.cpp b/modules/commands/cs_set.cpp
index 4cef222a4..21969833d 100644
--- a/modules/commands/cs_set.cpp
+++ b/modules/commands/cs_set.cpp
@@ -83,7 +83,7 @@ class CommandCSSetAutoOp : public Command
return;
}
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
@@ -145,7 +145,7 @@ class CommandCSSetBanType : public Command
return;
}
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
@@ -212,7 +212,7 @@ class CommandCSSetDescription : public Command
return;
}
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
const Anope::string &param = params.size() > 1 ? params[1] : "";
if (ci == NULL)
{
@@ -274,7 +274,7 @@ class CommandCSSetFounder : public Command
return;
}
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
@@ -292,14 +292,14 @@ class CommandCSSetFounder : public Command
return;
}
- const NickAlias *na = NickAlias::Find(params[1]);
+ const NickServ::Nick *na = NickServ::FindNick(params[1]);
if (!na)
{
source.Reply(NICK_X_NOT_REGISTERED, params[1].c_str());
return;
}
- NickCore *nc = na->nc;
+ NickServ::Account *nc = na->nc;
unsigned max_reg = Config->GetModule("chanserv")->Get<unsigned>("maxregistered");
if (max_reg && nc->channelcount >= max_reg && !source.HasPriv("chanserv/no-register-limit"))
{
@@ -343,7 +343,7 @@ class CommandCSSetKeepModes : public Command
return;
}
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
@@ -408,7 +408,7 @@ class CommandCSSetPeace : public Command
return;
}
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
@@ -480,7 +480,7 @@ class CommandCSSetPersist : public Command
return;
}
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
@@ -643,7 +643,7 @@ class CommandCSSetRestricted : public Command
return;
}
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
@@ -705,7 +705,7 @@ class CommandCSSetSecure : public Command
return;
}
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
@@ -769,7 +769,7 @@ class CommandCSSetSecureFounder : public Command
return;
}
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
@@ -833,7 +833,7 @@ class CommandCSSetSecureOps : public Command
return;
}
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
@@ -895,7 +895,7 @@ class CommandCSSetSignKick : public Command
return;
}
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
@@ -972,7 +972,7 @@ class CommandCSSetSuccessor : public Command
return;
}
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
const Anope::string &param = params.size() > 1 ? params[1] : "";
if (ci == NULL)
{
@@ -991,11 +991,11 @@ class CommandCSSetSuccessor : public Command
return;
}
- NickCore *nc;
+ NickServ::Account *nc;
if (!param.empty())
{
- const NickAlias *na = NickAlias::Find(param);
+ const NickServ::Nick *na = NickServ::FindNick(param);
if (!na)
{
@@ -1058,7 +1058,7 @@ class CommandCSSetNoexpire : public Command
return;
}
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
@@ -1124,10 +1124,10 @@ class CSSet : public Module
{
SerializableExtensibleItem<bool>::ExtensibleSerialize(e, s, data);
- if (s->GetSerializableType()->GetName() != "ChannelInfo")
+ if (s->GetSerializableType()->GetName() != "ChanServ::Channel")
return;
- const ChannelInfo *ci = anope_dynamic_static_cast<const ChannelInfo *>(s);
+ const ChanServ::Channel *ci = anope_dynamic_static_cast<const ChanServ::Channel *>(s);
Anope::string modes;
for (Channel::ModeList::const_iterator it = ci->last_modes.begin(); it != ci->last_modes.end(); ++it)
{
@@ -1144,10 +1144,10 @@ class CSSet : public Module
{
SerializableExtensibleItem<bool>::ExtensibleUnserialize(e, s, data);
- if (s->GetSerializableType()->GetName() != "ChannelInfo")
+ if (s->GetSerializableType()->GetName() != "ChanServ::Channel")
return;
- ChannelInfo *ci = anope_dynamic_static_cast<ChannelInfo *>(s);
+ ChanServ::Channel *ci = anope_dynamic_static_cast<ChanServ::Channel *>(s);
Anope::string modes;
data["last_modes"] >> modes;
for (spacesepstream sep(modes); sep.GetToken(modes);)
@@ -1169,10 +1169,10 @@ class CSSet : public Module
{
SerializableExtensibleItem<bool>::ExtensibleUnserialize(e, s, data);
- if (s->GetSerializableType()->GetName() != "ChannelInfo" || !this->HasExt(e))
+ if (s->GetSerializableType()->GetName() != "ChanServ::Channel" || !this->HasExt(e))
return;
- ChannelInfo *ci = anope_dynamic_static_cast<ChannelInfo *>(s);
+ ChanServ::Channel *ci = anope_dynamic_static_cast<ChanServ::Channel *>(s);
if (ci->c)
return;
@@ -1272,7 +1272,7 @@ class CSSet : public Module
persist_lower_ts = conf->GetModule(this)->Get<bool>("persist_lower_ts");
}
- void OnCreateChan(ChannelInfo *ci) override
+ void OnCreateChan(ChanServ::Channel *ci) override
{
ci->bantype = Config->GetModule(this)->Get<int>("defbantype", "2");
}
@@ -1303,7 +1303,7 @@ class CSSet : public Module
return EVENT_CONTINUE;
}
- void OnDelChan(ChannelInfo *ci) override
+ void OnDelChan(ChanServ::Channel *ci) override
{
if (ci->c && persist.HasExt(ci))
ci->c->RemoveMode(ci->WhoSends(), "PERM", "", false);
@@ -1357,11 +1357,11 @@ class CSSet : public Module
}
}
- void OnSetCorrectModes(User *user, Channel *chan, AccessGroup &access, bool &give_modes, bool &take_modes) override
+ void OnSetCorrectModes(User *user, Channel *chan, ChanServ::AccessGroup &access, bool &give_modes, bool &take_modes) override
{
if (chan->ci)
{
- if (noautoop.HasExt(chan->ci))
+ if (noautoop.HasExt(chan->ci))
give_modes = false;
if (secureops.HasExt(chan->ci))
// This overrides what chanserv does because it is loaded after chanserv
@@ -1369,13 +1369,13 @@ class CSSet : public Module
}
}
- void OnPreChanExpire(ChannelInfo *ci, bool &expire) override
+ void OnPreChanExpire(ChanServ::Channel *ci, bool &expire) override
{
if (noexpire.HasExt(ci))
expire = false;
}
- void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool show_all) override
+ void OnChanInfo(CommandSource &source, ChanServ::Channel *ci, InfoFormatter &info, bool show_all) override
{
if (!show_all)
return;
diff --git a/modules/commands/cs_set_misc.cpp b/modules/commands/cs_set_misc.cpp
index 3d8dbb0dd..783dae8d7 100644
--- a/modules/commands/cs_set_misc.cpp
+++ b/modules/commands/cs_set_misc.cpp
@@ -36,7 +36,7 @@ struct CSMiscData : MiscData, Serializable
{
CSMiscData(Extensible *obj) : Serializable("CSMiscData") { }
- CSMiscData(ChannelInfo *c, const Anope::string &n, const Anope::string &d) : Serializable("CSMiscData")
+ CSMiscData(ChanServ::Channel *c, const Anope::string &n, const Anope::string &d) : Serializable("CSMiscData")
{
object = c->name;
name = n;
@@ -58,7 +58,7 @@ struct CSMiscData : MiscData, Serializable
data["name"] >> sname;
data["data"] >> sdata;
- ChannelInfo *ci = ChannelInfo::Find(sci);
+ ChanServ::Channel *ci = ChanServ::Find(sci);
if (ci == NULL)
return NULL;
@@ -105,7 +105,7 @@ class CommandCSSetMisc : public Command
return;
}
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
const Anope::string &param = params.size() > 1 ? params[1] : "";
if (ci == NULL)
{
@@ -206,7 +206,7 @@ class CSSetMisc : public Module
}
}
- void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool) override
+ void OnChanInfo(CommandSource &source, ChanServ::Channel *ci, InfoFormatter &info, bool) override
{
for (Anope::map<ExtensibleItem<CSMiscData> *>::iterator it = items.begin(); it != items.end(); ++it)
{
diff --git a/modules/commands/cs_status.cpp b/modules/commands/cs_status.cpp
index bd707d537..7b7415fdb 100644
--- a/modules/commands/cs_status.cpp
+++ b/modules/commands/cs_status.cpp
@@ -10,6 +10,7 @@
*/
#include "module.h"
+#include "modules/cs_akick.h"
class CommandCSStatus : public Command
{
@@ -24,7 +25,7 @@ public:
{
const Anope::string &channel = params[0];
- ChannelInfo *ci = ChannelInfo::Find(channel);
+ ChanServ::Channel *ci = ChanServ::Find(channel);
if (ci == NULL)
source.Reply(CHAN_X_NOT_REGISTERED, channel.c_str());
else if (!source.AccessFor(ci).HasPriv("ACCESS_CHANGE") && !source.HasPriv("chanserv/auspex"))
@@ -35,14 +36,14 @@ public:
if (params.size() > 1)
nick = params[1];
- AccessGroup ag;
+ ChanServ::AccessGroup ag;
User *u = User::Find(nick, true);
- NickAlias *na = NULL;
+ NickServ::Nick *na = NULL;
if (u != NULL)
ag = ci->AccessFor(u);
else
{
- na = NickAlias::Find(nick);
+ na = NickServ::FindNick(nick);
if (na != NULL)
ag = ci->AccessFor(na->nc);
}
@@ -59,7 +60,7 @@ public:
for (unsigned i = 0; i < ag.size(); ++i)
{
- ChanAccess *acc = ag[i];
+ ChanServ::ChanAccess *acc = ag[i];
source.Reply(_("\002%s\002 matches access entry %s, which has privilege %s."), nick.c_str(), acc->mask.c_str(), acc->AccessSerialize().c_str());
}
diff --git a/modules/commands/cs_suspend.cpp b/modules/commands/cs_suspend.cpp
index 7b604b250..411b141e6 100644
--- a/modules/commands/cs_suspend.cpp
+++ b/modules/commands/cs_suspend.cpp
@@ -38,7 +38,7 @@ struct CSSuspendInfo : SuspendInfo, Serializable
si = anope_dynamic_static_cast<CSSuspendInfo *>(obj);
else
{
- ChannelInfo *ci = ChannelInfo::Find(schan);
+ ChanServ::Channel *ci = ChanServ::Find(schan);
if (!ci)
return NULL;
si = ci->Extend<CSSuspendInfo>("CS_SUSPENDED");
@@ -58,7 +58,7 @@ class CommandCSSuspend : public Command
EventHandlers<Event::ChanSuspend> &onchansuspend;
public:
CommandCSSuspend(Module *creator, EventHandlers<Event::ChanSuspend> &event) : Command(creator, "chanserv/suspend", 2, 3), onchansuspend(event)
- {
+ {
this->SetDesc(_("Prevent a channel from being used preserving channel data and settings"));
this->SetSyntax(_("\037channel\037 [+\037expiry\037] [\037reason\037]"));
}
@@ -89,7 +89,7 @@ class CommandCSSuspend : public Command
if (Anope::ReadOnly)
source.Reply(READ_ONLY_MODE);
- ChannelInfo *ci = ChannelInfo::Find(chan);
+ ChanServ::Channel *ci = ChanServ::Find(chan);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str());
@@ -164,7 +164,7 @@ class CommandCSUnSuspend : public Command
if (Anope::ReadOnly)
source.Reply(READ_ONLY_MODE);
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
@@ -226,7 +226,7 @@ class CSSuspend : public Module
{
}
- void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool show_hidden) override
+ void OnChanInfo(CommandSource &source, ChanServ::Channel *ci, InfoFormatter &info, bool show_hidden) override
{
CSSuspendInfo *si = suspend.Get(ci);
if (si)
@@ -243,7 +243,7 @@ class CSSuspend : public Module
}
}
- void OnPreChanExpire(ChannelInfo *ci, bool &expire) override
+ void OnPreChanExpire(ChanServ::Channel *ci, bool &expire) override
{
CSSuspendInfo *si = suspend.Get(ci);
if (!si)
@@ -272,7 +272,7 @@ class CSSuspend : public Module
return EVENT_STOP;
}
- EventReturn OnChanDrop(CommandSource &source, ChannelInfo *ci) override
+ EventReturn OnChanDrop(CommandSource &source, ChanServ::Channel *ci) override
{
CSSuspendInfo *si = suspend.Get(ci);
if (si && !source.HasCommand("chanserv/drop"))
diff --git a/modules/commands/cs_sync.cpp b/modules/commands/cs_sync.cpp
index d26ff6a7a..20154c70a 100644
--- a/modules/commands/cs_sync.cpp
+++ b/modules/commands/cs_sync.cpp
@@ -22,7 +22,7 @@ class CommandCSSync : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
@@ -55,7 +55,7 @@ class CommandCSSync : public Command
class CSSync : public Module
{
CommandCSSync commandcssync;
-
+
public:
CSSync(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR)
, commandcssync(this)
diff --git a/modules/commands/cs_topic.cpp b/modules/commands/cs_topic.cpp
index 2fd1b0a81..0c0e56696 100644
--- a/modules/commands/cs_topic.cpp
+++ b/modules/commands/cs_topic.cpp
@@ -31,7 +31,7 @@ class CommandCSSetKeepTopic : public Command
return;
}
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
@@ -82,7 +82,7 @@ class CommandCSTopic : public Command
{
ExtensibleRef<bool> topiclock;
- void Lock(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
+ void Lock(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
{
if (Anope::ReadOnly)
{
@@ -99,7 +99,7 @@ class CommandCSTopic : public Command
source.Reply(_("Topic lock option for %s is now \002on\002."), ci->name.c_str());
}
- void Unlock(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
+ void Unlock(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
{
if (Anope::ReadOnly)
{
@@ -116,7 +116,7 @@ class CommandCSTopic : public Command
source.Reply(_("Topic lock option for %s is now \002off\002."), ci->name.c_str());
}
- void Set(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
+ void Set(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
{
const Anope::string &topic = params.size() > 2 ? params[2] : "";
@@ -125,12 +125,12 @@ class CommandCSTopic : public Command
ci->c->ChangeTopic(source.GetNick(), topic, Anope::CurTime);
if (has_topiclock)
topiclock->Set(ci);
-
+
bool override = !source.AccessFor(ci).HasPriv("TOPIC");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << (!topic.empty() ? "to change the topic to: " : "to unset the topic") << (!topic.empty() ? topic : "");
}
- void Append(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
+ void Append(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
{
const Anope::string &topic = params[2];
@@ -165,7 +165,7 @@ class CommandCSTopic : public Command
{
const Anope::string &subcmd = params[1];
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
else if (!source.AccessFor(ci).HasPriv("TOPIC") && !source.HasCommand("chanserv/topic"))
@@ -256,7 +256,7 @@ class CSTopic : public Module
}
}
- void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool show_all) override
+ void OnChanInfo(CommandSource &source, ChanServ::Channel *ci, InfoFormatter &info, bool show_all) override
{
if (keeptopic.HasExt(ci))
info.AddOption(_("Topic retention"));
diff --git a/modules/commands/cs_unban.cpp b/modules/commands/cs_unban.cpp
index f5e2a6460..a658c65dd 100644
--- a/modules/commands/cs_unban.cpp
+++ b/modules/commands/cs_unban.cpp
@@ -27,13 +27,13 @@ class CommandCSUnban : public Command
if (!source.GetUser())
return;
- std::deque<ChannelInfo *> queue;
+ std::deque<ChanServ::Channel *> queue;
source.GetAccount()->GetChannelReferences(queue);
unsigned count = 0;
for (unsigned i = 0; i < queue.size(); ++i)
{
- ChannelInfo *ci = queue[i];
+ ChanServ::Channel *ci = queue[i];
if (!ci->c || !source.AccessFor(ci).HasPriv("UNBAN"))
continue;
@@ -48,7 +48,7 @@ class CommandCSUnban : public Command
return;
}
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
diff --git a/modules/commands/cs_updown.cpp b/modules/commands/cs_updown.cpp
index 282eb1479..bf94b9c2d 100644
--- a/modules/commands/cs_updown.cpp
+++ b/modules/commands/cs_updown.cpp
@@ -22,7 +22,7 @@ class CommandCSUp : public Command
bool giving = true;
/* whether or not we have given a mode */
bool given = false;
- AccessGroup u_access = c->ci->AccessFor(u);
+ ChanServ::AccessGroup u_access = c->ci->AccessFor(u);
for (unsigned i = 0; i < ModeManager::GetStatusChannelModesByRank().size(); ++i)
{
@@ -160,7 +160,7 @@ class CommandCSDown : public Command
const Anope::string &nick = params.size() > 1 ? params[1] : source.GetNick();
Channel *c = Channel::Find(channel);
-
+
if (c == NULL)
{
source.Reply(CHAN_X_NOT_IN_USE, channel.c_str());
diff --git a/modules/commands/cs_xop.cpp b/modules/commands/cs_xop.cpp
index 84a8fbfb7..b2c554d71 100644
--- a/modules/commands/cs_xop.cpp
+++ b/modules/commands/cs_xop.cpp
@@ -17,12 +17,12 @@ namespace
std::map<Anope::string, std::vector<Anope::string> > permissions;
}
-class XOPChanAccess : public ChanAccess
+class XOPChanAccess : public ChanServ::ChanAccess
{
public:
Anope::string type;
- XOPChanAccess(AccessProvider *p) : ChanAccess(p)
+ XOPChanAccess(ChanServ::AccessProvider *p) : ChanAccess(p)
{
}
@@ -47,7 +47,7 @@ class XOPChanAccess : public ChanAccess
this->type = data;
}
- static Anope::string DetermineLevel(const ChanAccess *access)
+ static Anope::string DetermineLevel(const ChanServ::ChanAccess *access)
{
if (access->provider->name == "access/xop")
{
@@ -81,14 +81,14 @@ class XOPChanAccess : public ChanAccess
}
};
-class XOPAccessProvider : public AccessProvider
+class XOPAccessProvider : public ChanServ::AccessProvider
{
public:
XOPAccessProvider(Module *o) : AccessProvider(o, "access/xop")
{
}
- ChanAccess *Create() override
+ ChanServ::ChanAccess *Create() override
{
return new XOPChanAccess(this);
}
@@ -97,7 +97,7 @@ class XOPAccessProvider : public AccessProvider
class CommandCSXOP : public Command
{
private:
- void DoAdd(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
+ void DoAdd(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
{
Anope::string mask = params.size() > 2 ? params[2] : "";
@@ -117,8 +117,8 @@ class CommandCSXOP : public Command
tmp_access.ci = ci;
tmp_access.type = source.command.upper();
- AccessGroup access = source.AccessFor(ci);
- const ChanAccess *highest = access.Highest();
+ ChanServ::AccessGroup access = source.AccessFor(ci);
+ const ChanServ::ChanAccess *highest = access.Highest();
bool override = false;
std::vector<Anope::string>::iterator cmd_it = std::find(order.begin(), order.end(), source.command.upper()),
@@ -143,7 +143,7 @@ class CommandCSXOP : public Command
return;
}
- ChannelInfo *targ_ci = ChannelInfo::Find(mask);
+ ChanServ::Channel *targ_ci = ChanServ::Find(mask);
if (targ_ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, mask.c_str());
@@ -159,7 +159,7 @@ class CommandCSXOP : public Command
}
else
{
- const NickAlias *na = NickAlias::Find(mask);
+ const NickServ::Nick *na = NickServ::FindNick(mask);
if (!na && Config->GetModule("chanserv")->Get<bool>("disallow_hostmask_access"))
{
source.Reply(_("Masks and unregistered users may not be on access lists."));
@@ -180,7 +180,7 @@ class CommandCSXOP : public Command
for (unsigned i = 0; i < ci->GetAccessCount(); ++i)
{
- const ChanAccess *a = ci->GetAccess(i);
+ const ChanServ::ChanAccess *a = ci->GetAccess(i);
if (a->mask.equals_ci(mask))
{
@@ -202,7 +202,7 @@ class CommandCSXOP : public Command
return;
}
- ServiceReference<AccessProvider> provider("AccessProvider", "access/xop");
+ ServiceReference<ChanServ::AccessProvider> provider("AccessProvider", "access/xop");
if (!provider)
return;
XOPChanAccess *acc = anope_dynamic_static_cast<XOPChanAccess *>(provider->Create());
@@ -220,9 +220,9 @@ class CommandCSXOP : public Command
source.Reply(_("\002%s\002 added to %s %s list."), acc->mask.c_str(), ci->name.c_str(), source.command.c_str());
}
- void DoDel(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
+ void DoDel(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
{
- NickCore *nc = source.nc;
+ NickServ::Account *nc = source.nc;
Anope::string mask = params.size() > 2 ? params[2] : "";
if (mask.empty())
@@ -247,11 +247,11 @@ class CommandCSXOP : public Command
tmp_access.ci = ci;
tmp_access.type = source.command.upper();
- AccessGroup access = source.AccessFor(ci);
- const ChanAccess *highest = access.Highest();
+ ChanServ::AccessGroup access = source.AccessFor(ci);
+ const ChanServ::ChanAccess *highest = access.Highest();
bool override = false;
- if (!isdigit(mask[0]) && mask.find_first_of("#!*@") == Anope::string::npos && !NickAlias::Find(mask))
+ if (!isdigit(mask[0]) && mask.find_first_of("#!*@") == Anope::string::npos && !NickServ::FindNick(mask))
{
User *targ = User::Find(mask, true);
if (targ != NULL)
@@ -283,13 +283,13 @@ class CommandCSXOP : public Command
class XOPDelCallback : public NumberList
{
CommandSource &source;
- ChannelInfo *ci;
+ ChanServ::Channel *ci;
Command *c;
unsigned deleted;
Anope::string nicks;
bool override;
public:
- XOPDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, bool _override, const Anope::string &numlist) : NumberList(numlist, true), source(_source), ci(_ci), c(_c), deleted(0), override(_override)
+ XOPDelCallback(CommandSource &_source, ChanServ::Channel *_ci, Command *_c, bool _override, const Anope::string &numlist) : NumberList(numlist, true), source(_source), ci(_ci), c(_c), deleted(0), override(_override)
{
}
@@ -313,7 +313,7 @@ class CommandCSXOP : public Command
if (!number || number > ci->GetAccessCount())
return;
- ChanAccess *caccess = ci->GetAccess(number - 1);
+ ChanServ::ChanAccess *caccess = ci->GetAccess(number - 1);
if (caccess->provider->name != "access/xop" || this->source.command.upper() != caccess->AccessSerialize())
return;
@@ -336,7 +336,7 @@ class CommandCSXOP : public Command
{
for (unsigned i = 0; i < ci->GetAccessCount(); ++i)
{
- ChanAccess *a = ci->GetAccess(i);
+ ChanServ::ChanAccess *a = ci->GetAccess(i);
if (a->provider->name != "access/xop" || source.command.upper() != a->AccessSerialize())
continue;
@@ -354,17 +354,17 @@ class CommandCSXOP : public Command
return;
}
}
-
+
source.Reply(_("\002%s\002 not found on %s %s list."), mask.c_str(), ci->name.c_str(), source.command.c_str());
}
}
- void DoList(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
+ void DoList(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
{
const Anope::string &nick = params.size() > 2 ? params[2] : "";
- AccessGroup access = source.AccessFor(ci);
+ ChanServ::AccessGroup access = source.AccessFor(ci);
if (!access.HasPriv("ACCESS_LIST") && !source.HasCommand("chanserv/access/list"))
{
@@ -386,10 +386,10 @@ class CommandCSXOP : public Command
class XOPListCallback : public NumberList
{
ListFormatter &list;
- ChannelInfo *ci;
+ ChanServ::Channel *ci;
CommandSource &source;
public:
- XOPListCallback(ListFormatter &_list, ChannelInfo *_ci, const Anope::string &numlist, CommandSource &src) : NumberList(numlist, false), list(_list), ci(_ci), source(src)
+ XOPListCallback(ListFormatter &_list, ChanServ::Channel *_ci, const Anope::string &numlist, CommandSource &src) : NumberList(numlist, false), list(_list), ci(_ci), source(src)
{
}
@@ -398,7 +398,7 @@ class CommandCSXOP : public Command
if (!Number || Number > ci->GetAccessCount())
return;
- const ChanAccess *a = ci->GetAccess(Number - 1);
+ const ChanServ::ChanAccess *a = ci->GetAccess(Number - 1);
if (a->provider->name != "access/xop" || this->source.command.upper() != a->AccessSerialize())
return;
@@ -415,7 +415,7 @@ class CommandCSXOP : public Command
{
for (unsigned i = 0, end = ci->GetAccessCount(); i < end; ++i)
{
- const ChanAccess *a = ci->GetAccess(i);
+ const ChanServ::ChanAccess *a = ci->GetAccess(i);
if (a->provider->name != "access/xop" || source.command.upper() != a->AccessSerialize())
continue;
@@ -442,7 +442,7 @@ class CommandCSXOP : public Command
}
}
- void DoClear(CommandSource &source, ChannelInfo *ci)
+ void DoClear(CommandSource &source, ChanServ::Channel *ci)
{
if (Anope::ReadOnly)
{
@@ -467,11 +467,11 @@ class CommandCSXOP : public Command
for (unsigned i = ci->GetAccessCount(); i > 0; --i)
{
- const ChanAccess *access = ci->GetAccess(i - 1);
+ const ChanServ::ChanAccess *access = ci->GetAccess(i - 1);
if (access->provider->name != "access/xop" || source.command.upper() != access->AccessSerialize())
continue;
-
+
delete ci->EraseAccess(i - 1);
}
@@ -496,7 +496,7 @@ class CommandCSXOP : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
@@ -611,7 +611,7 @@ class CSXOP : public Module
Configuration::Block *block = conf->GetBlock("privilege", i);
const Anope::string &pname = block->Get<const Anope::string>("name");
- Privilege *p = PrivilegeManager::FindPrivilege(pname);
+ ChanServ::Privilege *p = ChanServ::service ? ChanServ::service->FindPrivilege(pname) : nullptr;
if (p == NULL)
continue;
diff --git a/modules/commands/greet.cpp b/modules/commands/greet.cpp
index cacda2d3c..e35ba5b19 100644
--- a/modules/commands/greet.cpp
+++ b/modules/commands/greet.cpp
@@ -25,7 +25,7 @@ class CommandBSSetGreet : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
const Anope::string &value = params[1];
if (ci == NULL)
@@ -49,7 +49,7 @@ class CommandBSSetGreet : public Command
if (value.equals_ci("ON"))
{
bool override = !source.AccessFor(ci).HasPriv("SET");
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable greets";
+ Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable greets";
ci->Extend<bool>("BS_GREET");
source.Reply(_("Greet mode is now \002on\002 on channel %s."), ci->name.c_str());
@@ -57,7 +57,7 @@ class CommandBSSetGreet : public Command
else if (value.equals_ci("OFF"))
{
bool override = !source.AccessFor(ci).HasPriv("SET");
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable greets";
+ Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable greets";
ci->Shrink<bool>("BS_GREET");
source.Reply(_("Greet mode is now \002off\002 on channel %s."), ci->name.c_str());
@@ -95,13 +95,13 @@ class CommandNSSetGreet : public Command
return;
}
- const NickAlias *na = NickAlias::Find(user);
+ const NickServ::Nick *na = NickServ::FindNick(user);
if (!na)
{
source.Reply(NICK_X_NOT_REGISTERED, user.c_str());
return;
}
- NickCore *nc = na->nc;
+ NickServ::Account *nc = na->nc;
EventReturn MOD_RESULT = Event::OnSetNickOption(&Event::SetNickOption::OnSetNickOption, source, this, nc, param);
if (MOD_RESULT == EVENT_STOP)
@@ -208,14 +208,14 @@ class Greet : public Module
}
}
- void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool show_hidden) override
+ void OnNickInfo(CommandSource &source, NickServ::Nick *na, InfoFormatter &info, bool show_hidden) override
{
Anope::string *greet = ns_greet.Get(na->nc);
if (greet != NULL)
info[_("Greet")] = *greet;
}
- void OnBotInfo(CommandSource &source, BotInfo *bi, ChannelInfo *ci, InfoFormatter &info) override
+ void OnBotInfo(CommandSource &source, BotInfo *bi, ChanServ::Channel *ci, InfoFormatter &info) override
{
if (bs_greet.HasExt(ci))
info.AddOption(_("Greet"));
diff --git a/modules/commands/help.cpp b/modules/commands/help.cpp
index c23454c25..ba743f661 100644
--- a/modules/commands/help.cpp
+++ b/modules/commands/help.cpp
@@ -42,7 +42,7 @@ class CommandHelp : public Command
EventReturn MOD_RESULT = this->onhelp(&Event::Help::OnPreHelp, source, params);
if (MOD_RESULT == EVENT_STOP)
return;
-
+
Anope::string source_command = source.command;
const BotInfo *bi = source.service;
const CommandInfo::map &map = source.c ? Config->Fantasy : bi->commands;
@@ -151,7 +151,7 @@ class CommandHelp : public Command
if (hide_privileged_commands && !info.permission.empty() && !source.HasCommand(info.permission))
continue;
-
+
// Allow unregistered users to see help for commands that they explicitly request help for
const Anope::string &subcommand = params.size() > max ? params[max] : "";
@@ -185,7 +185,7 @@ class CommandHelp : public Command
if (helped == false)
source.Reply(_("No help available for \002%s\002."), params[0].c_str());
}
-
+
this->onhelp(&Event::Help::OnPostHelp, source, params);
}
};
diff --git a/modules/commands/hs_del.cpp b/modules/commands/hs_del.cpp
index ae0e2e6c2..d527c772b 100644
--- a/modules/commands/hs_del.cpp
+++ b/modules/commands/hs_del.cpp
@@ -32,7 +32,7 @@ class CommandHSDel : public Command
}
const Anope::string &nick = params[0];
- NickAlias *na = NickAlias::Find(nick);
+ NickServ::Nick *na = NickServ::FindNick(nick);
if (na)
{
Log(LOG_ADMIN, source, this) << "for user " << na->nick;
@@ -74,11 +74,11 @@ class CommandHSDelAll : public Command
}
const Anope::string &nick = params[0];
- NickAlias *na = NickAlias::Find(nick);
+ NickServ::Nick *na = NickServ::FindNick(nick);
if (na)
{
this->ondeletevhost(&Event::DeleteVhost::OnDeleteVhost, na);
- const NickCore *nc = na->nc;
+ const NickServ::Account *nc = na->nc;
for (unsigned i = 0; i < nc->aliases->size(); ++i)
{
na = nc->aliases->at(i);
diff --git a/modules/commands/hs_group.cpp b/modules/commands/hs_group.cpp
index eb1c6d299..47e4c03de 100644
--- a/modules/commands/hs_group.cpp
+++ b/modules/commands/hs_group.cpp
@@ -17,7 +17,7 @@ class CommandHSGroup : public Command
bool setting;
public:
- void Sync(const NickAlias *na)
+ void Sync(const NickServ::Nick *na)
{
if (setting)
return;
@@ -25,10 +25,10 @@ class CommandHSGroup : public Command
if (!na || !na->HasVhost())
return;
- setting = true;
+ setting = true;
for (unsigned i = 0; i < na->nc->aliases->size(); ++i)
{
- NickAlias *nick = na->nc->aliases->at(i);
+ NickServ::Nick *nick = na->nc->aliases->at(i);
if (nick)
{
nick->SetVhost(na->GetVhostIdent(), na->GetVhostHost(), na->GetVhostCreator());
@@ -51,7 +51,7 @@ class CommandHSGroup : public Command
return;
}
- NickAlias *na = NickAlias::Find(source.GetNick());
+ NickServ::Nick *na = NickServ::FindNick(source.GetNick());
if (na && source.GetAccount() == na->nc && na->HasVhost())
{
this->Sync(na);
@@ -93,7 +93,7 @@ class HSGroup : public Module
{
}
- void OnSetVhost(NickAlias *na) override
+ void OnSetVhost(NickServ::Nick *na) override
{
if (!synconset)
return;
@@ -101,7 +101,7 @@ class HSGroup : public Module
commandhsgroup.Sync(na);
}
- void OnNickGroup(User *u, NickAlias *na) override
+ void OnNickGroup(User *u, NickServ::Nick *na) override
{
if (!syncongroup)
return;
diff --git a/modules/commands/hs_list.cpp b/modules/commands/hs_list.cpp
index b5b8aa76a..f662ebbf1 100644
--- a/modules/commands/hs_list.cpp
+++ b/modules/commands/hs_list.cpp
@@ -57,9 +57,9 @@ class CommandHSList : public Command
ListFormatter list(source.GetAccount());
list.AddColumn(_("Number")).AddColumn(_("Nick")).AddColumn(_("Vhost")).AddColumn(_("Creator")).AddColumn(_("Created"));
- for (nickalias_map::const_iterator it = NickAliasList->begin(), it_end = NickAliasList->end(); it != it_end; ++it)
+ for (auto& it : NickServ::service->GetNickList())
{
- const NickAlias *na = it->second;
+ const NickServ::Nick *na = it.second;
if (!na->HasVhost())
continue;
diff --git a/modules/commands/hs_off.cpp b/modules/commands/hs_off.cpp
index c0d51f884..4923d390d 100644
--- a/modules/commands/hs_off.cpp
+++ b/modules/commands/hs_off.cpp
@@ -23,7 +23,7 @@ class CommandHSOff : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
User *u = source.GetUser();
- const NickAlias *na = NickAlias::Find(u->nick);
+ const NickServ::Nick *na = NickServ::FindNick(u->nick);
if (!na || !na->HasVhost())
source.Reply(HOST_NOT_ASSIGNED);
diff --git a/modules/commands/hs_on.cpp b/modules/commands/hs_on.cpp
index 4b92bf0be..7331dd355 100644
--- a/modules/commands/hs_on.cpp
+++ b/modules/commands/hs_on.cpp
@@ -26,7 +26,7 @@ class CommandHSOn : public Command
return; // HostServ wouldn't even be loaded at this point
User *u = source.GetUser();
- const NickAlias *na = NickAlias::Find(u->nick);
+ const NickServ::Nick *na = NickServ::FindNick(u->nick);
if (na && u->Account() == na->nc && na->HasVhost())
{
if (!na->GetVhostIdent().empty())
diff --git a/modules/commands/hs_request.cpp b/modules/commands/hs_request.cpp
index 1e5c98e31..119cc5a6d 100644
--- a/modules/commands/hs_request.cpp
+++ b/modules/commands/hs_request.cpp
@@ -42,7 +42,7 @@ struct HostRequest : Serializable
Anope::string snick;
data["nick"] >> snick;
- NickAlias *na = NickAlias::Find(snick);
+ NickServ::Nick *na = NickServ::FindNick(snick);
if (na == NULL)
return NULL;
@@ -88,7 +88,7 @@ class CommandHSRequest : public Command
}
User *u = source.GetUser();
- NickAlias *na = NickAlias::Find(source.GetNick());
+ NickServ::Nick *na = NickServ::FindNick(source.GetNick());
if (!na || na->nc != source.GetAccount())
{
source.Reply(ACCESS_DENIED);
@@ -96,7 +96,7 @@ class CommandHSRequest : public Command
}
Anope::string rawhostmask = params[0];
-
+
Anope::string user, host;
size_t a = rawhostmask.find('@');
@@ -196,7 +196,7 @@ class CommandHSActivate : public Command
const Anope::string &nick = params[0];
- NickAlias *na = NickAlias::Find(nick);
+ NickServ::Nick *na = NickServ::FindNick(nick);
HostRequest *req = na ? na->GetExt<HostRequest>("hostrequest") : NULL;
if (req)
{
@@ -246,7 +246,7 @@ class CommandHSReject : public Command
const Anope::string &nick = params[0];
const Anope::string &reason = params.size() > 1 ? params[1] : "";
- NickAlias *na = NickAlias::Find(nick);
+ NickServ::Nick *na = NickServ::FindNick(nick);
HostRequest *req = na ? na->GetExt<HostRequest>("hostrequest") : NULL;
if (req)
{
@@ -298,9 +298,9 @@ class CommandHSWaiting : public Command
list.AddColumn(_("Number")).AddColumn(_("Nick")).AddColumn(_("Vhost")).AddColumn(_("Created"));
- for (nickalias_map::const_iterator it = NickAliasList->begin(), it_end = NickAliasList->end(); it != it_end; ++it)
+ for (auto& it : NickServ::service->GetNickList())
{
- const NickAlias *na = it->second;
+ const NickServ::Nick *na = it.second;
HostRequest *hr = na->GetExt<HostRequest>("hostrequest");
if (!hr)
continue;
@@ -311,7 +311,7 @@ class CommandHSWaiting : public Command
ListFormatter::ListEntry entry;
entry["Number"] = stringify(display_counter);
- entry["Nick"] = it->first;
+ entry["Nick"] = na->nick;
if (!hr->ident.empty())
entry["Vhost"] = hr->ident + "@" + hr->host;
else
@@ -379,8 +379,8 @@ static void req_send_memos(Module *me, CommandSource &source, const Anope::strin
for (unsigned i = 0; i < Oper::opers.size(); ++i)
{
Oper *o = Oper::opers[i];
-
- const NickAlias *na = NickAlias::Find(o->name);
+
+ const NickServ::Nick *na = NickServ::FindNick(o->name);
if (!na)
continue;
diff --git a/modules/commands/hs_set.cpp b/modules/commands/hs_set.cpp
index 69281b6ec..614bfc2e9 100644
--- a/modules/commands/hs_set.cpp
+++ b/modules/commands/hs_set.cpp
@@ -30,7 +30,7 @@ class CommandHSSet : public Command
const Anope::string &nick = params[0];
- NickAlias *na = NickAlias::Find(nick);
+ NickServ::Nick *na = NickServ::FindNick(nick);
if (na == NULL)
{
source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
@@ -106,14 +106,14 @@ class CommandHSSet : public Command
class CommandHSSetAll : public Command
{
- void Sync(const NickAlias *na)
+ void Sync(const NickServ::Nick *na)
{
if (!na || !na->HasVhost())
return;
-
+
for (unsigned i = 0; i < na->nc->aliases->size(); ++i)
{
- NickAlias *nick = na->nc->aliases->at(i);
+ NickServ::Nick *nick = na->nc->aliases->at(i);
if (nick)
nick->SetVhost(na->GetVhostIdent(), na->GetVhostHost(), na->GetVhostCreator());
}
@@ -136,7 +136,7 @@ class CommandHSSetAll : public Command
Anope::string nick = params[0];
- NickAlias *na = NickAlias::Find(nick);
+ NickServ::Nick *na = NickServ::FindNick(nick);
if (na == NULL)
{
source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
diff --git a/modules/commands/ms_cancel.cpp b/modules/commands/ms_cancel.cpp
index 09746d0f2..0de3ae0ea 100644
--- a/modules/commands/ms_cancel.cpp
+++ b/modules/commands/ms_cancel.cpp
@@ -23,7 +23,7 @@ class CommandMSCancel : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
- if (Anope::ReadOnly)
+ if (Anope::ReadOnly || !MemoServ::service)
{
source.Reply(READ_ONLY_MODE);
return;
@@ -31,32 +31,32 @@ class CommandMSCancel : public Command
const Anope::string &nname = params[0];
- bool ischan;
- MemoInfo *mi = MemoInfo::GetMemoInfo(nname, ischan);
+ bool ischan, isregistered;
+ MemoServ::MemoInfo *mi = MemoServ::service->GetMemoInfo(name, ischan, isregistered, false);
- if (mi == NULL)
+ if (!isregistered)
source.Reply(ischan ? CHAN_X_NOT_REGISTERED : _(NICK_X_NOT_REGISTERED), nname.c_str());
else
{
- ChannelInfo *ci = NULL;
- NickAlias *na = NULL;
+ ChanServ::Channel *ci = NULL;
+ NickServ::Nick *na = NULL;
if (ischan)
- ci = ChannelInfo::Find(nname);
+ ci = ChanServ::Find(nname);
else
- na = NickAlias::Find(nname);
- for (int i = mi->memos->size() - 1; i >= 0; --i)
- if (mi->GetMemo(i)->unread && source.nc->display.equals_ci(mi->GetMemo(i)->sender))
- {
- if (MemoServ::Event::OnMemoDel)
- MemoServ::Event::OnMemoDel(&MemoServ::Event::MemoDel::OnMemoDel, ischan ? ci->name : na->nc->display, mi, mi->GetMemo(i));
- mi->Del(i);
- source.Reply(_("Last memo to \002%s\002 has been cancelled."), nname.c_str());
- return;
- }
+ na = NickServ::FindNick(nname);
+ if (mi)
+ for (int i = mi->memos->size() - 1; i >= 0; --i)
+ if (mi->GetMemo(i)->unread && source.nc->display.equals_ci(mi->GetMemo(i)->sender))
+ {
+ if (MemoServ::Event::OnMemoDel)
+ MemoServ::Event::OnMemoDel(&MemoServ::Event::MemoDel::OnMemoDel, ischan ? ci->name : na->nc->display, mi, mi->GetMemo(i));
+ mi->Del(i);
+ source.Reply(_("Last memo to \002%s\002 has been cancelled."), nname.c_str());
+ return;
+ }
source.Reply(_("No memo was cancelable."));
}
- return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
diff --git a/modules/commands/ms_check.cpp b/modules/commands/ms_check.cpp
index a534aaca3..f20724a45 100644
--- a/modules/commands/ms_check.cpp
+++ b/modules/commands/ms_check.cpp
@@ -27,34 +27,35 @@ class CommandMSCheck : public Command
bool found = false;
- const NickAlias *na = NickAlias::Find(recipient);
+ const NickServ::Nick *na = NickServ::FindNick(recipient);
if (!na)
{
source.Reply(NICK_X_NOT_REGISTERED, recipient.c_str());
return;
}
- MemoInfo *mi = &na->nc->memos;
+ MemoServ::MemoInfo *mi = na->nc->memos;
/* Okay, I know this looks strange but we wanna get the LAST memo, so we
have to loop backwards */
- for (unsigned i = mi->memos->size(); i > 0; --i)
- {
- Memo *m = mi->GetMemo(i - 1);
- NickAlias *na2 = NickAlias::Find(m->sender);
-
- if (na2 != NULL && na2->nc == source.GetAccount())
+ if (mi)
+ for (unsigned i = mi->memos->size(); i > 0; --i)
{
- found = true; /* Yes, we've found the memo */
-
- if (m->unread)
- source.Reply(_("The last memo you sent to %s (sent on %s) has not yet been read."), na->nick.c_str(), Anope::strftime(m->time, source.GetAccount()).c_str());
- else
- source.Reply(_("The last memo you sent to %s (sent on %s) has been read."), na->nick.c_str(), Anope::strftime(m->time, source.GetAccount()).c_str());
- break;
+ MemoServ::Memo *m = mi->GetMemo(i - 1);
+ NickServ::Nick *na2 = NickServ::FindNick(m->sender);
+
+ if (na2 != NULL && na2->nc == source.GetAccount())
+ {
+ found = true; /* Yes, we've found the memo */
+
+ if (m->unread)
+ source.Reply(_("The last memo you sent to %s (sent on %s) has not yet been read."), na->nick.c_str(), Anope::strftime(m->time, source.GetAccount()).c_str());
+ else
+ source.Reply(_("The last memo you sent to %s (sent on %s) has been read."), na->nick.c_str(), Anope::strftime(m->time, source.GetAccount()).c_str());
+ break;
+ }
}
- }
if (!found)
source.Reply(_("Nick %s doesn't have a memo from you."), na->nick.c_str());
diff --git a/modules/commands/ms_del.cpp b/modules/commands/ms_del.cpp
index e1d329921..9089dd6a1 100644
--- a/modules/commands/ms_del.cpp
+++ b/modules/commands/ms_del.cpp
@@ -15,10 +15,10 @@
class MemoDelCallback : public NumberList
{
CommandSource &source;
- ChannelInfo *ci;
- MemoInfo *mi;
+ ChanServ::Channel *ci;
+ MemoServ::MemoInfo *mi;
public:
- MemoDelCallback(CommandSource &_source, ChannelInfo *_ci, MemoInfo *_mi, const Anope::string &list) : NumberList(list, true), source(_source), ci(_ci), mi(_mi)
+ MemoDelCallback(CommandSource &_source, ChanServ::Channel *_ci, MemoServ::MemoInfo *_mi, const Anope::string &list) : NumberList(list, true), source(_source), ci(_ci), mi(_mi)
{
}
@@ -52,8 +52,8 @@ class CommandMSDel : public Command
return;
}
- MemoInfo *mi;
- ChannelInfo *ci = NULL;
+ MemoServ::MemoInfo *mi;
+ ChanServ::Channel *ci = NULL;
Anope::string numstr = !params.empty() ? params[0] : "", chan;
if (!numstr.empty() && numstr[0] == '#')
@@ -61,7 +61,7 @@ class CommandMSDel : public Command
chan = numstr;
numstr = params.size() > 1 ? params[1] : "";
- ci = ChannelInfo::Find(chan);
+ ci = ChanServ::Find(chan);
if (!ci)
{
source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str());
@@ -72,13 +72,13 @@ class CommandMSDel : public Command
source.Reply(ACCESS_DENIED);
return;
}
- mi = &ci->memos;
+ mi = ci->memos;
}
else
- mi = &source.nc->memos;
+ mi = source.nc->memos;
if (numstr.empty() || (!isdigit(numstr[0]) && !numstr.equals_ci("ALL") && !numstr.equals_ci("LAST")))
this->OnSyntaxError(source, numstr);
- else if (mi->memos->empty())
+ else if (!mi || mi->memos->empty())
{
if (!chan.empty())
source.Reply(MEMO_X_HAS_NO_MEMOS, chan.c_str());
diff --git a/modules/commands/ms_ignore.cpp b/modules/commands/ms_ignore.cpp
index f73a27930..98b4a2f9e 100644
--- a/modules/commands/ms_ignore.cpp
+++ b/modules/commands/ms_ignore.cpp
@@ -29,6 +29,8 @@ class CommandMSIgnore : public Command
source.Reply(READ_ONLY_MODE);
return;
}
+ if (!MemoServ::service)
+ return;
Anope::string channel = params[0];
Anope::string command = (params.size() > 1 ? params[1] : "");
@@ -41,10 +43,10 @@ class CommandMSIgnore : public Command
channel = source.GetNick();
}
- bool ischan;
- MemoInfo *mi = MemoInfo::GetMemoInfo(channel, ischan);
- ChannelInfo *ci = ChannelInfo::Find(channel);
- if (!mi)
+ bool ischan, isregistered;
+ MemoServ::MemoInfo *mi = MemoServ::service->GetMemoInfo(channel, ischan, isregistered, true);
+ ChanServ::Channel *ci = ChanServ::Find(channel);
+ if (!isregistered)
source.Reply(ischan ? CHAN_X_NOT_REGISTERED : _(NICK_X_NOT_REGISTERED), channel.c_str());
else if (ischan && !source.AccessFor(ci).HasPriv("MEMO"))
source.Reply(ACCESS_DENIED);
diff --git a/modules/commands/ms_info.cpp b/modules/commands/ms_info.cpp
index 0e7506765..9544be3c7 100644
--- a/modules/commands/ms_info.cpp
+++ b/modules/commands/ms_info.cpp
@@ -22,27 +22,27 @@ class CommandMSInfo : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
- NickCore *nc = source.nc;
- const MemoInfo *mi;
- const NickAlias *na = NULL;
- ChannelInfo *ci = NULL;
+ NickServ::Account *nc = source.nc;
+ const MemoServ::MemoInfo *mi;
+ const NickServ::Nick *na = NULL;
+ ChanServ::Channel *ci = NULL;
const Anope::string &nname = !params.empty() ? params[0] : "";
bool hardmax;
if (!nname.empty() && nname[0] != '#' && source.HasPriv("memoserv/info"))
{
- na = NickAlias::Find(nname);
+ na = NickServ::FindNick(nname);
if (!na)
{
source.Reply(NICK_X_NOT_REGISTERED, nname.c_str());
return;
}
- mi = &na->nc->memos;
+ mi = na->nc->memos;
hardmax = na->nc->HasExt("MEMO_HARDMAX");
}
else if (!nname.empty() && nname[0] == '#')
{
- ci = ChannelInfo::Find(nname);
+ ci = ChanServ::Find(nname);
if (!ci)
{
source.Reply(CHAN_X_NOT_REGISTERED, nname.c_str());
@@ -53,7 +53,7 @@ class CommandMSInfo : public Command
source.Reply(ACCESS_DENIED);
return;
}
- mi = &ci->memos;
+ mi = ci->memos;
hardmax = ci->HasExt("MEMO_HARDMAX");
}
else if (!nname.empty()) /* It's not a chan and we aren't services admin */
@@ -63,9 +63,11 @@ class CommandMSInfo : public Command
}
else
{
- mi = &nc->memos;
+ mi = nc->memos;
hardmax = nc->HasExt("MEMO_HARDMAX");
}
+ if (!mi)
+ return;
if (!nname.empty() && (ci || na->nc != nc))
{
diff --git a/modules/commands/ms_list.cpp b/modules/commands/ms_list.cpp
index e5ca96770..758bb08be 100644
--- a/modules/commands/ms_list.cpp
+++ b/modules/commands/ms_list.cpp
@@ -24,15 +24,15 @@ class CommandMSList : public Command
{
Anope::string param = !params.empty() ? params[0] : "", chan;
- ChannelInfo *ci = NULL;
- const MemoInfo *mi;
+ ChanServ::Channel *ci = NULL;
+ const MemoServ::MemoInfo *mi;
if (!param.empty() && param[0] == '#')
{
chan = param;
param = params.size() > 1 ? params[1] : "";
- ci = ChannelInfo::Find(chan);
+ ci = ChanServ::Find(chan);
if (!ci)
{
source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str());
@@ -43,10 +43,10 @@ class CommandMSList : public Command
source.Reply(ACCESS_DENIED);
return;
}
- mi = &ci->memos;
+ mi = ci->memos;
}
else
- mi = &source.nc->memos;
+ mi = source.nc->memos;
if (!param.empty() && !isdigit(param[0]) && !param.equals_ci("NEW"))
this->OnSyntaxError(source, param);
@@ -69,9 +69,9 @@ class CommandMSList : public Command
{
ListFormatter &list;
CommandSource &source;
- const MemoInfo *mi;
+ const MemoServ::MemoInfo *mi;
public:
- MemoListCallback(ListFormatter &_list, CommandSource &_source, const MemoInfo *_mi, const Anope::string &numlist) : NumberList(numlist, false), list(_list), source(_source), mi(_mi)
+ MemoListCallback(ListFormatter &_list, CommandSource &_source, const MemoServ::MemoInfo *_mi, const Anope::string &numlist) : NumberList(numlist, false), list(_list), source(_source), mi(_mi)
{
}
@@ -80,7 +80,7 @@ class CommandMSList : public Command
if (!number || number > mi->memos->size())
return;
- const Memo *m = mi->GetMemo(number - 1);
+ const MemoServ::Memo *m = mi->GetMemo(number - 1);
ListFormatter::ListEntry entry;
entry["Number"] = (m->unread ? "* " : " ") + stringify(number);
@@ -115,7 +115,7 @@ class CommandMSList : public Command
if (!param.empty() && !mi->GetMemo(i)->unread)
continue;
- const Memo *m = mi->GetMemo(i);
+ const MemoServ::Memo *m = mi->GetMemo(i);
ListFormatter::ListEntry entry;
entry["Number"] = (m->unread ? "* " : " ") + stringify(i + 1);
diff --git a/modules/commands/ms_read.cpp b/modules/commands/ms_read.cpp
index ba5eda863..32852a29f 100644
--- a/modules/commands/ms_read.cpp
+++ b/modules/commands/ms_read.cpp
@@ -12,19 +12,19 @@
#include "module.h"
#include "modules/memoserv.h"
-static void rsend_notify(CommandSource &source, MemoInfo *mi, Memo *m, const Anope::string &targ)
+static void rsend_notify(CommandSource &source, MemoServ::MemoInfo *mi, MemoServ::Memo *m, const Anope::string &targ)
{
/* Only send receipt if memos are allowed */
if (MemoServ::service && !Anope::ReadOnly)
{
/* Get nick alias for sender */
- const NickAlias *na = NickAlias::Find(m->sender);
+ const NickServ::Nick *na = NickServ::FindNick(m->sender);
if (!na)
return;
/* Get nick core for sender */
- const NickCore *nc = na->nc;
+ const NickServ::Account *nc = na->nc;
if (!nc)
return;
@@ -49,10 +49,10 @@ static void rsend_notify(CommandSource &source, MemoInfo *mi, Memo *m, const Ano
class MemoListCallback : public NumberList
{
CommandSource &source;
- MemoInfo *mi;
- const ChannelInfo *ci;
+ MemoServ::MemoInfo *mi;
+ const ChanServ::Channel *ci;
public:
- MemoListCallback(CommandSource &_source, MemoInfo *_mi, const ChannelInfo *_ci, const Anope::string &numlist) : NumberList(numlist, false), source(_source), mi(_mi), ci(_ci)
+ MemoListCallback(CommandSource &_source, MemoServ::MemoInfo *_mi, const ChanServ::Channel *_ci, const Anope::string &numlist) : NumberList(numlist, false), source(_source), mi(_mi), ci(_ci)
{
}
@@ -64,12 +64,12 @@ class MemoListCallback : public NumberList
MemoListCallback::DoRead(source, mi, ci, number - 1);
}
- static void DoRead(CommandSource &source, MemoInfo *mi, const ChannelInfo *ci, unsigned index)
+ static void DoRead(CommandSource &source, MemoServ::MemoInfo *mi, const ChanServ::Channel *ci, unsigned index)
{
- Memo *m = mi->GetMemo(index);
+ MemoServ::Memo *m = mi->GetMemo(index);
if (!m)
return;
-
+
if (ci)
source.Reply(_("Memo %d from %s (%s)."), index + 1, m->sender.c_str(), Anope::strftime(m->time, source.GetAccount()).c_str());
else
@@ -106,8 +106,8 @@ class CommandMSRead : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
- MemoInfo *mi;
- ChannelInfo *ci = NULL;
+ MemoServ::MemoInfo *mi;
+ ChanServ::Channel *ci = NULL;
Anope::string numstr = params[0], chan;
if (!numstr.empty() && numstr[0] == '#')
@@ -115,7 +115,7 @@ class CommandMSRead : public Command
chan = numstr;
numstr = params.size() > 1 ? params[1] : "";
- ci = ChannelInfo::Find(chan);
+ ci = ChanServ::Find(chan);
if (!ci)
{
source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str());
@@ -126,10 +126,10 @@ class CommandMSRead : public Command
source.Reply(ACCESS_DENIED);
return;
}
- mi = &ci->memos;
+ mi = ci->memos;
}
else
- mi = &source.nc->memos;
+ mi = source.nc->memos;
if (numstr.empty() || (!numstr.equals_ci("LAST") && !numstr.equals_ci("NEW") && !numstr.is_number_only()))
this->OnSyntaxError(source, numstr);
diff --git a/modules/commands/ms_rsend.cpp b/modules/commands/ms_rsend.cpp
index 4cdeb132b..98315845c 100644
--- a/modules/commands/ms_rsend.cpp
+++ b/modules/commands/ms_rsend.cpp
@@ -34,10 +34,10 @@ class CommandMSRSend : public Command
const Anope::string &nick = params[0];
const Anope::string &text = params[1];
- const NickAlias *na = NULL;
+ const NickServ::Nick *na = NULL;
/* prevent user from rsend to themselves */
- if ((na = NickAlias::Find(nick)) && na->nc == source.GetAccount())
+ if ((na = NickServ::FindNick(nick)) && na->nc == source.GetAccount())
{
source.Reply(_("You can not request a receipt when sending a memo to yourself."));
return;
@@ -54,15 +54,15 @@ class CommandMSRSend : public Command
source.Reply(_("Please wait %d seconds before using the %s command again."), Config->GetModule("memoserv")->Get<time_t>("senddelay"), source.command.c_str());
else if (result == MemoServ::MemoServService::MEMO_TARGET_FULL)
source.Reply(_("Sorry, %s currently has too many memos and cannot receive more."), nick.c_str());
- else
+ else
{
source.Reply(_("Memo sent to \002%s\002."), nick.c_str());
- bool ischan;
- MemoInfo *mi = MemoInfo::GetMemoInfo(nick, ischan);
+ bool ischan, isregistered;
+ MemoServ::MemoInfo *mi = MemoServ::service->GetMemoInfo(nick, ischan, isregistered, false);
if (mi == NULL)
throw CoreException("NULL mi in ms_rsend");
- Memo *m = (mi->memos->size() ? mi->GetMemo(mi->memos->size() - 1) : NULL);
+ MemoServ::Memo *m = (mi->memos->size() ? mi->GetMemo(mi->memos->size() - 1) : NULL);
if (m != NULL)
m->receipt = true;
}
diff --git a/modules/commands/ms_sendall.cpp b/modules/commands/ms_sendall.cpp
index c567b0ed3..a1c545ec2 100644
--- a/modules/commands/ms_sendall.cpp
+++ b/modules/commands/ms_sendall.cpp
@@ -30,9 +30,9 @@ class CommandMSSendAll : public Command
Log(LOG_ADMIN, source, this) << "to send " << text;
- for (nickcore_map::const_iterator it = NickCoreList->begin(), it_end = NickCoreList->end(); it != it_end; ++it)
+ for (auto& it : NickServ::service->GetAccountList())
{
- const NickCore *nc = it->second;
+ const NickServ::Account *nc = it.second;
if (nc != source.nc)
MemoServ::service->Send(source.GetNick(), nc->display, text);
diff --git a/modules/commands/ms_set.cpp b/modules/commands/ms_set.cpp
index 5e5591471..47acb177d 100644
--- a/modules/commands/ms_set.cpp
+++ b/modules/commands/ms_set.cpp
@@ -14,10 +14,10 @@
class CommandMSSet : public Command
{
private:
- void DoNotify(CommandSource &source, const std::vector<Anope::string> &params, MemoInfo *mi)
+ void DoNotify(CommandSource &source, const std::vector<Anope::string> &params, MemoServ::MemoInfo *mi)
{
const Anope::string &param = params[1];
- NickCore *nc = source.nc;
+ NickServ::Account *nc = source.nc;
BotInfo *MemoServ = Config->GetClient("MemoServ");
if (!MemoServ)
@@ -67,7 +67,7 @@ class CommandMSSet : public Command
this->OnSyntaxError(source, "");
}
- void DoLimit(CommandSource &source, const std::vector<Anope::string> &params, MemoInfo *mi)
+ void DoLimit(CommandSource &source, const std::vector<Anope::string> &params, MemoServ::MemoInfo *mi)
{
Anope::string p1 = params[1];
@@ -75,8 +75,8 @@ class CommandMSSet : public Command
Anope::string p3 = params.size() > 3 ? params[3] : "";
Anope::string user, chan;
int16_t limit;
- NickCore *nc = source.nc;
- ChannelInfo *ci = NULL;
+ NickServ::Account *nc = source.nc;
+ ChanServ::Channel *ci = NULL;
bool is_servadmin = source.HasPriv("memoserv/set-limit");
if (p1[0] == '#')
@@ -86,7 +86,7 @@ class CommandMSSet : public Command
p2 = p3;
p3 = params.size() > 4 ? params[4] : "";
- ci = ChannelInfo::Find(chan);
+ ci = ChanServ::Find(chan);
if (!ci)
{
source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str());
@@ -97,20 +97,20 @@ class CommandMSSet : public Command
source.Reply(ACCESS_DENIED);
return;
}
- mi = &ci->memos;
+ mi = ci->memos;
}
if (is_servadmin)
{
if (!p2.empty() && !p2.equals_ci("HARD") && chan.empty())
{
- const NickAlias *na;
- if (!(na = NickAlias::Find(p1)))
+ const NickServ::Nick *na;
+ if (!(na = NickServ::FindNick(p1)))
{
source.Reply(NICK_X_NOT_REGISTERED, p1.c_str());
return;
}
user = p1;
- mi = &na->nc->memos;
+ mi = na->nc->memos;
nc = na->nc;
p1 = p2;
p2 = p3;
@@ -210,7 +210,7 @@ class CommandMSSet : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
const Anope::string &cmd = params[0];
- MemoInfo *mi = &source.nc->memos;
+ MemoServ::MemoInfo *mi = source.nc->memos;
if (Anope::ReadOnly)
source.Reply(_("Sorry, memo option setting is temporarily disabled."));
@@ -219,11 +219,7 @@ class CommandMSSet : public Command
else if (cmd.equals_ci("LIMIT"))
return this->DoLimit(source, params, mi);
else
- {
this->OnSyntaxError(source, "");
- }
-
- return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
diff --git a/modules/commands/ms_staff.cpp b/modules/commands/ms_staff.cpp
index 125ef60fc..7e33b76b3 100644
--- a/modules/commands/ms_staff.cpp
+++ b/modules/commands/ms_staff.cpp
@@ -28,9 +28,9 @@ class CommandMSStaff : public Command
const Anope::string &text = params[0];
- for (nickcore_map::const_iterator it = NickCoreList->begin(), it_end = NickCoreList->end(); it != it_end; ++it)
+ for (auto& it : NickServ::service->GetAccountList())
{
- const NickCore *nc = it->second;
+ const NickServ::Account *nc = it.second;
if (source.nc != nc && nc->IsServicesOper())
MemoServ::service->Send(source.GetNick(), nc->display, text, true);
diff --git a/modules/commands/ns_access.cpp b/modules/commands/ns_access.cpp
index 1df0bbe0e..e15f2abfd 100644
--- a/modules/commands/ns_access.cpp
+++ b/modules/commands/ns_access.cpp
@@ -15,7 +15,7 @@
class CommandNSAccess : public Command
{
private:
- void DoAdd(CommandSource &source, NickCore *nc, const Anope::string &mask)
+ void DoAdd(CommandSource &source, NickServ::Account *nc, const Anope::string &mask)
{
if (mask.empty())
{
@@ -48,7 +48,7 @@ class CommandNSAccess : public Command
return;
}
- void DoDel(CommandSource &source, NickCore *nc, const Anope::string &mask)
+ void DoDel(CommandSource &source, NickServ::Account *nc, const Anope::string &mask)
{
if (mask.empty())
{
@@ -75,7 +75,7 @@ class CommandNSAccess : public Command
return;
}
- void DoList(CommandSource &source, NickCore *nc, const Anope::string &mask)
+ void DoList(CommandSource &source, NickServ::Account *nc, const Anope::string &mask)
{
unsigned i, end;
@@ -118,10 +118,10 @@ class CommandNSAccess : public Command
mask = params.size() > 1 ? params[params.size() - 1] : "";
}
- NickCore *nc;
+ NickServ::Account *nc;
if (!nick.empty())
{
- const NickAlias *na = NickAlias::Find(nick);
+ const NickServ::Nick *na = NickServ::FindNick(nick);
if (na == NULL)
{
source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
@@ -199,7 +199,7 @@ class NSAccess : public Module
{
}
- void OnNickRegister(User *u, NickAlias *na) override
+ void OnNickRegister(User *u, NickServ::Nick *na) override
{
if (u && Config->GetModule(this)->Get<bool>("addaccessonreg"))
na->nc->AddAccess(u->Mask());
diff --git a/modules/commands/ns_ajoin.cpp b/modules/commands/ns_ajoin.cpp
index 0967dbf61..834607028 100644
--- a/modules/commands/ns_ajoin.cpp
+++ b/modules/commands/ns_ajoin.cpp
@@ -21,7 +21,7 @@ struct AJoinList : Serialize::Checker<std::vector<AJoinEntry *> >
struct AJoinEntry : Serializable
{
- Serialize::Reference<NickCore> owner;
+ Serialize::Reference<NickServ::Account> owner;
Anope::string channel;
Anope::string key;
@@ -54,7 +54,7 @@ struct AJoinEntry : Serializable
sd["owner"] >> sowner;
- NickCore *nc = NickCore::Find(sowner);
+ NickServ::Account *nc = NickServ::FindAccount(sowner);
if (nc == NULL)
return NULL;
@@ -88,7 +88,7 @@ AJoinList::~AJoinList()
class CommandNSAJoin : public Command
{
- void DoList(CommandSource &source, NickCore *nc)
+ void DoList(CommandSource &source, NickServ::Account *nc)
{
AJoinList *channels = nc->Require<AJoinList>("ajoinlist");
@@ -118,7 +118,7 @@ class CommandNSAJoin : public Command
}
}
- void DoAdd(CommandSource &source, NickCore *nc, const Anope::string &chans, const Anope::string &keys)
+ void DoAdd(CommandSource &source, NickServ::Account *nc, const Anope::string &chans, const Anope::string &keys)
{
AJoinList *channels = nc->Require<AJoinList>("ajoinlist");
@@ -184,7 +184,7 @@ class CommandNSAJoin : public Command
source.Reply(_("%s added to %s's auto join list."), addedchans.c_str(), nc->display.c_str());
}
- void DoDel(CommandSource &source, NickCore *nc, const Anope::string &chans)
+ void DoDel(CommandSource &source, NickServ::Account *nc, const Anope::string &chans)
{
AJoinList *channels = nc->Require<AJoinList>("ajoinlist");
Anope::string delchans;
@@ -197,7 +197,7 @@ class CommandNSAJoin : public Command
for (; i < (*channels)->size(); ++i)
if ((*channels)->at(i)->channel.equals_ci(chan))
break;
-
+
if (i == (*channels)->size())
notfoundchans += chan + ", ";
else
@@ -243,10 +243,10 @@ class CommandNSAJoin : public Command
else
nick = (params.size() > 2 && IRCD->IsChannelValid(params[2])) ? params[1] : "";
- NickCore *nc;
+ NickServ::Account *nc;
if (!nick.empty())
{
- const NickAlias *na = NickAlias::Find(nick);
+ const NickServ::Nick *na = NickServ::FindNick(nick);
if (na == NULL)
{
source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
@@ -333,17 +333,17 @@ class NSAJoin : public Module
{
AJoinEntry *entry = (*channels)->at(i);
Channel *c = Channel::Find(entry->channel);
- ChannelInfo *ci;
+ ChanServ::Channel *ci;
if (c)
ci = c->ci;
else
- ci = ChannelInfo::Find(entry->channel);
+ ci = ChanServ::Find(entry->channel);
bool need_invite = false;
Anope::string key = entry->key;
- AccessGroup u_access;
-
+ ChanServ::AccessGroup u_access;
+
if (ci != NULL)
{
if (ci->HasExt("CS_SUSPENDED"))
@@ -364,7 +364,7 @@ class NSAJoin : public Module
need_invite = true;
else if (c->HasMode("INVITE") && c->MatchesList(u, "INVITEOVERRIDE") == false)
need_invite = true;
-
+
if (c->HasMode("KEY"))
{
Anope::string k;
diff --git a/modules/commands/ns_alist.cpp b/modules/commands/ns_alist.cpp
index 54216b190..ff3b5d037 100644
--- a/modules/commands/ns_alist.cpp
+++ b/modules/commands/ns_alist.cpp
@@ -13,7 +13,7 @@
class CommandNSAList : public Command
{
- static bool ChannelSort(ChannelInfo *ci1, ChannelInfo *ci2)
+ static bool ChannelSort(ChanServ::Channel *ci1, ChanServ::Channel *ci2)
{
return ci::less()(ci1->name, ci2->name);
}
@@ -28,12 +28,12 @@ class CommandNSAList : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
Anope::string nick = source.GetNick();
- NickCore *nc = source.nc;
+ NickServ::Account *nc = source.nc;
if (params.size() && source.HasPriv("nickserv/alist"))
{
nick = params[0];
- const NickAlias *na = NickAlias::Find(nick);
+ const NickServ::Nick *na = NickServ::FindNick(nick);
if (!na)
{
source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
@@ -47,13 +47,13 @@ class CommandNSAList : public Command
list.AddColumn(_("Number")).AddColumn(_("Channel")).AddColumn(_("Access")).AddColumn(_("Description"));
- std::deque<ChannelInfo *> queue;
+ std::deque<ChanServ::Channel *> queue;
nc->GetChannelReferences(queue);
std::sort(queue.begin(), queue.end(), ChannelSort);
for (unsigned i = 0; i < queue.size(); ++i)
{
- ChannelInfo *ci = queue[i];
+ ChanServ::Channel *ci = queue[i];
ListFormatter::ListEntry entry;
if (ci->GetFounder() == nc)
@@ -78,10 +78,10 @@ class CommandNSAList : public Command
continue;
}
- AccessGroup access = ci->AccessFor(nc);
+ ChanServ::AccessGroup access = ci->AccessFor(nc);
if (access.empty())
continue;
-
+
++chan_count;
entry["Number"] = stringify(chan_count);
diff --git a/modules/commands/ns_cert.cpp b/modules/commands/ns_cert.cpp
index bda723981..4f2ab5270 100644
--- a/modules/commands/ns_cert.cpp
+++ b/modules/commands/ns_cert.cpp
@@ -13,16 +13,16 @@
#include "modules/ns_cert.h"
#include "modules/nickserv.h"
-static Anope::hash_map<NickCore *> certmap;
+static Anope::hash_map<NickServ::Account *> certmap;
static EventHandlers<Event::NickCertEvents> *events;
struct CertServiceImpl : CertService
{
CertServiceImpl(Module *o) : CertService(o) { }
- NickCore* FindAccountFromCert(const Anope::string &cert) override
+ NickServ::Account* FindAccountFromCert(const Anope::string &cert) override
{
- Anope::hash_map<NickCore *>::iterator it = certmap.find(cert);
+ Anope::hash_map<NickServ::Account *>::iterator it = certmap.find(cert);
if (it != certmap.end())
return it->second;
return NULL;
@@ -31,11 +31,11 @@ struct CertServiceImpl : CertService
struct NSCertListImpl : NSCertList
{
- Serialize::Reference<NickCore> nc;
+ Serialize::Reference<NickServ::Account> nc;
std::vector<Anope::string> certs;
public:
- NSCertListImpl(Extensible *obj) : nc(anope_dynamic_static_cast<NickCore *>(obj)) { }
+ NSCertListImpl(Extensible *obj) : nc(anope_dynamic_static_cast<NickServ::Account *>(obj)) { }
~NSCertListImpl()
{
@@ -127,10 +127,10 @@ struct NSCertListImpl : NSCertList
void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const override
{
- if (s->GetSerializableType()->GetName() != "NickCore")
+ if (s->GetSerializableType()->GetName() != "NickServ::Account")
return;
- const NickCore *n = anope_dynamic_static_cast<const NickCore *>(e);
+ const NickServ::Account *n = anope_dynamic_static_cast<const NickServ::Account *>(e);
NSCertList *c = this->Get(n);
if (c == NULL || !c->GetCertCount())
return;
@@ -141,10 +141,10 @@ struct NSCertListImpl : NSCertList
void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) override
{
- if (s->GetSerializableType()->GetName() != "NickCore")
+ if (s->GetSerializableType()->GetName() != "NickServ::Account")
return;
- NickCore *n = anope_dynamic_static_cast<NickCore *>(e);
+ NickServ::Account *n = anope_dynamic_static_cast<NickServ::Account *>(e);
NSCertListImpl *c = this->Require(n);
Anope::string buf;
@@ -165,7 +165,7 @@ struct NSCertListImpl : NSCertList
class CommandNSCert : public Command
{
private:
- void DoAdd(CommandSource &source, NickCore *nc, Anope::string certfp)
+ void DoAdd(CommandSource &source, NickServ::Account *nc, Anope::string certfp)
{
NSCertList *cl = nc->Require<NSCertList>("certificates");
unsigned max = Config->GetModule(this->owner)->Get<unsigned>("max", "5");
@@ -206,7 +206,7 @@ class CommandNSCert : public Command
source.Reply(_("\002%s\002 added to %s's certificate list."), certfp.c_str(), nc->display.c_str());
}
- void DoDel(CommandSource &source, NickCore *nc, Anope::string certfp)
+ void DoDel(CommandSource &source, NickServ::Account *nc, Anope::string certfp)
{
NSCertList *cl = nc->Require<NSCertList>("certificates");
@@ -235,7 +235,7 @@ class CommandNSCert : public Command
source.Reply(_("\002%s\002 deleted from %s's certificate list."), certfp.c_str(), nc->display.c_str());
}
- void DoList(CommandSource &source, const NickCore *nc)
+ void DoList(CommandSource &source, const NickServ::Account *nc)
{
NSCertList *cl = nc->GetExt<NSCertList>("certificates");
@@ -275,10 +275,10 @@ class CommandNSCert : public Command
certfp = params.size() > 1 ? params[params.size() - 1] : "";
}
- NickCore *nc;
+ NickServ::Account *nc;
if (!nick.empty())
{
- const NickAlias *na = NickAlias::Find(nick);
+ const NickServ::Nick *na = NickServ::FindNick(nick);
if (na == NULL)
{
source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
@@ -371,11 +371,11 @@ class NSCert : public Module
if (!NickServ || u->IsIdentified())
return;
- NickCore *nc = cs.FindAccountFromCert(u->fingerprint);
+ NickServ::Account *nc = cs.FindAccountFromCert(u->fingerprint);
if (!nc || nc->HasExt("NS_SUSPENDED"))
return;
- NickAlias *na = NickAlias::Find(u->nick);
+ NickServ::Nick *na = NickServ::FindNick(u->nick);
if (na && na->nc == nc)
u->Identify(na);
else
@@ -385,7 +385,7 @@ class NSCert : public Module
Log(NickServ) << u->GetMask() << " automatically identified for account " << nc->display << " via SSL certificate fingerprint";
}
- EventReturn OnNickValidate(User *u, NickAlias *na) override
+ EventReturn OnNickValidate(User *u, NickServ::Nick *na) override
{
NSCertList *cl = certs.Get(na->nc);
if (!u->fingerprint.empty() && cl && cl->FindCert(u->fingerprint))
diff --git a/modules/commands/ns_drop.cpp b/modules/commands/ns_drop.cpp
index fef7682da..bd5fd7305 100644
--- a/modules/commands/ns_drop.cpp
+++ b/modules/commands/ns_drop.cpp
@@ -33,7 +33,7 @@ class CommandNSDrop : public Command
return;
}
- NickAlias *na = NickAlias::Find(nick);
+ NickServ::Nick *na = NickServ::FindNick(nick);
if (!na)
{
source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
diff --git a/modules/commands/ns_getemail.cpp b/modules/commands/ns_getemail.cpp
index 96845571c..b926b6756 100644
--- a/modules/commands/ns_getemail.cpp
+++ b/modules/commands/ns_getemail.cpp
@@ -31,9 +31,9 @@ class CommandNSGetEMail : public Command
Log(LOG_ADMIN, source, this) << "on " << email;
- for (nickcore_map::const_iterator it = NickCoreList->begin(), it_end = NickCoreList->end(); it != it_end; ++it)
+ for (auto& it : NickServ::service->GetAccountList())
{
- const NickCore *nc = it->second;
+ const NickServ::Account *nc = it.second;
if (!nc->email.empty() && nc->email.equals_ci(email))
{
@@ -66,7 +66,7 @@ class CommandNSGetEMail : public Command
class NSGetEMail : public Module
{
CommandNSGetEMail commandnsgetemail;
-
+
public:
NSGetEMail(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR)
, commandnsgetemail(this)
diff --git a/modules/commands/ns_getpass.cpp b/modules/commands/ns_getpass.cpp
index c9bfc0402..344947988 100644
--- a/modules/commands/ns_getpass.cpp
+++ b/modules/commands/ns_getpass.cpp
@@ -24,9 +24,9 @@ class CommandNSGetPass : public Command
{
const Anope::string &nick = params[0];
Anope::string tmp_pass;
- const NickAlias *na;
+ const NickServ::Nick *na;
- if (!(na = NickAlias::Find(nick)))
+ if (!(na = NickServ::FindNick(nick)))
source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
else if (Config->GetModule("nickserv")->Get<bool>("secureadmins", "yes") && na->nc->IsServicesOper())
source.Reply(_("You may not get the password of other Services Operators."));
diff --git a/modules/commands/ns_group.cpp b/modules/commands/ns_group.cpp
index edd12f83d..bc61ee099 100644
--- a/modules/commands/ns_group.cpp
+++ b/modules/commands/ns_group.cpp
@@ -13,24 +13,24 @@
#include "modules/ns_cert.h"
#include "modules/ns_group.h"
-class NSGroupRequest : public IdentifyRequest
+class NSGroupRequestListener : public NickServ::IdentifyRequestListener
{
EventHandlers<Event::NickGroup> &onnickgroup;
CommandSource source;
Command *cmd;
Anope::string nick;
- Reference<NickAlias> target;
-
+ Reference<NickServ::Nick> target;
+
public:
- NSGroupRequest(Module *o, EventHandlers<Event::NickGroup> &event, CommandSource &src, Command *c, const Anope::string &n, NickAlias *targ, const Anope::string &pass) : IdentifyRequest(o, targ->nc->display, pass), onnickgroup(event), source(src), cmd(c), nick(n), target(targ) { }
+ NSGroupRequestListener(EventHandlers<Event::NickGroup> &event, CommandSource &src, Command *c, const Anope::string &n, NickServ::Nick *targ) : onnickgroup(event), source(src), cmd(c), nick(n), target(targ) { }
- void OnSuccess() override
+ void OnSuccess(NickServ::IdentifyRequest *) override
{
if (!source.GetUser() || source.GetUser()->nick != nick || !target || !target->nc)
return;
User *u = source.GetUser();
- NickAlias *na = NickAlias::Find(nick);
+ NickServ::Nick *na = NickServ::FindNick(nick);
/* If the nick is already registered, drop it. */
if (na)
{
@@ -38,7 +38,7 @@ class NSGroupRequest : public IdentifyRequest
delete na;
}
- na = new NickAlias(nick, target->nc);
+ na = NickServ::service->CreateNick(nick, target->nc);
Anope::string last_usermask = u->GetIdent() + "@" + u->GetDisplayedHost();
na->last_usermask = last_usermask;
@@ -55,19 +55,14 @@ class NSGroupRequest : public IdentifyRequest
}
- void OnFail() override
+ void OnFail(NickServ::IdentifyRequest *) override
{
if (!source.GetUser())
return;
Log(LOG_COMMAND, source, cmd) << "and failed to group to " << target->nick;
- if (NickAlias::Find(GetAccount()) != NULL)
- {
- source.Reply(PASSWORD_INCORRECT);
- source.GetUser()->BadPassword();
- }
- else
- source.Reply(NICK_X_NOT_REGISTERED, GetAccount().c_str());
+ source.Reply(PASSWORD_INCORRECT);
+ source.GetUser()->BadPassword();
}
};
@@ -91,7 +86,7 @@ class CommandNSGroup : public Command
Anope::string nick;
if (params.empty())
{
- NickCore* core = u->Account();
+ NickServ::Account* core = u->Account();
if (core)
nick = core->display;
}
@@ -130,11 +125,11 @@ class CommandNSGroup : public Command
}
}
- NickAlias *target, *na = NickAlias::Find(u->nick);
+ NickServ::Nick *target, *na = NickServ::FindNick(u->nick);
const Anope::string &guestnick = Config->GetModule("nickserv")->Get<const Anope::string>("guestnickprefix", "Guest");
time_t reg_delay = Config->GetModule("nickserv")->Get<time_t>("regdelay");
unsigned maxaliases = Config->GetModule(this->owner)->Get<unsigned>("maxaliases");
- if (!(target = NickAlias::Find(nick)))
+ if (!(target = NickServ::FindNick(nick)))
source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
else if (Anope::CurTime < u->lastnickreg + reg_delay)
source.Reply(_("Please wait %d seconds before using the GROUP command again."), (reg_delay + u->lastnickreg) - Anope::CurTime);
@@ -169,18 +164,18 @@ class CommandNSGroup : public Command
if (ok == false && !pass.empty())
{
- NSGroupRequest *req = new NSGroupRequest(owner, this->onnickgroup, source, this, u->nick, target, pass);
+ NickServ::IdentifyRequest *req = NickServ::service->CreateIdentifyRequest(new NSGroupRequestListener(onnickgroup, source, this, u->nick, target), owner, target->nc->display, pass);
Event::OnCheckAuthentication(&Event::CheckAuthentication::OnCheckAuthentication, source.GetUser(), req);
req->Dispatch();
}
else
{
- NSGroupRequest req(owner, this->onnickgroup, source, this, u->nick, target, pass);
+ NSGroupRequestListener req(onnickgroup, source, this, u->nick, target);
if (ok)
- req.OnSuccess();
+ req.OnSuccess(nullptr);
else
- req.OnFail();
+ req.OnFail(nullptr);
}
}
}
@@ -233,7 +228,7 @@ class CommandNSUngroup : public Command
{
User *u = source.GetUser();
Anope::string nick = !params.empty() ? params[0] : "";
- NickAlias *na = NickAlias::Find(!nick.empty() ? nick : u->nick);
+ NickServ::Nick *na = NickServ::FindNick(!nick.empty() ? nick : u->nick);
if (u->Account()->aliases->size() == 1)
source.Reply(_("Your nick is not grouped to anything, you can't ungroup it."));
@@ -243,16 +238,16 @@ class CommandNSUngroup : public Command
source.Reply(_("Nick %s is not in your group."), na->nick.c_str());
else
{
- NickCore *oldcore = na->nc;
+ NickServ::Account *oldcore = na->nc;
- std::vector<NickAlias *>::iterator it = std::find(oldcore->aliases->begin(), oldcore->aliases->end(), na);
+ std::vector<NickServ::Nick *>::iterator it = std::find(oldcore->aliases->begin(), oldcore->aliases->end(), na);
if (it != oldcore->aliases->end())
oldcore->aliases->erase(it);
if (na->nick.equals_ci(oldcore->display))
oldcore->SetDisplay(oldcore->aliases->front());
- NickCore *nc = new NickCore(na->nick);
+ NickServ::Account *nc = NickServ::service->CreateAccount(na->nick);
na->nc = nc;
nc->aliases->push_back(na);
@@ -294,11 +289,11 @@ class CommandNSGList : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
const Anope::string &nick = !params.empty() ? params[0] : "";
- const NickCore *nc;
+ const NickServ::Account *nc;
if (!nick.empty())
{
- const NickAlias *na = NickAlias::Find(nick);
+ const NickServ::Nick *na = NickServ::FindNick(nick);
if (!na)
{
source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
@@ -321,7 +316,7 @@ class CommandNSGList : public Command
unconfirmed_expire = Config->GetModule("nickserv")->Get<time_t>("unconfirmedexpire", "1d");
for (unsigned i = 0; i < nc->aliases->size(); ++i)
{
- const NickAlias *na2 = nc->aliases->at(i);
+ const NickServ::Nick *na2 = nc->aliases->at(i);
Anope::string expires;
if (na2->HasExt("NS_NO_EXPIRE"))
@@ -342,7 +337,7 @@ class CommandNSGList : public Command
source.Reply(!nick.empty() ? _("List of nicknames in the group of \002%s\002:") : _("List of nicknames in your group:"), nc->display.c_str());
std::vector<Anope::string> replies;
list.Process(replies);
-
+
for (unsigned i = 0; i < replies.size(); ++i)
source.Reply(replies[i]);
diff --git a/modules/commands/ns_identify.cpp b/modules/commands/ns_identify.cpp
index 5d7ed4c95..03c79c623 100644
--- a/modules/commands/ns_identify.cpp
+++ b/modules/commands/ns_identify.cpp
@@ -11,24 +11,24 @@
#include "module.h"
-class NSIdentifyRequest : public IdentifyRequest
+class NSIdentifyRequestListener : public NickServ::IdentifyRequestListener
{
CommandSource source;
Command *cmd;
public:
- NSIdentifyRequest(Module *o, CommandSource &s, Command *c, const Anope::string &acc, const Anope::string &pass) : IdentifyRequest(o, acc, pass), source(s), cmd(c) { }
+ NSIdentifyRequestListener(CommandSource &s, Command *c) : source(s), cmd(c) { }
- void OnSuccess() override
+ void OnSuccess(NickServ::IdentifyRequest *req) override
{
if (!source.GetUser())
return;
User *u = source.GetUser();
- NickAlias *na = NickAlias::Find(GetAccount());
+ NickServ::Nick *na = NickServ::FindNick(req->GetAccount());
if (!na)
- source.Reply(NICK_X_NOT_REGISTERED, GetAccount().c_str());
+ source.Reply(NICK_X_NOT_REGISTERED, req->GetAccount().c_str());
else
{
if (u->IsIdentified())
@@ -40,19 +40,19 @@ class NSIdentifyRequest : public IdentifyRequest
}
}
- void OnFail() override
+ void OnFail(NickServ::IdentifyRequest *req) override
{
if (source.GetUser())
{
- bool accountexists = NickAlias::Find(GetAccount()) != NULL;
- Log(LOG_COMMAND, source, cmd) << "and failed to identify to" << (accountexists ? " " : " nonexistent ") << "account " << GetAccount();
+ bool accountexists = NickServ::FindNick(req->GetAccount()) != NULL;
+ Log(LOG_COMMAND, source, cmd) << "and failed to identify to" << (accountexists ? " " : " nonexistent ") << "account " << req->GetAccount();
if (accountexists)
{
source.Reply(PASSWORD_INCORRECT);
source.GetUser()->BadPassword();
}
else
- source.Reply(NICK_X_NOT_REGISTERED, GetAccount().c_str());
+ source.Reply(NICK_X_NOT_REGISTERED, req->GetAccount().c_str());
}
}
};
@@ -75,14 +75,14 @@ class CommandNSIdentify : public Command
const Anope::string &nick = params.size() == 2 ? params[0] : u->nick;
Anope::string pass = params[params.size() - 1];
- NickAlias *na = NickAlias::Find(nick);
+ NickServ::Nick *na = NickServ::FindNick(nick);
if (na && na->nc->HasExt("NS_SUSPENDED"))
source.Reply(NICK_X_SUSPENDED, na->nick.c_str());
else if (u->Account() && na && u->Account() == na->nc)
source.Reply(_("You are already identified."));
else
{
- NSIdentifyRequest *req = new NSIdentifyRequest(owner, source, this, na ? na->nc->display : nick, pass);
+ NickServ::IdentifyRequest *req = NickServ::service->CreateIdentifyRequest(new NSIdentifyRequestListener(source, this), owner, na ? na->nc->display : nick, pass);
Event::OnCheckAuthentication(&Event::CheckAuthentication::OnCheckAuthentication, u, req);
req->Dispatch();
}
diff --git a/modules/commands/ns_info.cpp b/modules/commands/ns_info.cpp
index 16f51db07..5bf413591 100644
--- a/modules/commands/ns_info.cpp
+++ b/modules/commands/ns_info.cpp
@@ -29,7 +29,7 @@ class CommandNSInfo : public Command
{
const Anope::string &nick = params.size() ? params[0] : (source.nc ? source.nc->display : source.GetNick());
- NickAlias *na = NickAlias::Find(nick);
+ NickServ::Nick *na = NickServ::FindNick(nick);
bool has_auspex = source.HasPriv("nickserv/auspex");
if (!na)
@@ -150,13 +150,13 @@ class CommandNSSetHide : public Command
return;
}
- const NickAlias *na = NickAlias::Find(user);
+ const NickServ::Nick *na = NickServ::FindNick(user);
if (!na)
{
source.Reply(NICK_X_NOT_REGISTERED, user.c_str());
return;
}
- NickCore *nc = na->nc;
+ NickServ::Account *nc = na->nc;
EventReturn MOD_RESULT = Event::OnSetNickOption(&Event::SetNickOption::OnSetNickOption, source, this, nc, param);
if (MOD_RESULT == EVENT_STOP)
diff --git a/modules/commands/ns_list.cpp b/modules/commands/ns_list.cpp
index 0037cbcc5..78daff7ef 100644
--- a/modules/commands/ns_list.cpp
+++ b/modules/commands/ns_list.cpp
@@ -26,7 +26,7 @@ class CommandNSList : public Command
{
Anope::string pattern = params[0];
- const NickCore *mync;
+ const NickServ::Account *mync;
unsigned nnicks;
bool is_servadmin = source.HasCommand("nickserv/list");
int count = 0, from = 0, to = 0;
@@ -76,13 +76,13 @@ class CommandNSList : public Command
list.AddColumn(_("Nick")).AddColumn(_("Last usermask"));
- Anope::map<NickAlias *> ordered_map;
- for (nickalias_map::const_iterator it = NickAliasList->begin(), it_end = NickAliasList->end(); it != it_end; ++it)
- ordered_map[it->first] = it->second;
+ Anope::map<NickServ::Nick *> ordered_map;
+ for (auto& it : NickServ::service->GetNickList())
+ ordered_map[it.first] = it.second;
- for (Anope::map<NickAlias *>::const_iterator it = ordered_map.begin(), it_end = ordered_map.end(); it != it_end; ++it)
+ for (Anope::map<NickServ::Nick *>::const_iterator it = ordered_map.begin(), it_end = ordered_map.end(); it != it_end; ++it)
{
- const NickAlias *na = it->second;
+ const NickServ::Nick *na = it->second;
/* Don't show private nicks to non-services admins. */
if (na->nc->HasExt("NS_PRIVATE") && !is_servadmin && na->nc != mync)
@@ -121,7 +121,7 @@ class CommandNSList : public Command
++count;
}
}
-
+
source.Reply(_("List of entries matching \002%s\002:"), pattern.c_str());
std::vector<Anope::string> replies;
@@ -197,13 +197,13 @@ class CommandNSSetPrivate : public Command
return;
}
- const NickAlias *na = NickAlias::Find(user);
+ const NickServ::Nick *na = NickServ::FindNick(user);
if (!na)
{
source.Reply(NICK_X_NOT_REGISTERED, user.c_str());
return;
}
- NickCore *nc = na->nc;
+ NickServ::Account *nc = na->nc;
EventReturn MOD_RESULT = Event::OnSetNickOption(&Event::SetNickOption::OnSetNickOption, source, this, nc, param);
if (MOD_RESULT == EVENT_STOP)
@@ -293,7 +293,7 @@ class NSList : public Module
{
}
- void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool show_all) override
+ void OnNickInfo(CommandSource &source, NickServ::Nick *na, InfoFormatter &info, bool show_all) override
{
if (!show_all)
return;
diff --git a/modules/commands/ns_recover.cpp b/modules/commands/ns_recover.cpp
index de83ea619..3307c6668 100644
--- a/modules/commands/ns_recover.cpp
+++ b/modules/commands/ns_recover.cpp
@@ -15,22 +15,23 @@
typedef std::map<Anope::string, ChannelStatus> NSRecoverInfo;
-class NSRecoverRequest : public IdentifyRequest
+class NSRecoverRequestListener : public NickServ::IdentifyRequestListener
{
CommandSource source;
Command *cmd;
Anope::string user;
-
+ Anope::string pass;
+
public:
- NSRecoverRequest(Module *o, CommandSource &src, Command *c, const Anope::string &nick, const Anope::string &pass) : IdentifyRequest(o, nick, pass), source(src), cmd(c), user(nick) { }
+ NSRecoverRequestListener(CommandSource &src, Command *c, const Anope::string &nick, const Anope::string &p) : source(src), cmd(c), user(nick), pass(p) { }
- void OnSuccess() override
+ void OnSuccess(NickServ::IdentifyRequest *) override
{
User *u = User::Find(user, true);
if (!source.GetUser() || !source.service)
return;
- NickAlias *na = NickAlias::Find(user);
+ NickServ::Nick *na = NickServ::FindNick(user);
if (!na)
return;
@@ -66,7 +67,7 @@ class NSRecoverRequest : public IdentifyRequest
}
}
- u->SendMessage(source.service, _("This nickname has been recovered by %s. If you did not do\n"
+ u->SendMessage(*source.service, _("This nickname has been recovered by %s. If you did not do\n"
"this then %s may have your password, and you should change it."),
source.GetNick().c_str(), source.GetNick().c_str());
@@ -76,7 +77,7 @@ class NSRecoverRequest : public IdentifyRequest
source.Reply(_("Ghost with your nick has been killed."));
if (IRCD->CanSVSNick)
- IRCD->SendForceNickChange(source.GetUser(), GetAccount(), Anope::CurTime);
+ IRCD->SendForceNickChange(source.GetUser(), user, Anope::CurTime);
}
/* User is not identified or not identified to the same account as the person using this command */
else
@@ -87,7 +88,7 @@ class NSRecoverRequest : public IdentifyRequest
Log(LOG_COMMAND, source, cmd) << "and was automatically identified to " << na->nick << " (" << na->nc->display << ")";
}
- u->SendMessage(source.service, _("This nickname has been recovered by %s."), source.GetNick().c_str());
+ u->SendMessage(*source.service, _("This nickname has been recovered by %s."), source.GetNick().c_str());
if (NickServ::service)
NickServ::service->Collide(u, na);
@@ -95,7 +96,7 @@ class NSRecoverRequest : public IdentifyRequest
{
/* If we can svsnick then release our hold and svsnick the user using the command */
NickServ::service->Release(na);
- IRCD->SendForceNickChange(source.GetUser(), GetAccount(), Anope::CurTime);
+ IRCD->SendForceNickChange(source.GetUser(), user, Anope::CurTime);
}
else
source.Reply(_("The user with your nick has been removed. Use this command again\n"
@@ -103,20 +104,20 @@ class NSRecoverRequest : public IdentifyRequest
}
}
- void OnFail() override
+ void OnFail(NickServ::IdentifyRequest *) override
{
- if (NickAlias::Find(GetAccount()) != NULL)
+ if (NickServ::FindNick(user) != NULL)
{
source.Reply(ACCESS_DENIED);
- if (!GetPassword().empty())
+ if (!pass.empty())
{
- Log(LOG_COMMAND, source, cmd) << "with an invalid password for " << GetAccount();
+ Log(LOG_COMMAND, source, cmd) << "with an invalid password for " << user;
if (source.GetUser())
source.GetUser()->BadPassword();
}
}
else
- source.Reply(NICK_X_NOT_REGISTERED, GetAccount().c_str());
+ source.Reply(NICK_X_NOT_REGISTERED, user.c_str());
}
};
@@ -143,7 +144,7 @@ class CommandNSRecover : public Command
return;
}
- const NickAlias *na = NickAlias::Find(nick);
+ const NickServ::Nick *na = NickServ::FindNick(nick);
if (!na)
{
@@ -168,18 +169,18 @@ class CommandNSRecover : public Command
if (ok == false && !pass.empty())
{
- NSRecoverRequest *req = new NSRecoverRequest(owner, source, this, na->nick, pass);
+ NickServ::IdentifyRequest *req = NickServ::service->CreateIdentifyRequest(new NSRecoverRequestListener(source, this, na->nick, pass), owner, na->nick, pass);
Event::OnCheckAuthentication(&Event::CheckAuthentication::OnCheckAuthentication, source.GetUser(), req);
req->Dispatch();
}
else
{
- NSRecoverRequest req(owner, source, this, na->nick, pass);
+ NSRecoverRequestListener req(source, this, na->nick, pass);
if (ok)
- req.OnSuccess();
+ req.OnSuccess(nullptr);
else
- req.OnFail();
+ req.OnFail(nullptr);
}
}
diff --git a/modules/commands/ns_register.cpp b/modules/commands/ns_register.cpp
index 802292c91..590ced8dc 100644
--- a/modules/commands/ns_register.cpp
+++ b/modules/commands/ns_register.cpp
@@ -12,7 +12,7 @@
#include "module.h"
#include "modules/nickserv.h"
-static bool SendRegmail(User *u, const NickAlias *na, BotInfo *bi);
+static bool SendRegmail(User *u, const NickServ::Nick *na, BotInfo *bi);
class CommandNSConfirm : public Command
{
@@ -30,7 +30,7 @@ class CommandNSConfirm : public Command
if (source.nc && !source.nc->HasExt("UNCONFIRMED") && source.HasPriv("nickserv/confirm"))
{
- NickAlias *na = NickAlias::Find(passcode);
+ NickServ::Nick *na = NickServ::FindNick(passcode);
if (na == NULL)
source.Reply(NICK_X_NOT_REGISTERED, passcode.c_str());
else if (na->nc->HasExt("UNCONFIRMED") == false)
@@ -47,7 +47,7 @@ class CommandNSConfirm : public Command
Anope::string *code = source.nc->GetExt<Anope::string>("passcode");
if (code != NULL && *code == passcode)
{
- NickCore *nc = source.nc;
+ NickServ::Account *nc = source.nc;
nc->Shrink<Anope::string>("passcode");
Log(LOG_COMMAND, source, this) << "to confirm their email";
source.Reply(_("Your email address of \002%s\002 has been confirmed."), source.nc->email.c_str());
@@ -55,7 +55,7 @@ class CommandNSConfirm : public Command
if (source.GetUser())
{
- NickAlias *na = NickAlias::Find(source.GetNick());
+ NickServ::Nick *na = NickServ::FindNick(source.GetNick());
if (na)
{
IRCD->SendLogin(source.GetUser(), na);
@@ -173,7 +173,7 @@ class CommandNSRegister : public Command
this->OnSyntaxError(source, "");
else if (u && Anope::CurTime < u->lastnickreg + reg_delay)
source.Reply(_("Please wait %d seconds before using the REGISTER command again."), (u->lastnickreg + reg_delay) - Anope::CurTime);
- else if (NickAlias::Find(u_nick) != NULL)
+ else if (NickServ::FindNick(u_nick) != NULL)
source.Reply(NICK_ALREADY_REGISTERED, u_nick.c_str());
else if (pass.equals_ci(u_nick) || (Config->GetBlock("options")->Get<bool>("strictpasswords") && pass.length() < 5))
source.Reply(MORE_OBSCURE_PASSWORD);
@@ -183,8 +183,8 @@ class CommandNSRegister : public Command
source.Reply(MAIL_X_INVALID, email.c_str());
else
{
- NickCore *nc = new NickCore(u_nick);
- NickAlias *na = new NickAlias(u_nick, nc);
+ NickServ::Account *nc = NickServ::service->CreateAccount(u_nick);
+ NickServ::Nick *na = NickServ::service->CreateNick(u_nick, nc);
Anope::Encrypt(pass, nc->pass);
if (!email.empty())
nc->email = email;
@@ -291,7 +291,7 @@ class CommandNSResend : public Command
return;
}
- const NickAlias *na = NickAlias::Find(source.GetNick());
+ const NickServ::Nick *na = NickServ::FindNick(source.GetNick());
if (na == NULL)
source.Reply(NICK_NOT_REGISTERED);
@@ -367,7 +367,7 @@ class NSRegister : public Module
u->SendMessage(NickServ, _("All new accounts must be validated by an administrator. Please wait for your registration to be confirmed."));
else
u->SendMessage(NickServ, _("Your email address is not confirmed. To confirm it, follow the instructions that were emailed to you."));
- const NickAlias *this_na = NickAlias::Find(u->Account()->display);
+ const NickServ::Nick *this_na = NickServ::FindNick(u->Account()->display);
time_t time_registered = Anope::CurTime - this_na->time_registered;
time_t unconfirmed_expire = Config->GetModule(this)->Get<time_t>("unconfirmedexpire", "1d");
if (unconfirmed_expire > time_registered)
@@ -375,7 +375,7 @@ class NSRegister : public Module
}
}
- void OnPreNickExpire(NickAlias *na, bool &expire) override
+ void OnPreNickExpire(NickServ::Nick *na, bool &expire) override
{
if (unconfirmed.HasExt(na->nc))
{
@@ -386,9 +386,9 @@ class NSRegister : public Module
}
};
-static bool SendRegmail(User *u, const NickAlias *na, BotInfo *bi)
+static bool SendRegmail(User *u, const NickServ::Nick *na, BotInfo *bi)
{
- NickCore *nc = na->nc;
+ NickServ::Account *nc = na->nc;
Anope::string *code = na->nc->GetExt<Anope::string>("passcode");
if (code == NULL)
diff --git a/modules/commands/ns_resetpass.cpp b/modules/commands/ns_resetpass.cpp
index af5c43cb7..d4171807d 100644
--- a/modules/commands/ns_resetpass.cpp
+++ b/modules/commands/ns_resetpass.cpp
@@ -11,7 +11,7 @@
#include "module.h"
-static bool SendResetEmail(User *u, const NickAlias *na, BotInfo *bi);
+static bool SendResetEmail(User *u, const NickServ::Nick *na, BotInfo *bi);
class CommandNSResetPass : public Command
{
@@ -25,9 +25,9 @@ class CommandNSResetPass : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
- const NickAlias *na;
+ const NickServ::Nick *na;
- if (!(na = NickAlias::Find(params[0])))
+ if (!(na = NickServ::FindNick(params[0])))
source.Reply(NICK_X_NOT_REGISTERED, params[0].c_str());
else if (!na->nc->email.equals_ci(params[1]))
source.Reply(_("Incorrect email address."));
@@ -85,12 +85,12 @@ class NSResetPass : public Module
return EVENT_STOP;
}
- NickAlias *na = NickAlias::Find(params[0]);
+ NickServ::Nick *na = NickServ::FindNick(params[0]);
ResetInfo *ri = na ? reset.Get(na->nc) : NULL;
if (na && ri)
{
- NickCore *nc = na->nc;
+ NickServ::Account *nc = na->nc;
const Anope::string &passcode = params[1];
if (ri->time < Anope::CurTime - 3600)
{
@@ -121,7 +121,7 @@ class NSResetPass : public Module
}
};
-static bool SendResetEmail(User *u, const NickAlias *na, BotInfo *bi)
+static bool SendResetEmail(User *u, const NickServ::Nick *na, BotInfo *bi)
{
Anope::string subject = Language::Translate(na->nc, Config->GetBlock("mail")->Get<const Anope::string>("reset_subject").c_str()),
message = Language::Translate(na->nc, Config->GetBlock("mail")->Get<const Anope::string>("reset_message").c_str()),
diff --git a/modules/commands/ns_set.cpp b/modules/commands/ns_set.cpp
index 89f3c5e83..984f1d002 100644
--- a/modules/commands/ns_set.cpp
+++ b/modules/commands/ns_set.cpp
@@ -179,13 +179,13 @@ class CommandNSSASetPassword : public Command
return;
}
- const NickAlias *setter_na = NickAlias::Find(params[0]);
+ const NickServ::Nick *setter_na = NickServ::FindNick(params[0]);
if (setter_na == NULL)
{
source.Reply(NICK_X_NOT_REGISTERED, params[0].c_str());
return;
}
- NickCore *nc = setter_na->nc;
+ NickServ::Account *nc = setter_na->nc;
size_t len = params[1].length();
@@ -241,13 +241,13 @@ class CommandNSSetAutoOp : public Command
return;
}
- const NickAlias *na = NickAlias::Find(user);
+ const NickServ::Nick *na = NickServ::FindNick(user);
if (na == NULL)
{
source.Reply(NICK_X_NOT_REGISTERED, user.c_str());
return;
}
- NickCore *nc = na->nc;
+ NickServ::Account *nc = na->nc;
EventReturn MOD_RESULT;
MOD_RESULT = Event::OnSetNickOption(&Event::SetNickOption::OnSetNickOption, source, this, nc, param);
@@ -333,7 +333,7 @@ class CommandNSSetDisplay : public Command
return;
}
- const NickAlias *user_na = NickAlias::Find(user), *na = NickAlias::Find(param);
+ const NickServ::Nick *user_na = NickServ::FindNick(user), *na = NickServ::FindNick(param);
if (Config->GetModule("nickserv")->Get<bool>("nonicknameownership"))
{
@@ -406,7 +406,7 @@ class CommandNSSetEmail : public Command
static bool SendConfirmMail(User *u, BotInfo *bi, const Anope::string &new_email)
{
Anope::string code = Anope::Random(9);
-
+
std::pair<Anope::string, Anope::string> *n = u->Account()->Extend<std::pair<Anope::string, Anope::string> >("ns_set_email");
n->first = new_email;
n->second = code;
@@ -444,13 +444,13 @@ class CommandNSSetEmail : public Command
return;
}
- const NickAlias *na = NickAlias::Find(user);
+ const NickServ::Nick *na = NickServ::FindNick(user);
if (!na)
{
source.Reply(NICK_X_NOT_REGISTERED, user.c_str());
return;
}
- NickCore *nc = na->nc;
+ NickServ::Account *nc = na->nc;
if (nc->HasExt("UNCONFIRMED"))
{
@@ -557,13 +557,13 @@ class CommandNSSetKeepModes : public Command
return;
}
- const NickAlias *na = NickAlias::Find(user);
+ const NickServ::Nick *na = NickServ::FindNick(user);
if (!na)
{
source.Reply(NICK_X_NOT_REGISTERED, user.c_str());
return;
}
- NickCore *nc = na->nc;
+ NickServ::Account *nc = na->nc;
EventReturn MOD_RESULT;
MOD_RESULT = Event::OnSetNickOption(&Event::SetNickOption::OnSetNickOption, source, this, nc, param);
@@ -650,13 +650,13 @@ class CommandNSSetKill : public Command
return;
}
- const NickAlias *na = NickAlias::Find(user);
+ const NickServ::Nick *na = NickServ::FindNick(user);
if (!na)
{
source.Reply(NICK_X_NOT_REGISTERED, user.c_str());
return;
}
- NickCore *nc = na->nc;
+ NickServ::Account *nc = na->nc;
EventReturn MOD_RESULT;
MOD_RESULT = Event::OnSetNickOption(&Event::SetNickOption::OnSetNickOption, source, this, nc, param);
@@ -782,13 +782,13 @@ class CommandNSSetLanguage : public Command
return;
}
- const NickAlias *na = NickAlias::Find(user);
+ const NickServ::Nick *na = NickServ::FindNick(user);
if (!na)
{
source.Reply(NICK_X_NOT_REGISTERED, user.c_str());
return;
}
- NickCore *nc = na->nc;
+ NickServ::Account *nc = na->nc;
EventReturn MOD_RESULT;
MOD_RESULT = Event::OnSetNickOption(&Event::SetNickOption::OnSetNickOption, source, this, nc, param);
@@ -891,13 +891,13 @@ class CommandNSSetMessage : public Command
return;
}
- const NickAlias *na = NickAlias::Find(user);
+ const NickServ::Nick *na = NickServ::FindNick(user);
if (!na)
{
source.Reply(NICK_X_NOT_REGISTERED, user.c_str());
return;
}
- NickCore *nc = na->nc;
+ NickServ::Account *nc = na->nc;
if (!Config->GetBlock("options")->Get<bool>("useprivmsg"))
{
@@ -995,13 +995,13 @@ class CommandNSSetSecure : public Command
return;
}
- const NickAlias *na = NickAlias::Find(user);
+ const NickServ::Nick *na = NickServ::FindNick(user);
if (!na)
{
source.Reply(NICK_X_NOT_REGISTERED, user.c_str());
return;
}
- NickCore *nc = na->nc;
+ NickServ::Account *nc = na->nc;
EventReturn MOD_RESULT;
MOD_RESULT = Event::OnSetNickOption(&Event::SetNickOption::OnSetNickOption, source, this, nc, param);
@@ -1090,7 +1090,7 @@ class CommandNSSASetNoexpire : public Command
return;
}
- NickAlias *na = NickAlias::Find(params[0]);
+ NickServ::Nick *na = NickServ::FindNick(params[0]);
if (na == NULL)
{
source.Reply(NICK_X_NOT_REGISTERED, params[0].c_str());
@@ -1168,7 +1168,7 @@ class NSSet : public Module
SerializableExtensibleItem<bool> autoop, killprotect, kill_quick, kill_immed,
message, secure, noexpire;
-
+
struct KeepModes : SerializableExtensibleItem<bool>
{
KeepModes(Module *m, const Anope::string &n) : SerializableExtensibleItem<bool>(m, n) { }
@@ -1177,10 +1177,10 @@ class NSSet : public Module
{
SerializableExtensibleItem<bool>::ExtensibleSerialize(e, s, data);
- if (s->GetSerializableType()->GetName() != "NickCore")
+ if (s->GetSerializableType()->GetName() != "NickServ::Account")
return;
- const NickCore *nc = anope_dynamic_static_cast<const NickCore *>(s);
+ const NickServ::Account *nc = anope_dynamic_static_cast<const NickServ::Account *>(s);
Anope::string modes;
for (User::ModeList::const_iterator it = nc->last_modes.begin(); it != nc->last_modes.end(); ++it)
{
@@ -1197,10 +1197,10 @@ class NSSet : public Module
{
SerializableExtensibleItem<bool>::ExtensibleUnserialize(e, s, data);
- if (s->GetSerializableType()->GetName() != "NickCore")
+ if (s->GetSerializableType()->GetName() != "NickServ::Account")
return;
- NickCore *nc = anope_dynamic_static_cast<NickCore *>(s);
+ NickServ::Account *nc = anope_dynamic_static_cast<NickServ::Account *>(s);
Anope::string modes;
data["last_modes"] >> modes;
for (spacesepstream sep(modes); sep.GetToken(modes);)
@@ -1264,7 +1264,7 @@ class NSSet : public Module
EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> &params) override
{
- NickCore *uac = source.nc;
+ NickServ::Account *uac = source.nc;
if (command->name == "nickserv/confirm" && !params.empty() && uac)
{
@@ -1285,7 +1285,7 @@ class NSSet : public Module
return EVENT_CONTINUE;
}
- void OnSetCorrectModes(User *user, Channel *chan, AccessGroup &access, bool &give_modes, bool &take_modes) override
+ void OnSetCorrectModes(User *user, Channel *chan, ChanServ::AccessGroup &access, bool &give_modes, bool &take_modes) override
{
if (chan->ci)
{
@@ -1294,13 +1294,13 @@ class NSSet : public Module
}
}
- void OnPreNickExpire(NickAlias *na, bool &expire) override
+ void OnPreNickExpire(NickServ::Nick *na, bool &expire) override
{
if (noexpire.HasExt(na))
expire = false;
}
- void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool show_hidden) override
+ void OnNickInfo(CommandSource &source, NickServ::Nick *na, InfoFormatter &info, bool show_hidden) override
{
if (!show_hidden)
return;
diff --git a/modules/commands/ns_set_misc.cpp b/modules/commands/ns_set_misc.cpp
index bf3ea8660..4038b9cc1 100644
--- a/modules/commands/ns_set_misc.cpp
+++ b/modules/commands/ns_set_misc.cpp
@@ -37,7 +37,7 @@ struct NSMiscData : MiscData, Serializable
{
NSMiscData(Extensible *) : Serializable("NSMiscData") { }
- NSMiscData(NickCore *ncore, const Anope::string &n, const Anope::string &d) : Serializable("NSMiscData")
+ NSMiscData(NickServ::Account *ncore, const Anope::string &n, const Anope::string &d) : Serializable("NSMiscData")
{
object = ncore->display;
name = n;
@@ -59,7 +59,7 @@ struct NSMiscData : MiscData, Serializable
data["name"] >> sname;
data["data"] >> sdata;
- NickCore *nc = NickCore::Find(snc);
+ NickServ::Account *nc = NickServ::FindAccount(snc);
if (nc == NULL)
return NULL;
@@ -106,13 +106,13 @@ class CommandNSSetMisc : public Command
return;
}
- const NickAlias *na = NickAlias::Find(user);
+ const NickServ::Nick *na = NickServ::FindNick(user);
if (!na)
{
source.Reply(NICK_X_NOT_REGISTERED, user.c_str());
return;
}
- NickCore *nc = na->nc;
+ NickServ::Account *nc = na->nc;
EventReturn MOD_RESULT = Event::OnSetNickOption(&Event::SetNickOption::OnSetNickOption, source, this, nc, param);
if (MOD_RESULT == EVENT_STOP)
@@ -206,7 +206,7 @@ class NSSetMisc : public Module
for (int i = 0; i < conf->CountBlock("command"); ++i)
{
Configuration::Block *block = conf->GetBlock("command", i);
-
+
const Anope::string &cmd = block->Get<const Anope::string>("command");
if (cmd != "nickserv/set/misc" && cmd != "nickserv/saset/misc")
@@ -222,7 +222,7 @@ class NSSetMisc : public Module
}
}
- void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool) override
+ void OnNickInfo(CommandSource &source, NickServ::Nick *na, InfoFormatter &info, bool) override
{
for (Anope::map<ExtensibleItem<NSMiscData> *>::iterator it = items.begin(); it != items.end(); ++it)
{
diff --git a/modules/commands/ns_status.cpp b/modules/commands/ns_status.cpp
index f4c8c7192..24c901a52 100644
--- a/modules/commands/ns_status.cpp
+++ b/modules/commands/ns_status.cpp
@@ -24,7 +24,7 @@ class CommandNSStatus : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
const Anope::string &nick = !params.empty() ? params[0] : source.GetNick();
- const NickAlias *na = NickAlias::Find(nick);
+ const NickServ::Nick *na = NickServ::FindNick(nick);
spacesepstream sep(nick);
Anope::string nickbuf;
diff --git a/modules/commands/ns_suspend.cpp b/modules/commands/ns_suspend.cpp
index ca669d537..ae8dd20ee 100644
--- a/modules/commands/ns_suspend.cpp
+++ b/modules/commands/ns_suspend.cpp
@@ -37,7 +37,7 @@ struct NSSuspendInfo : SuspendInfo, Serializable
si = anope_dynamic_static_cast<NSSuspendInfo *>(obj);
else
{
- NickAlias *na = NickAlias::Find(snick);
+ NickServ::Nick *na = NickServ::FindNick(snick);
if (!na)
return NULL;
si = na->nc->Extend<NSSuspendInfo>("NS_SUSPENDED");
@@ -90,7 +90,7 @@ class CommandNSSuspend : public Command
}
}
- NickAlias *na = NickAlias::Find(nick);
+ NickServ::Nick *na = NickServ::FindNick(nick);
if (!na)
{
source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
@@ -109,7 +109,7 @@ class CommandNSSuspend : public Command
return;
}
- NickCore *nc = na->nc;
+ NickServ::Account *nc = na->nc;
NSSuspendInfo *si = nc->Extend<NSSuspendInfo>("NS_SUSPENDED");
si->what = nc->display;
@@ -120,7 +120,7 @@ class CommandNSSuspend : public Command
for (unsigned i = 0; i < nc->aliases->size(); ++i)
{
- NickAlias *na2 = nc->aliases->at(i);
+ NickServ::Nick *na2 = nc->aliases->at(i);
if (na2 && *na2->nc == *na->nc)
{
@@ -172,7 +172,7 @@ class CommandNSUnSuspend : public Command
if (Anope::ReadOnly)
source.Reply(READ_ONLY_MODE);
- NickAlias *na = NickAlias::Find(nick);
+ NickServ::Nick *na = NickServ::FindNick(nick);
if (!na)
{
source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
@@ -231,7 +231,7 @@ class NSSuspend : public Module
{
}
- void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool show_hidden) override
+ void OnNickInfo(CommandSource &source, NickServ::Nick *na, InfoFormatter &info, bool show_hidden) override
{
NSSuspendInfo *s = suspend.Get(na->nc);
if (s)
@@ -248,7 +248,7 @@ class NSSuspend : public Module
}
}
- void OnPreNickExpire(NickAlias *na, bool &expire) override
+ void OnPreNickExpire(NickServ::Nick *na, bool &expire) override
{
NSSuspendInfo *s = suspend.Get(na->nc);
if (!s)
@@ -268,7 +268,7 @@ class NSSuspend : public Module
}
}
- EventReturn OnNickValidate(User *u, NickAlias *na) override
+ EventReturn OnNickValidate(User *u, NickServ::Nick *na) override
{
NSSuspendInfo *s = suspend.Get(na->nc);
if (!s)
diff --git a/modules/commands/ns_update.cpp b/modules/commands/ns_update.cpp
index 1fa9c5b36..682c57c6f 100644
--- a/modules/commands/ns_update.cpp
+++ b/modules/commands/ns_update.cpp
@@ -26,7 +26,7 @@ class CommandNSUpdate : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
User *u = source.GetUser();
- NickAlias *na = NickAlias::Find(u->nick);
+ NickServ::Nick *na = NickServ::FindNick(u->nick);
if (na && na->nc == source.GetAccount())
{
diff --git a/modules/commands/os_akill.cpp b/modules/commands/os_akill.cpp
index 971b284e5..bf2a1abe8 100644
--- a/modules/commands/os_akill.cpp
+++ b/modules/commands/os_akill.cpp
@@ -304,7 +304,7 @@ class CommandOSAKill : public Command
else
{
source.Reply(_("Current AKILL list:"));
-
+
std::vector<Anope::string> replies;
list.Process(replies);
diff --git a/modules/commands/os_config.cpp b/modules/commands/os_config.cpp
index e81030bc9..e0ed86e8b 100644
--- a/modules/commands/os_config.cpp
+++ b/modules/commands/os_config.cpp
@@ -53,7 +53,7 @@ class CommandOSConfig : public Command
const Anope::string show_blocks[] = { "serverinfo", "networkinfo", "options", "" };
Log(LOG_ADMIN, source, this) << "VIEW";
-
+
for (unsigned i = 0; !show_blocks[i].empty(); ++i)
{
Configuration::Block *block = Config->GetBlock(show_blocks[i]);
diff --git a/modules/commands/os_defcon.cpp b/modules/commands/os_defcon.cpp
index 29e6638d4..2732f1a3e 100644
--- a/modules/commands/os_defcon.cpp
+++ b/modules/commands/os_defcon.cpp
@@ -81,19 +81,19 @@ struct DefconConfig
{
DefConModesOnParams.erase(name);
}
-
+
bool GetDefConParam(const Anope::string &name, Anope::string &buf)
{
std::map<Anope::string, Anope::string>::iterator it = DefConModesOnParams.find(name);
-
+
buf.clear();
-
+
if (it != DefConModesOnParams.end())
{
buf = it->second;
return true;
}
-
+
return false;
}
};
@@ -334,7 +334,7 @@ class OSDefcon : public Module
if ((cm = ModeManager::FindChannelModeByName("REDIRECT")) && DConfig.DefConModesOn.count(cm->name) && !DConfig.DefConModesOn.count("LIMIT"))
{
DConfig.DefConModesOn.erase("REDIRECT");
-
+
Log(this) << "DefConChanModes must lock mode +l as well to lock mode +L";
}
}
diff --git a/modules/commands/os_dns.cpp b/modules/commands/os_dns.cpp
index d76ad451f..0f47eb3e8 100644
--- a/modules/commands/os_dns.cpp
+++ b/modules/commands/os_dns.cpp
@@ -423,7 +423,7 @@ class CommandOSDNS : public Command
{
DNSServer *s = DNSServer::Find(params[1]);
const Anope::string &zone = params.size() > 2 ? params[2] : "";
-
+
if (!s)
{
source.Reply(_("Server %s does not exist."), params[1].c_str());
@@ -485,7 +485,7 @@ class CommandOSDNS : public Command
void AddIP(CommandSource &source, const std::vector<Anope::string> &params)
{
DNSServer *s = DNSServer::Find(params[1]);
-
+
if (!s)
{
source.Reply(_("Server %s does not exist."), params[1].c_str());
@@ -520,11 +520,11 @@ class CommandOSDNS : public Command
dnsmanager->Notify(*it);
}
}
-
+
void DelIP(CommandSource &source, const std::vector<Anope::string> &params)
{
DNSServer *s = DNSServer::Find(params[1]);
-
+
if (!s)
{
source.Reply(_("Server %s does not exist."), params[1].c_str());
@@ -563,7 +563,7 @@ class CommandOSDNS : public Command
void OnSet(CommandSource &source, const std::vector<Anope::string> &params)
{
DNSServer *s = DNSServer::Find(params[1]);
-
+
if (!s)
{
source.Reply(_("Server %s does not exist."), params[1].c_str());
@@ -596,7 +596,7 @@ class CommandOSDNS : public Command
void OnPool(CommandSource &source, const std::vector<Anope::string> &params)
{
DNSServer *s = DNSServer::Find(params[1]);
-
+
if (!s)
{
source.Reply(_("Server %s does not exist."), params[1].c_str());
@@ -631,7 +631,7 @@ class CommandOSDNS : public Command
void OnDepool(CommandSource &source, const std::vector<Anope::string> &params)
{
DNSServer *s = DNSServer::Find(params[1]);
-
+
if (!s)
{
source.Reply(_("Server %s does not exist."), params[1].c_str());
diff --git a/modules/commands/os_forbid.cpp b/modules/commands/os_forbid.cpp
index 1f54f804f..212beb1ed 100644
--- a/modules/commands/os_forbid.cpp
+++ b/modules/commands/os_forbid.cpp
@@ -214,7 +214,7 @@ class CommandOSForbid : public Command
expiryt += Anope::CurTime;
}
- NickAlias *target = NickAlias::Find(entry);
+ NickServ::Nick *target = NickServ::FindNick(entry);
if (target != NULL && Config->GetModule("nickserv")->Get<bool>("secureadmins", "yes") && target->nc->IsServicesOper())
{
source.Reply(ACCESS_DENIED);
@@ -254,9 +254,9 @@ class CommandOSForbid : public Command
for (user_map::const_iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it)
this->OnUserNickChange(it->second);
- for (nickalias_map::const_iterator it = NickAliasList->begin(), it_end = NickAliasList->end(); it != it_end;)
+ for (auto it = NickServ::service->GetNickList().begin(); it != NickServ::service->GetNickList().end();)
{
- NickAlias *na = it->second;
+ NickServ::Nick *na = it->second;
++it;
d = this->fs->FindForbid(na->nick, FT_NICK);
@@ -312,9 +312,9 @@ class CommandOSForbid : public Command
}
}
- for (registered_channel_map::const_iterator it = RegisteredChannelList->begin(); it != RegisteredChannelList->end();)
+ for (auto it = ChanServ::service->GetChannels().begin(); it != ChanServ::service->GetChannels().end();)
{
- ChannelInfo *ci = it->second;
+ ChanServ::Channel *ci = it->second;
++it;
d = this->fs->FindForbid(ci->name, FT_CHAN);
diff --git a/modules/commands/os_ignore.cpp b/modules/commands/os_ignore.cpp
index fa6537a21..728fe1c1c 100644
--- a/modules/commands/os_ignore.cpp
+++ b/modules/commands/os_ignore.cpp
@@ -38,7 +38,7 @@ Serializable* IgnoreDataImpl::Unserialize(Serializable *obj, Serialize::Data &da
{
if (!ignore_service)
return NULL;
-
+
IgnoreDataImpl *ign;
if (obj)
ign = anope_dynamic_static_cast<IgnoreDataImpl *>(obj);
@@ -94,7 +94,7 @@ class OSIgnoreService : public IgnoreService
{
User *u = User::Find(mask, true);
std::vector<IgnoreData *>::iterator ign = this->ignores->begin(), ign_end = this->ignores->end();
-
+
if (u)
{
for (; ign != ign_end; ++ign)
@@ -163,7 +163,7 @@ class CommandOSIgnore : public Command
User *u = User::Find(mask, true);
if (u)
return "*!*@" + u->host;
-
+
size_t host = mask.find('@');
/* Determine whether we get a nick or a mask. */
if (host != Anope::string::npos)
diff --git a/modules/commands/os_info.cpp b/modules/commands/os_info.cpp
index 53b5fecd6..03e98377e 100644
--- a/modules/commands/os_info.cpp
+++ b/modules/commands/os_info.cpp
@@ -20,7 +20,7 @@ struct OperInfo : Serializable
OperInfo() : Serializable("OperInfo"), created(0) { }
OperInfo(const Anope::string &t, const Anope::string &i, const Anope::string &a, time_t c) :
Serializable("OperInfo"), target(t), info(i), adder(a), created(c) { }
-
+
~OperInfo();
void Serialize(Serialize::Data &data) const override
@@ -46,10 +46,10 @@ struct OperInfos : Serialize::Checker<std::vector<OperInfo *> >
static Extensible *Find(const Anope::string &target)
{
- NickAlias *na = NickAlias::Find(target);
+ NickServ::Nick *na = NickServ::FindNick(target);
if (na)
return na->nc;
- return ChannelInfo::Find(target);
+ return ChanServ::Find(target);
}
};
@@ -76,7 +76,7 @@ Serializable *OperInfo::Unserialize(Serializable *obj, Serialize::Data &data)
Extensible *e = OperInfos::Find(starget);
if (!e)
return NULL;
-
+
OperInfos *oi = e->Require<OperInfos>("operinfo");
OperInfo *o;
if (obj)
@@ -113,7 +113,7 @@ class CommandOSInfo : public Command
Extensible *e;
if (IRCD->IsChannelValid(target))
{
- ChannelInfo *ci = ChannelInfo::Find(target);
+ ChanServ::Channel *ci = ChanServ::Find(target);
if (!ci)
{
source.Reply(CHAN_X_NOT_REGISTERED, target.c_str());
@@ -124,7 +124,7 @@ class CommandOSInfo : public Command
}
else
{
- NickAlias *na = NickAlias::Find(target);
+ NickServ::Nick *na = NickServ::FindNick(target);
if (!na)
{
source.Reply(NICK_X_NOT_REGISTERED, target.c_str());
@@ -284,12 +284,12 @@ class OSInfo : public Module
}
- void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool show_hidden) override
+ void OnNickInfo(CommandSource &source, NickServ::Nick *na, InfoFormatter &info, bool show_hidden) override
{
OnInfo(source, na->nc, info);
}
- void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool show_hidden) override
+ void OnChanInfo(CommandSource &source, ChanServ::Channel *ci, InfoFormatter &info, bool show_hidden) override
{
OnInfo(source, ci, info);
}
diff --git a/modules/commands/os_logsearch.cpp b/modules/commands/os_logsearch.cpp
index cba659957..5650feaa2 100644
--- a/modules/commands/os_logsearch.cpp
+++ b/modules/commands/os_logsearch.cpp
@@ -18,7 +18,7 @@ class CommandOSLogSearch : public Command
char timestamp[32];
tm *tm = localtime(&t);
-
+
strftime(timestamp, sizeof(timestamp), "%Y%m%d", tm);
return Anope::LogDir + "/" + file + "." + timestamp;
diff --git a/modules/commands/os_mode.cpp b/modules/commands/os_mode.cpp
index 7358e4c78..4d94759df 100644
--- a/modules/commands/os_mode.cpp
+++ b/modules/commands/os_mode.cpp
@@ -152,7 +152,7 @@ class CommandOSUMode : public Command
u2->SetModes(source.service, "%s", modes.c_str());
source.Reply(_("Changed usermodes of \002%s\002 to %s."), u2->nick.c_str(), modes.c_str());
- u2->SendMessage(source.service, _("\002%s\002 changed your usermodes to %s."), source.GetNick().c_str(), modes.c_str());
+ u2->SendMessage(*source.service, _("\002%s\002 changed your usermodes to %s."), source.GetNick().c_str(), modes.c_str());
Log(LOG_ADMIN, source, this) << modes << " on " << target;
}
diff --git a/modules/commands/os_module.cpp b/modules/commands/os_module.cpp
index c4f814ee3..826fcabbb 100644
--- a/modules/commands/os_module.cpp
+++ b/modules/commands/os_module.cpp
@@ -139,7 +139,7 @@ class CommandOSModUnLoad : public Command
source.Reply(_("Module \002%s\002 isn't loaded."), mname.c_str());
return;
}
-
+
if (!m->handle || m->GetPermanent() || m->type == PROTOCOL)
{
source.Reply(_("Unable to remove module \002%s\002."), m->name.c_str());
diff --git a/modules/commands/os_news.cpp b/modules/commands/os_news.cpp
index 62379e30a..0550146f3 100644
--- a/modules/commands/os_news.cpp
+++ b/modules/commands/os_news.cpp
@@ -115,7 +115,7 @@ class MyNewsService : public NewsService
{
this->newsItems[n->type].push_back(n);
}
-
+
void DelNewsItem(NewsItem *n)
{
std::vector<NewsItem *> &list = this->GetNewsList(n->type);
diff --git a/modules/commands/os_oline.cpp b/modules/commands/os_oline.cpp
index 6d1d5d443..3cb521063 100644
--- a/modules/commands/os_oline.cpp
+++ b/modules/commands/os_oline.cpp
@@ -33,7 +33,7 @@ class CommandOSOLine : public Command
{
IRCD->SendSVSO(source.service, nick, flag);
u2->SetMode(source.service, "OPER");
- u2->SendMessage(source.service, _("You are now an IRC Operator."));
+ u2->SendMessage(*source.service, _("You are now an IRC Operator."));
source.Reply(_("Operflags \002%s\002 have been added for \002%s\002."), flag.c_str(), nick.c_str());
Log(LOG_ADMIN, source, this) << "for " << nick;
}
diff --git a/modules/commands/os_oper.cpp b/modules/commands/os_oper.cpp
index a18b022ab..59619cb48 100644
--- a/modules/commands/os_oper.cpp
+++ b/modules/commands/os_oper.cpp
@@ -31,7 +31,7 @@ struct MyOper : Oper, Serializable
OperType *ot = OperType::Find(stype);
if (ot == NULL)
return NULL;
- NickCore *nc = NickCore::Find(sname);
+ NickServ::Account *nc = NickServ::FindAccount(sname);
if (nc == NULL)
return NULL;
@@ -82,7 +82,7 @@ class CommandOSOper : public Command
const Anope::string &oper = params[1];
const Anope::string &otype = params[2];
- const NickAlias *na = NickAlias::Find(oper);
+ const NickServ::Nick *na = NickServ::FindNick(oper);
if (na == NULL)
source.Reply(NICK_X_NOT_REGISTERED, oper.c_str());
else if (na->nc->o)
@@ -115,7 +115,7 @@ class CommandOSOper : public Command
{
const Anope::string &oper = params[1];
- const NickAlias *na = NickAlias::Find(oper);
+ const NickServ::Nick *na = NickServ::FindNick(oper);
if (na == NULL)
source.Reply(NICK_X_NOT_REGISTERED, oper.c_str());
else if (!na->nc || !na->nc->o)
@@ -137,9 +137,9 @@ class CommandOSOper : public Command
else if (subcommand.equals_ci("LIST"))
{
source.Reply(_("Name Type"));
- for (nickcore_map::const_iterator it = NickCoreList->begin(), it_end = NickCoreList->end(); it != it_end; ++it)
+ for (auto& it : NickServ::service->GetAccountList())
{
- const NickCore *nc = it->second;
+ const NickServ::Account *nc = it.second;
if (!nc->o)
continue;
@@ -160,7 +160,7 @@ class CommandOSOper : public Command
if (params.size() > 2)
fulltype += " " + params[2];
OperType *ot = OperType::Find(fulltype);
- if (ot == NULL)
+ if (ot == NULL)
source.Reply(_("Oper type \002%s\002 has not been configured."), fulltype.c_str());
else
{
@@ -243,9 +243,9 @@ class OSOper : public Module
~OSOper()
{
- for (nickcore_map::const_iterator it = NickCoreList->begin(), it_end = NickCoreList->end(); it != it_end; ++it)
+ for (auto& it : NickServ::service->GetAccountList())
{
- NickCore *nc = it->second;
+ NickServ::Account *nc = it.second;
if (nc->o && dynamic_cast<MyOper *>(nc->o))
{
diff --git a/modules/commands/os_session.cpp b/modules/commands/os_session.cpp
index 9cb525b4d..03c807efb 100644
--- a/modules/commands/os_session.cpp
+++ b/modules/commands/os_session.cpp
@@ -68,7 +68,7 @@ class MySessionService : public SessionService
Exception *e = *it;
if (Anope::Match(u->host, e->mask) || Anope::Match(u->ip, e->mask))
return e;
-
+
if (cidr(e->mask).match(sockaddrs(u->ip)))
return e;
}
@@ -211,7 +211,7 @@ class CommandOSSession : public Command
std::vector<Anope::string> replies;
list.Process(replies);
-
+
for (unsigned i = 0; i < replies.size(); ++i)
source.Reply(replies[i]);
}
@@ -531,7 +531,7 @@ class CommandOSException : public Command
else
{
source.Reply(_("Current Session Limit Exception list:"));
-
+
std::vector<Anope::string> replies;
list.Process(replies);
diff --git a/modules/commands/os_set.cpp b/modules/commands/os_set.cpp
index bc58b7dc1..be5e980b1 100644
--- a/modules/commands/os_set.cpp
+++ b/modules/commands/os_set.cpp
@@ -129,7 +129,7 @@ class CommandOSSet : public Command
return;
}
catch (const ConvertException &) { }
-
+
source.Reply(_("Setting for DEBUG must be \002ON\002, \002OFF\002, or a positive number."));
}
diff --git a/modules/commands/os_stats.cpp b/modules/commands/os_stats.cpp
index d55bdb1dc..f325b3ab9 100644
--- a/modules/commands/os_stats.cpp
+++ b/modules/commands/os_stats.cpp
@@ -173,13 +173,13 @@ class CommandOSStats : public Command
GetHashStats(ChannelList, entries, buckets, max_chain);
source.Reply(_("Channels: %lu entries, %lu buckets, longest chain is %d"), entries, buckets, max_chain);
- GetHashStats(*RegisteredChannelList, entries, buckets, max_chain);
+ GetHashStats(ChanServ::service->GetChannels(), entries, buckets, max_chain);
source.Reply(_("Registered channels: %lu entries, %lu buckets, longest chain is %d"), entries, buckets, max_chain);
- GetHashStats(*NickAliasList, entries, buckets, max_chain);
+ GetHashStats(NickServ::service->GetNickList(), entries, buckets, max_chain);
source.Reply(_("Registered nicknames: %lu entries, %lu buckets, longest chain is %d"), entries, buckets, max_chain);
- GetHashStats(*NickCoreList, entries, buckets, max_chain);
+ GetHashStats(NickServ::service->GetAccountList(), entries, buckets, max_chain);
source.Reply(_("Registered nick groups: %lu entries, %lu buckets, longest chain is %d"), entries, buckets, max_chain);
if (session_service)