diff options
author | Adam <Adam@anope.org> | 2012-11-22 00:50:33 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2012-11-22 00:50:33 -0500 |
commit | d33a0f75a5c0c584fbb7cc0076da36d494f39494 (patch) | |
tree | 7b2274cc833c793c0f5595660cbd4d715de52ffd /modules/commands | |
parent | 368d469631763e9c8bf399980d0ac7c5b5664d39 (diff) |
Pretty large coding style cleanup, in source doc
cleanup, and allow protocol mods to depend on each
other
Diffstat (limited to 'modules/commands')
151 files changed, 1060 insertions, 1109 deletions
diff --git a/modules/commands/bs_assign.cpp b/modules/commands/bs_assign.cpp index 874c40015..ac809b952 100644 --- a/modules/commands/bs_assign.cpp +++ b/modules/commands/bs_assign.cpp @@ -27,20 +27,20 @@ class CommandBSAssign : public Command const Anope::string &chan = params[0]; const Anope::string &nick = params[1]; - if (readonly) + if (Anope::ReadOnly) { source.Reply(BOT_ASSIGN_READONLY); return; } - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); return; } - BotInfo *bi = findbot(nick); + BotInfo *bi = BotInfo::Find(nick, true); if (!bi) { source.Reply(BOT_DOES_NOT_EXIST, nick.c_str()); @@ -95,13 +95,13 @@ class CommandBSUnassign : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - if (readonly) + if (Anope::ReadOnly) { source.Reply(BOT_ASSIGN_READONLY); return; } - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); diff --git a/modules/commands/bs_badwords.cpp b/modules/commands/bs_badwords.cpp index ad7a49085..36a83b717 100644 --- a/modules/commands/bs_badwords.cpp +++ b/modules/commands/bs_badwords.cpp @@ -19,10 +19,10 @@ class BadwordsDelCallback : public NumberList CommandSource &source; ChannelInfo *ci; Command *c; - unsigned Deleted; + 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, ChannelInfo *_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; @@ -30,12 +30,12 @@ class BadwordsDelCallback : public NumberList ~BadwordsDelCallback() { - if (!Deleted) + if (!deleted) source.Reply(_("No matching entries on %s bad words list."), ci->name.c_str()); - else if (Deleted == 1) + else if (deleted == 1) source.Reply(_("Deleted 1 entry from %s bad words list."), ci->name.c_str()); else - source.Reply(_("Deleted %d entries from %s bad words list."), Deleted, ci->name.c_str()); + source.Reply(_("Deleted %d entries from %s bad words list."), deleted, ci->name.c_str()); } void HandleNumber(unsigned Number) anope_override @@ -44,7 +44,7 @@ class BadwordsDelCallback : public NumberList return; Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, c, ci) << "DEL " << ci->GetBadWord(Number - 1)->word; - ++Deleted; + ++deleted; ci->EraseBadWord(Number - 1); } }; @@ -58,7 +58,7 @@ class CommandBSBadwords : public Command Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "LIST"; ListFormatter list; - list.addColumn("Number").addColumn("Word").addColumn("Type"); + list.AddColumn("Number").AddColumn("Word").AddColumn("Type"); if (!ci->GetBadWordCount()) { @@ -86,7 +86,7 @@ class CommandBSBadwords : public Command entry["Number"] = stringify(Number); entry["Word"] = bw->word; entry["Type"] = bw->type == BW_SINGLE ? "(SINGLE)" : (bw->type == BW_START ? "(START)" : (bw->type == BW_END ? "(END)" : "")); - this->list.addEntry(entry); + this->list.AddEntry(entry); } } nl_list(list, ci, word); @@ -105,11 +105,11 @@ class CommandBSBadwords : public Command entry["Number"] = stringify(i + 1); entry["Word"] = bw->word; entry["Type"] = bw->type == BW_SINGLE ? "(SINGLE)" : (bw->type == BW_START ? "(START)" : (bw->type == BW_END ? "(END)" : "")); - list.addEntry(entry); + list.AddEntry(entry); } } - if (list.isEmpty()) + if (list.IsEmpty()) source.Reply(_("No matching entries on %s badword list."), ci->name.c_str()); else { @@ -241,7 +241,7 @@ class CommandBSBadwords : public Command return; } - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); @@ -254,7 +254,7 @@ class CommandBSBadwords : public Command return; } - if (readonly) + if (Anope::ReadOnly) { source.Reply(_("Sorry, channel bad words list modification is temporarily disabled.")); return; diff --git a/modules/commands/bs_bot.cpp b/modules/commands/bs_bot.cpp index de7fa1128..8246692d0 100644 --- a/modules/commands/bs_bot.cpp +++ b/modules/commands/bs_bot.cpp @@ -23,7 +23,7 @@ class CommandBSBot : public Command const Anope::string &host = params[3]; const Anope::string &real = params[4]; - if (findbot(nick)) + if (BotInfo::Find(nick, true)) { source.Reply(_("Bot \002%s\002 already exists."), nick.c_str()); return; @@ -47,46 +47,30 @@ class CommandBSBot : public Command return; } - /* Check the nick is valid re RFC 2812 */ - if (isdigit(nick[0]) || nick[0] == '-') + if (!IRCD->IsNickValid(nick)) { source.Reply(_("Bot Nicks may only contain valid nick characters.")); return; } - for (unsigned i = 0, end = nick.length(); i < end && i < Config->NickLen; ++i) - if (!isvalidnick(nick[i])) - { - source.Reply(_("Bot Nicks may only contain valid nick characters.")); - return; - } - - /* check for hardcored ircd forbidden nicks */ - if (!ircdproto->IsNickValid(nick)) + /* Check the host is valid */ + if (!IRCD->IsHostValid(host)) { - source.Reply(_("Bot Nicks may only contain valid nick characters.")); + source.Reply(_("Bot Hosts may only contain valid host characters.")); return; } - /* Check the host is valid */ - if (!IsValidHost(host)) + if (!IRCD->IsIdentValid(user)) { - source.Reply(_("Bot Hosts may only contain valid host characters.")); + source.Reply(_("Bot Idents may only contain valid characters.")); return; } - for (unsigned i = 0, end = user.length(); i < end && i < Config->UserLen; ++i) - if (!isalnum(user[i])) - { - source.Reply(_("Bot Idents may only contain valid characters."), Config->UserLen); - return; - } - /* We check whether the nick is registered, and inform the user * if so. You need to drop the nick manually before you can use * it as a bot nick from now on -GD */ - if (findnick(nick)) + if (NickAlias::Find(nick)) { source.Reply(NICK_ALREADY_REGISTERED, nick.c_str()); return; @@ -116,16 +100,16 @@ class CommandBSBot : public Command return; } - BotInfo *bi = findbot(oldnick); + BotInfo *bi = BotInfo::Find(oldnick, true); if (!bi) { source.Reply(BOT_DOES_NOT_EXIST, oldnick.c_str()); return; } - if (!oldnick.equals_ci(nick) && nickIsServices(oldnick, false)) + if (bi->HasFlag(BI_CONF)) { - source.Reply(BOT_DOES_NOT_EXIST, oldnick.c_str()); + source.Reply(_("Bot %s is not changable."), bi->nick.c_str()); return; } @@ -147,12 +131,6 @@ class CommandBSBot : public Command return; } - if (!oldnick.equals_ci(nick) && nickIsServices(nick, false)) - { - source.Reply(BOT_DOES_NOT_EXIST, oldnick.c_str()); - return; - } - /* Checks whether there *are* changes. * Case sensitive because we may want to change just the case. * And we must finally check that the nick is not already @@ -164,42 +142,25 @@ class CommandBSBot : public Command return; } - /* Check the nick is valid re RFC 2812 */ - if (isdigit(nick[0]) || nick[0] == '-') + if (!IRCD->IsNickValid(nick)) { source.Reply(_("Bot Nicks may only contain valid nick characters.")); return; } - for (unsigned i = 0, end = nick.length(); i < end && i < Config->NickLen; ++i) - if (!isvalidnick(nick[i])) - { - source.Reply(_("Bot Nicks may only contain valid nick characters.")); - return; - } - - /* check for hardcored ircd forbidden nicks */ - if (!ircdproto->IsNickValid(nick)) + if (!host.empty() && !IRCD->IsHostValid(host)) { - source.Reply(_("Bot Nicks may only contain valid nick characters.")); + source.Reply(_("Bot Hosts may only contain valid host characters.")); return; } - if (!host.empty() && !IsValidHost(host)) + if (!user.empty() && !IRCD->IsIdentValid(user)) { - source.Reply(_("Bot Hosts may only contain valid host characters.")); + source.Reply(_("Bot Idents may only contain valid characters."), Config->UserLen); return; } - if (!user.empty()) - for (unsigned i = 0, end = user.length(); i < end && i < Config->UserLen; ++i) - if (!isalnum(user[i])) - { - source.Reply(_("Bot Idents may only contain valid characters."), Config->UserLen); - return; - } - - if (!nick.equals_ci(bi->nick) && findbot(nick)) + if (!nick.equals_ci(bi->nick) && BotInfo::Find(nick, true)) { source.Reply(_("Bot \002%s\002 already exists."), nick.c_str()); return; @@ -211,7 +172,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 (findnick(nick)) + if (NickAlias::Find(nick)) { source.Reply(NICK_ALREADY_REGISTERED, nick.c_str()); return; @@ -219,19 +180,17 @@ class CommandBSBot : public Command /* The new nick is really different, so we remove the Q line for the old nick. */ XLine x_del(bi->nick); - ircdproto->SendSQLineDel(&x_del); + IRCD->SendSQLineDel(&x_del); /* Add a Q line for the new nick */ XLine x(nick, "Reserved for services"); - ircdproto->SendSQLine(NULL, &x); + IRCD->SendSQLine(NULL, &x); } if (!user.empty()) - ircdproto->SendQuit(bi, "Quit: Be right back"); + IRCD->SendQuit(bi, "Quit: Be right back"); else - { - ircdproto->SendChangeBotNick(bi, nick); - } + IRCD->SendNickChange(bi, nick); if (!nick.equals_cs(bi->nick)) bi->SetNewNick(nick); @@ -245,7 +204,7 @@ class CommandBSBot : public Command if (!user.empty()) { - ircdproto->SendClientIntroduction(bi); + IRCD->SendClientIntroduction(bi); bi->RejoinAll(); } @@ -266,16 +225,16 @@ class CommandBSBot : public Command return; } - BotInfo *bi = findbot(nick); + BotInfo *bi = BotInfo::Find(nick, true); if (!bi) { source.Reply(BOT_DOES_NOT_EXIST, nick.c_str()); return; } - if (nickIsServices(nick, false)) + if (bi->HasFlag(BI_CONF)) { - source.Reply(BOT_DOES_NOT_EXIST, nick.c_str()); + source.Reply(_("Bot %s is not deletable."), bi->nick.c_str()); return; } @@ -284,7 +243,7 @@ class CommandBSBot : public Command Log(LOG_ADMIN, source, this) << "DEL " << bi->nick; source.Reply(_("Bot \002%s\002 has been deleted."), nick.c_str()); - bi->destroy(); + bi->Destroy(); return; } public: @@ -300,7 +259,7 @@ class CommandBSBot : public Command { const Anope::string &cmd = params[0]; - if (readonly) + if (Anope::ReadOnly) { source.Reply(_("Sorry, bot modification is temporarily disabled.")); return; diff --git a/modules/commands/bs_botlist.cpp b/modules/commands/bs_botlist.cpp index a4a7c2586..1cdd93c45 100644 --- a/modules/commands/bs_botlist.cpp +++ b/modules/commands/bs_botlist.cpp @@ -27,7 +27,7 @@ class CommandBSBotList : public Command unsigned count = 0; ListFormatter list; - list.addColumn("Nick").addColumn("Mask"); + list.AddColumn("Nick").AddColumn("Mask"); for (botinfo_map::const_iterator it = BotListByNick->begin(), it_end = BotListByNick->end(); it != it_end; ++it) { @@ -39,7 +39,7 @@ class CommandBSBotList : public Command ListFormatter::ListEntry entry; entry["Nick"] = (bi->HasFlag(BI_PRIVATE) ? "* " : "") + bi->nick; entry["Mask"] = bi->GetIdent() + "@" + bi->host; - list.addEntry(entry); + list.AddEntry(entry); } } diff --git a/modules/commands/bs_control.cpp b/modules/commands/bs_control.cpp index 6957d0a78..3ee0401d6 100644 --- a/modules/commands/bs_control.cpp +++ b/modules/commands/bs_control.cpp @@ -26,7 +26,7 @@ class CommandBSSay : public Command { const Anope::string &text = params[1]; - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); @@ -57,7 +57,7 @@ class CommandBSSay : public Command return; } - ircdproto->SendPrivmsg(ci->bi, ci->name, "%s", text.c_str()); + IRCD->SendPrivmsg(ci->bi, ci->name, "%s", text.c_str()); ci->bi->lastmsg = Anope::CurTime; // XXX need a way to find if someone is overriding this @@ -88,7 +88,7 @@ class CommandBSAct : public Command { Anope::string message = params[1]; - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); @@ -117,7 +117,7 @@ class CommandBSAct : public Command while ((i = message.find(1)) && i != Anope::string::npos) message.erase(i, 1); - ircdproto->SendAction(ci->bi, ci->name, "%s", message.c_str()); + IRCD->SendAction(ci->bi, ci->name, "%s", message.c_str()); ci->bi->lastmsg = Anope::CurTime; // XXX Need to be able to find if someone is overriding this. diff --git a/modules/commands/bs_info.cpp b/modules/commands/bs_info.cpp index 199b17e3e..a4312cea6 100644 --- a/modules/commands/bs_info.cpp +++ b/modules/commands/bs_info.cpp @@ -44,7 +44,7 @@ class CommandBSInfo : public Command { if (!buf.empty()) buf += ", "; - buf += translate(nc, option); + buf += Language::Translate(nc, option); } } @@ -59,7 +59,7 @@ class CommandBSInfo : public Command { const Anope::string &query = params[0]; - const BotInfo *bi = findbot(query); + const BotInfo *bi = BotInfo::Find(query, true); ChannelInfo *ci; InfoFormatter info(source.nc); @@ -68,7 +68,7 @@ class CommandBSInfo : public Command source.Reply(_("Information for bot \002%s\002:"), bi->nick.c_str()); info[_("Mask")] = bi->GetIdent() + "@" + bi->host; info[_("Real name")] = bi->realname; - info[_("Created")] = do_strftime(bi->created); + info[_("Created")] = Anope::strftime(bi->created); info[_("Options")] = bi->HasFlag(BI_PRIVATE) ? _("Private") : _("None"); info[_("Used on")] = stringify(bi->GetChannelCount()) + " channel(s)"; @@ -87,7 +87,7 @@ class CommandBSInfo : public Command } } - else if ((ci = cs_findchan(query))) + else if ((ci = ChannelInfo::Find(query))) { if (!source.AccessFor(ci).HasPriv("FOUNDER") && !source.HasPriv("botserv/administration")) { @@ -98,8 +98,8 @@ class CommandBSInfo : public Command source.Reply(CHAN_INFO_HEADER, ci->name.c_str()); info[_("Bot nick")] = ci->bi ? ci->bi->nick : "not assigned yet"; - Anope::string enabled = translate(source.nc, _("Enabled")); - Anope::string disabled = translate(source.nc, _("Disabled")); + Anope::string enabled = Language::Translate(source.nc, _("Enabled")); + Anope::string disabled = Language::Translate(source.nc, _("Disabled")); if (ci->botflags.HasFlag(BS_KICK_BADWORDS)) { diff --git a/modules/commands/bs_kick.cpp b/modules/commands/bs_kick.cpp index eeaccd5f9..3e569696e 100644 --- a/modules/commands/bs_kick.cpp +++ b/modules/commands/bs_kick.cpp @@ -30,9 +30,9 @@ class CommandBSKick : public Command const Anope::string &value = params[2]; const Anope::string &ttb = params.size() > 3 ? params[3] : ""; - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); - if (readonly) + if (Anope::ReadOnly) source.Reply(_("Sorry, kicker configuration is temporarily disabled.")); else if (ci == NULL) source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); @@ -736,14 +736,12 @@ class BSKick : public Module /* Should not use == here because bd.ttb[ttbtype] could possibly be > ci->ttb[ttbtype] * if the TTB was changed after it was not set (0) before and the user had already been * kicked a few times. Bug #1056 - Adam */ - Anope::string mask; bd.ttb[ttbtype] = 0; - get_idealban(ci, u, mask); + Anope::string mask = ci->GetIdealBan(u); - if (ci->c) - ci->c->SetMode(NULL, CMODE_BAN, mask); + ci->c->SetMode(NULL, CMODE_BAN, mask); FOREACH_MOD(I_OnBotBan, OnBotBan(u, ci, mask)); } } @@ -756,7 +754,7 @@ class BSKick : public Module if (!ci || !ci->bi || !ci->c || !u || u->server->IsULined() || !ci->c->FindUser(u)) return; - Anope::string fmt = translate(u, message); + Anope::string fmt = Language::Translate(u, message); va_start(args, message); vsnprintf(buf, sizeof(buf), fmt.c_str(), args); va_end(args); @@ -895,7 +893,7 @@ class BSKick : public Module bool mustkick = false; /* Normalize the buffer */ - Anope::string nbuf = normalizeBuffer(realbuf); + Anope::string nbuf = Anope::NormalizeBuffer(realbuf); for (unsigned i = 0, end = ci->GetBadWordCount(); i < end; ++i) { diff --git a/modules/commands/bs_set.cpp b/modules/commands/bs_set.cpp index e169f3c83..6f458bec0 100644 --- a/modules/commands/bs_set.cpp +++ b/modules/commands/bs_set.cpp @@ -41,7 +41,7 @@ class CommandBSSet : public Command const CommandInfo &info = it->second; if (c_name.find_ci(this_name + " ") == 0) { - service_reference<Command> command("Command", info.name); + ServiceReference<Command> command("Command", info.name); if (command) { source.command = it->first; diff --git a/modules/commands/bs_set_dontkickops.cpp b/modules/commands/bs_set_dontkickops.cpp index 598dfdcea..5346074a6 100644 --- a/modules/commands/bs_set_dontkickops.cpp +++ b/modules/commands/bs_set_dontkickops.cpp @@ -24,7 +24,7 @@ class CommandBSSetDontKickOps : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); @@ -38,7 +38,7 @@ class CommandBSSetDontKickOps : public Command return; } - if (readonly) + if (Anope::ReadOnly) { source.Reply(_("Sorry, bot option setting is temporarily disabled.")); return; diff --git a/modules/commands/bs_set_dontkickvoices.cpp b/modules/commands/bs_set_dontkickvoices.cpp index 05453296b..b4b0cd7ec 100644 --- a/modules/commands/bs_set_dontkickvoices.cpp +++ b/modules/commands/bs_set_dontkickvoices.cpp @@ -24,7 +24,7 @@ class CommandBSSetDontKickVoices : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); @@ -38,7 +38,7 @@ class CommandBSSetDontKickVoices : public Command return; } - if (readonly) + if (Anope::ReadOnly) { source.Reply(_("Sorry, bot option setting is temporarily disabled.")); return; diff --git a/modules/commands/bs_set_fantasy.cpp b/modules/commands/bs_set_fantasy.cpp index 03bd40c70..29c722026 100644 --- a/modules/commands/bs_set_fantasy.cpp +++ b/modules/commands/bs_set_fantasy.cpp @@ -24,7 +24,7 @@ class CommandBSSetFantasy : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); const Anope::string &value = params[1]; if (ci == NULL) @@ -39,7 +39,7 @@ class CommandBSSetFantasy : public Command return; } - if (readonly) + if (Anope::ReadOnly) { source.Reply(_("Sorry, bot option setting is temporarily disabled.")); return; diff --git a/modules/commands/bs_set_greet.cpp b/modules/commands/bs_set_greet.cpp index b74b0e5dd..ad5220203 100644 --- a/modules/commands/bs_set_greet.cpp +++ b/modules/commands/bs_set_greet.cpp @@ -24,7 +24,7 @@ class CommandBSSetGreet : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); const Anope::string &value = params[1]; if (ci == NULL) @@ -39,7 +39,7 @@ class CommandBSSetGreet : public Command return; } - if (readonly) + if (Anope::ReadOnly) { source.Reply(_("Sorry, bot option setting is temporarily disabled.")); return; diff --git a/modules/commands/bs_set_nobot.cpp b/modules/commands/bs_set_nobot.cpp index 246864953..f3f749aa5 100644 --- a/modules/commands/bs_set_nobot.cpp +++ b/modules/commands/bs_set_nobot.cpp @@ -24,7 +24,7 @@ class CommandBSSetNoBot : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); const Anope::string &value = params[1]; if (ci == NULL) diff --git a/modules/commands/bs_set_private.cpp b/modules/commands/bs_set_private.cpp index 0cd055d00..920c97d37 100644 --- a/modules/commands/bs_set_private.cpp +++ b/modules/commands/bs_set_private.cpp @@ -24,7 +24,7 @@ class CommandBSSetPrivate : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - BotInfo *bi = findbot(params[0]); + BotInfo *bi = BotInfo::Find(params[0], true); const Anope::string &value = params[1]; if (bi == NULL) diff --git a/modules/commands/cs_access.cpp b/modules/commands/cs_access.cpp index 40414a336..ed6f4f7fa 100644 --- a/modules/commands/cs_access.cpp +++ b/modules/commands/cs_access.cpp @@ -36,12 +36,12 @@ class AccessChanAccess : public ChanAccess return this->ci->GetLevel(name) != ACCESS_INVALID && this->level >= this->ci->GetLevel(name); } - Anope::string Serialize() const + Anope::string AccessSerialize() const { return stringify(this->level); } - void Unserialize(const Anope::string &data) anope_override + void AccessUnserialize(const Anope::string &data) anope_override { this->level = convertTo<int>(data); } @@ -119,7 +119,7 @@ class CommandCSAccess : public Command bool override = false; - if ((!highest || *highest <= tmp_access) && !u_access.Founder) + if ((!highest || *highest <= tmp_access) && !u_access.founder) { if (source.HasPriv("chanserv/access/modify")) override = true; @@ -130,9 +130,9 @@ class CommandCSAccess : public Command } } - if (mask.find_first_of("!*@") == Anope::string::npos && !findnick(mask)) + if (mask.find_first_of("!*@") == Anope::string::npos && !NickAlias::Find(mask)) { - User *targ = finduser(mask); + User *targ = User::Find(mask, true); if (targ != NULL) mask = "*!*@" + targ->GetDisplayedHost(); else @@ -148,7 +148,7 @@ class CommandCSAccess : public Command if (mask.equals_ci(access->mask)) { /* Don't allow lowering from a level >= u_level */ - if ((!highest || *access >= *highest) && !u_access.Founder && !source.HasPriv("chanserv/access/modify")) + if ((!highest || *access >= *highest) && !u_access.founder && !source.HasPriv("chanserv/access/modify")) { source.Reply(ACCESS_DENIED); return; @@ -164,7 +164,7 @@ class CommandCSAccess : public Command return; } - service_reference<AccessProvider> provider("AccessProvider", "access/access"); + ServiceReference<AccessProvider> provider("AccessProvider", "access/access"); if (!provider) return; AccessChanAccess *access = anope_dynamic_static_cast<AccessChanAccess *>(provider->Create()); @@ -188,9 +188,9 @@ class CommandCSAccess : public Command { Anope::string mask = params[2]; - if (mask.find_first_of("!*@") == Anope::string::npos && !findnick(mask)) + if (mask.find_first_of("!*@") == Anope::string::npos && !NickAlias::Find(mask)) { - User *targ = finduser(mask); + User *targ = User::Find(mask, true); if (targ != NULL) mask = "*!*@" + targ->GetDisplayedHost(); else @@ -209,12 +209,12 @@ class CommandCSAccess : public Command CommandSource &source; ChannelInfo *ci; Command *c; - unsigned Deleted; + 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, ChannelInfo *_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; @@ -222,18 +222,18 @@ class CommandCSAccess : public Command ~AccessDelCallback() { - if (Denied && !Deleted) + if (Denied && !deleted) source.Reply(ACCESS_DENIED); - else if (!Deleted) + else if (!deleted) source.Reply(_("No matching entries on %s access list."), ci->name.c_str()); else { Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, c, ci) << "to delete " << Nicks; - if (Deleted == 1) + if (deleted == 1) source.Reply(_("Deleted 1 entry from %s access list."), ci->name.c_str()); else - source.Reply(_("Deleted %d entries from %s access list."), Deleted, ci->name.c_str()); + source.Reply(_("Deleted %d entries from %s access list."), deleted, ci->name.c_str()); } } @@ -247,13 +247,13 @@ class CommandCSAccess : public Command AccessGroup u_access = source.AccessFor(ci); const ChanAccess *u_highest = u_access.Highest(); - if ((!u_highest || *u_highest <= *access) && !u_access.Founder && !this->override && !access->mask.equals_ci(source.nc->display)) + if ((!u_highest || *u_highest <= *access) && !u_access.founder && !this->override && !access->mask.equals_ci(source.nc->display)) { Denied = true; return; } - ++Deleted; + ++deleted; if (!Nicks.empty()) Nicks += ", " + access->mask; else @@ -277,12 +277,12 @@ class CommandCSAccess : public Command 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")) + if (!access->mask.equals_ci(source.nc->display) && !u_access.founder && (!highest || *highest <= *access) && !source.HasPriv("chanserv/access/modify")) source.Reply(ACCESS_DENIED); else { source.Reply(_("\002%s\002 deleted from %s access list."), access->mask.c_str(), ci->name.c_str()); - bool override = !u_access.Founder && !u_access.HasPriv("ACCESS_CHANGE") && !access->mask.equals_ci(source.nc->display); + bool override = !u_access.founder && !u_access.HasPriv("ACCESS_CHANGE") && !access->mask.equals_ci(source.nc->display); Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << access->mask; FOREACH_MOD(I_OnAccessDel, OnAccessDel(ci, source, access)); @@ -333,7 +333,7 @@ class CommandCSAccess : public Command if (access->last_seen == 0) timebuf = "Never"; else - timebuf = do_strftime(access->last_seen, NULL, true); + timebuf = Anope::strftime(access->last_seen, NULL, true); } ListFormatter::ListEntry entry; @@ -342,7 +342,7 @@ class CommandCSAccess : public Command entry["Mask"] = access->mask; entry["By"] = access->creator; entry["Last seen"] = timebuf; - this->list.addEntry(entry); + this->list.AddEntry(entry); } } nl_list(list, ci, nick); @@ -367,7 +367,7 @@ class CommandCSAccess : public Command if (access->last_seen == 0) timebuf = "Never"; else - timebuf = do_strftime(access->last_seen, NULL, true); + timebuf = Anope::strftime(access->last_seen, NULL, true); } ListFormatter::ListEntry entry; @@ -376,11 +376,11 @@ class CommandCSAccess : public Command entry["Mask"] = access->mask; entry["By"] = access->creator; entry["Last seen"] = timebuf; - list.addEntry(entry); + list.AddEntry(entry); } } - if (list.isEmpty()) + if (list.IsEmpty()) source.Reply(_("No matching entries on %s access list."), ci->name.c_str()); else { @@ -407,7 +407,7 @@ class CommandCSAccess : public Command } ListFormatter list; - list.addColumn("Number").addColumn("Level").addColumn("Mask"); + list.AddColumn("Number").AddColumn("Level").AddColumn("Mask"); this->ProcessList(source, ci, params, list); } @@ -420,7 +420,7 @@ class CommandCSAccess : public Command } ListFormatter list; - list.addColumn("Number").addColumn("Level").addColumn("Mask").addColumn("By").addColumn("Last seen"); + list.AddColumn("Number").AddColumn("Level").AddColumn("Mask").AddColumn("By").AddColumn("Last seen"); this->ProcessList(source, ci, params, list); } @@ -460,7 +460,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 = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); @@ -480,7 +480,7 @@ class CommandCSAccess : public Command has_access = true; else if (is_del) { - const NickAlias *na = findnick(nick); + const NickAlias *na = NickAlias::Find(nick); if (na && na->nc == source.GetAccount()) has_access = true; } @@ -492,7 +492,7 @@ class CommandCSAccess : public Command this->OnSyntaxError(source, cmd); else if (!has_access) source.Reply(ACCESS_DENIED); - else if (readonly && !is_list) + else if (Anope::ReadOnly && !is_list) source.Reply(_("Sorry, channel access list modification is temporarily disabled.")); else if (cmd.equals_ci("ADD")) this->DoAdd(source, ci, params); @@ -652,7 +652,7 @@ class CommandCSLevels : public Command source.Reply(_("Access level settings for channel %s:"), ci->name.c_str()); ListFormatter list; - list.addColumn("Name").addColumn("Level"); + list.AddColumn("Name").AddColumn("Level"); const std::vector<Privilege> &privs = PrivilegeManager::GetPrivileges(); @@ -671,7 +671,7 @@ class CommandCSLevels : public Command else entry["Level"] = stringify(j); - list.addEntry(entry); + list.AddEntry(entry); } std::vector<Anope::string> replies; @@ -709,7 +709,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 = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); @@ -744,7 +744,7 @@ class CommandCSLevels : public Command source.Reply(_("The following feature/function names are understood.")); ListFormatter list; - list.addColumn("Name").addColumn("Description"); + list.AddColumn("Name").AddColumn("Description"); const std::vector<Privilege> &privs = PrivilegeManager::GetPrivileges(); for (unsigned i = 0; i < privs.size(); ++i) @@ -752,8 +752,8 @@ class CommandCSLevels : public Command const Privilege &p = privs[i]; ListFormatter::ListEntry entry; entry["Name"] = p.name; - entry["Description"] = translate(source.nc, p.desc.c_str()); - list.addEntry(entry); + entry["Description"] = Language::Translate(source.nc, p.desc.c_str()); + list.AddEntry(entry); } std::vector<Anope::string> replies; diff --git a/modules/commands/cs_akick.cpp b/modules/commands/cs_akick.cpp index 1425d1636..29959bf32 100644 --- a/modules/commands/cs_akick.cpp +++ b/modules/commands/cs_akick.cpp @@ -52,7 +52,7 @@ class CommandCSAKick : public Command { Anope::string mask = params[2]; Anope::string reason = params.size() > 3 ? params[3] : ""; - const NickAlias *na = findnick(mask); + const NickAlias *na = NickAlias::Find(mask); NickCore *nc = NULL; const AutoKick *akick; @@ -178,34 +178,34 @@ class CommandCSAKick : public Command CommandSource &source; ChannelInfo *ci; Command *c; - unsigned Deleted; + unsigned deleted; public: - AkickDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, const Anope::string &list) : NumberList(list, true), source(_source), ci(_ci), c(_c), Deleted(0) + AkickDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, const Anope::string &list) : NumberList(list, true), source(_source), ci(_ci), c(_c), deleted(0) { } ~AkickDelCallback() { bool override = !source.AccessFor(ci).HasPriv("AKICK"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, c, ci) << "to delete " << Deleted << (Deleted == 1 ? " entry" : " entries"); + Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, c, ci) << "to delete " << deleted << (deleted == 1 ? " entry" : " entries"); - if (!Deleted) + if (!deleted) source.Reply(_("No matching entries on %s autokick list."), ci->name.c_str()); - else if (Deleted == 1) + else if (deleted == 1) source.Reply(_("Deleted 1 entry from %s autokick list."), ci->name.c_str()); else - source.Reply(_("Deleted %d entries from %s autokick list."), Deleted, ci->name.c_str()); + source.Reply(_("Deleted %d entries from %s autokick list."), deleted, ci->name.c_str()); } - void HandleNumber(unsigned Number) anope_override + void HandleNumber(unsigned number) anope_override { - if (!Number || Number > ci->GetAkickCount()) + if (!number || number > ci->GetAkickCount()) return; - FOREACH_MOD(I_OnAkickDel, OnAkickDel(source, ci, ci->GetAkick(Number - 1))); + FOREACH_MOD(I_OnAkickDel, OnAkickDel(source, ci, ci->GetAkick(number - 1))); - ++Deleted; - ci->EraseAkick(Number - 1); + ++deleted; + ci->EraseAkick(number - 1); } } delcallback(source, ci, this, mask); @@ -213,7 +213,7 @@ class CommandCSAKick : public Command } else { - const NickAlias *na = findnick(mask); + const NickAlias *na = NickAlias::Find(mask); const NickCore *nc = na ? *na->nc : NULL; for (i = 0, end = ci->GetAkickCount(); i < end; ++i) @@ -266,11 +266,11 @@ class CommandCSAKick : public Command Anope::string timebuf, lastused; if (akick->addtime) - timebuf = do_strftime(akick->addtime, NULL, false); + timebuf = Anope::strftime(akick->addtime, NULL, false); else timebuf = UNKNOWN; if (akick->last_used) - lastused = do_strftime(akick->last_used, NULL, false); + lastused = Anope::strftime(akick->last_used, NULL, false); else lastused = UNKNOWN; @@ -281,7 +281,7 @@ class CommandCSAKick : public Command entry["Created"] = timebuf; entry["Last used"] = lastused; entry["Reason"] = akick->reason; - this->list.addEntry(entry); + this->list.AddEntry(entry); } } nl_list(list, ci, mask); @@ -303,11 +303,11 @@ class CommandCSAKick : public Command Anope::string timebuf, lastused; if (akick->addtime) - timebuf = do_strftime(akick->addtime); + timebuf = Anope::strftime(akick->addtime); else timebuf = UNKNOWN; if (akick->last_used) - lastused = do_strftime(akick->last_used); + lastused = Anope::strftime(akick->last_used); else lastused = UNKNOWN; @@ -318,11 +318,11 @@ class CommandCSAKick : public Command entry["Created"] = timebuf; entry["Last used"] = lastused; entry["Reason"] = akick->reason; - list.addEntry(entry); + list.AddEntry(entry); } } - if (list.isEmpty()) + if (list.IsEmpty()) source.Reply(_("No matching entries on %s autokick list."), ci->name.c_str()); else { @@ -347,7 +347,7 @@ class CommandCSAKick : public Command } ListFormatter list; - list.addColumn("Number").addColumn("Mask").addColumn("Reason"); + list.AddColumn("Number").AddColumn("Mask").AddColumn("Reason"); this->ProcessList(source, ci, params, list); } @@ -360,7 +360,7 @@ class CommandCSAKick : public Command } ListFormatter list; - list.addColumn("Number").addColumn("Mask").addColumn("Creator").addColumn("Created").addColumn("Last used").addColumn("Reason"); + list.AddColumn("Number").AddColumn("Mask").AddColumn("Creator").AddColumn("Created").AddColumn("Last used").AddColumn("Reason"); this->ProcessList(source, ci, params, list); } @@ -416,7 +416,7 @@ class CommandCSAKick : public Command Anope::string cmd = params[1]; Anope::string mask = params.size() > 2 ? params[2] : ""; - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); @@ -427,7 +427,7 @@ class CommandCSAKick : public Command this->OnSyntaxError(source, cmd); else if (!source.AccessFor(ci).HasPriv("AKICK") && !source.HasPriv("chanserv/access/modify")) source.Reply(ACCESS_DENIED); - else if (!cmd.equals_ci("LIST") && !cmd.equals_ci("VIEW") && !cmd.equals_ci("ENFORCE") && readonly) + else if (!cmd.equals_ci("LIST") && !cmd.equals_ci("VIEW") && !cmd.equals_ci("ENFORCE") && Anope::ReadOnly) source.Reply(_("Sorry, channel autokick list modification is temporarily disabled.")); else if (cmd.equals_ci("ADD")) this->DoAdd(source, ci, params); diff --git a/modules/commands/cs_appendtopic.cpp b/modules/commands/cs_appendtopic.cpp index 70cde7b7b..2d7c0f278 100644 --- a/modules/commands/cs_appendtopic.cpp +++ b/modules/commands/cs_appendtopic.cpp @@ -52,7 +52,7 @@ class CommandCSAppendTopic : public Command { const Anope::string &newtopic = params[1]; - Channel *c = findchan(params[0]);; + Channel *c = Channel::Find(params[0]);; if (!c) source.Reply(CHAN_X_NOT_IN_USE, params[0].c_str()); diff --git a/modules/commands/cs_ban.cpp b/modules/commands/cs_ban.cpp index 063d98ab5..e857243f9 100644 --- a/modules/commands/cs_ban.cpp +++ b/modules/commands/cs_ban.cpp @@ -29,7 +29,7 @@ class CommandCSBan : public Command const Anope::string &target = params[1]; const Anope::string &reason = params.size() > 2 ? params[2] : "Requested"; - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); @@ -38,7 +38,7 @@ class CommandCSBan : public Command Channel *c = ci->c; User *u = source.GetUser(); - User *u2 = finduser(target); + User *u2 = User::Find(target, true); AccessGroup u_access = source.AccessFor(ci); @@ -56,14 +56,13 @@ class CommandCSBan : public Command if (u != u2 && ci->HasFlag(CI_PEACE) && u2_access >= u_access) source.Reply(ACCESS_DENIED); - else if (matches_list(ci->c, u2, CMODE_EXCEPT)) + else if (ci->c->MatchesList(u2, CMODE_EXCEPT)) source.Reply(CHAN_EXCEPTED, u2->nick.c_str(), ci->name.c_str()); else if (u2->IsProtected()) source.Reply(ACCESS_DENIED); else { - Anope::string mask; - get_idealban(ci, u2, mask); + Anope::string mask = ci->GetIdealBan(u2); // XXX need a way to detect if someone is overriding Log(LOG_COMMAND, source, this, ci) << "for " << mask; @@ -99,7 +98,7 @@ class CommandCSBan : public Command if (u != uc->user && ci->HasFlag(CI_PEACE) && u2_access >= u_access) continue; - else if (matches_list(ci->c, uc->user, CMODE_EXCEPT)) + else if (ci->c->MatchesList(uc->user, CMODE_EXCEPT)) continue; else if (uc->user->IsProtected()) continue; diff --git a/modules/commands/cs_clearusers.cpp b/modules/commands/cs_clearusers.cpp index d6eed6e4d..3a424e4ce 100644 --- a/modules/commands/cs_clearusers.cpp +++ b/modules/commands/cs_clearusers.cpp @@ -26,7 +26,7 @@ class CommandCSClearUsers : public Command { const Anope::string &chan = params[0]; - Channel *c = findchan(chan); + Channel *c = Channel::Find(chan); Anope::string modebuf; if (!c) diff --git a/modules/commands/cs_clone.cpp b/modules/commands/cs_clone.cpp index aef48ea4c..19a8ad436 100644 --- a/modules/commands/cs_clone.cpp +++ b/modules/commands/cs_clone.cpp @@ -29,7 +29,7 @@ public: Anope::string what = params.size() > 2 ? params[2] : ""; User *u = source.GetUser(); - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); @@ -42,7 +42,7 @@ public: return; } - ChannelInfo *target_ci = cs_findchan(target); + ChannelInfo *target_ci = ChannelInfo::Find(target); if (!target_ci) { source.Reply(CHAN_X_NOT_REGISTERED, target.c_str()); @@ -59,11 +59,11 @@ public: if (what.empty()) { - target_ci->destroy(); + target_ci->Destroy(); target_ci = new ChannelInfo(*ci); target_ci->name = target; (*RegisteredChannelList)[target_ci->name] = target_ci; - target_ci->c = findchan(target_ci->name); + target_ci->c = Channel::Find(target_ci->name); if (target_ci->c) { target_ci->c->ci = target_ci; @@ -88,7 +88,7 @@ public: target_ci->c->SetMode(NULL, CMODE_PERM); if (target_ci->bi && target_ci->c->FindUser(target_ci->bi) == NULL) - target_ci->bi->Join(target_ci->c, &Config->BotModeList); + target_ci->bi->Join(target_ci->c, &ModeManager::DefaultBotModes); } if (target_ci->c && !target_ci->c->topic.empty()) @@ -117,7 +117,7 @@ public: newaccess->creator = taccess->creator; newaccess->last_seen = taccess->last_seen; newaccess->created = taccess->created; - newaccess->Unserialize(taccess->Serialize()); + newaccess->AccessUnserialize(taccess->AccessSerialize()); target_ci->AddAccess(newaccess); } diff --git a/modules/commands/cs_drop.cpp b/modules/commands/cs_drop.cpp index cf8c5040e..829f44026 100644 --- a/modules/commands/cs_drop.cpp +++ b/modules/commands/cs_drop.cpp @@ -26,13 +26,13 @@ class CommandCSDrop : public Command { const Anope::string &chan = params[0]; - if (readonly) + if (Anope::ReadOnly) { source.Reply(_("Sorry, channel de-registration is temporarily disabled.")); // XXX: READ_ONLY_MODE? return; } - ChannelInfo *ci = cs_findchan(chan); + ChannelInfo *ci = ChannelInfo::Find(chan); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); @@ -57,7 +57,7 @@ class CommandCSDrop : public Command FOREACH_MOD(I_OnChanDrop, OnChanDrop(ci)); Channel *c = ci->c; - ci->destroy(); + ci->Destroy(); source.Reply(_("Channel \002%s\002 has been dropped."), chan.c_str()); diff --git a/modules/commands/cs_enforce.cpp b/modules/commands/cs_enforce.cpp index 755cd55b4..4622af04b 100644 --- a/modules/commands/cs_enforce.cpp +++ b/modules/commands/cs_enforce.cpp @@ -50,7 +50,7 @@ class CommandCSEnforce : public Command Log(LOG_COMMAND, source, this) << "to enforce secureops"; - /* Dirty hack to allow chan_set_correct_modes to work ok. + /* Dirty hack to allow Channel::SetCorrectModes to work ok. * We pretend like SECUREOPS is on so it doesn't ignore that * part of the code. This way we can enforce SECUREOPS even * if it's off. @@ -66,7 +66,7 @@ class CommandCSEnforce : public Command { UserContainer *uc = *it; - chan_set_correct_modes(uc->user, c, 0, false); + c->SetCorrectModes(uc->user, false, false); } if (hadsecureops) @@ -95,9 +95,8 @@ class CommandCSEnforce : public Command { User *user = users[i]; - Anope::string mask; - get_idealban(ci, user, mask); - Anope::string reason = translate(user, CHAN_NOT_ALLOWED_TO_JOIN); + Anope::string mask = ci->GetIdealBan(user); + Anope::string reason = Language::Translate(user, CHAN_NOT_ALLOWED_TO_JOIN); c->SetMode(NULL, CMODE_BAN, mask); c->Kick(NULL, user, "%s", reason.c_str()); } @@ -106,7 +105,6 @@ class CommandCSEnforce : public Command void DoCModeR(CommandSource &source, Channel *c) { ChannelInfo *ci = c->ci; - Anope::string mask; if (!ci) return; @@ -127,8 +125,8 @@ class CommandCSEnforce : public Command { User *user = users[i]; - get_idealban(ci, user, mask); - Anope::string reason = translate(user, CHAN_NOT_ALLOWED_TO_JOIN); + Anope::string mask = ci->GetIdealBan(user); + Anope::string reason = Language::Translate(user, CHAN_NOT_ALLOWED_TO_JOIN); if (!c->HasMode(CMODE_REGISTEREDONLY)) c->SetMode(NULL, CMODE_BAN, mask); c->Kick(NULL, user, "%s", reason.c_str()); @@ -145,7 +143,7 @@ class CommandCSEnforce : public Command { const Anope::string &what = params.size() > 1 ? params[1] : ""; - Channel *c = findchan(params[0]); + Channel *c = Channel::Find(params[0]); if (!c) source.Reply(CHAN_X_NOT_IN_USE, params[0].c_str()); diff --git a/modules/commands/cs_entrymsg.cpp b/modules/commands/cs_entrymsg.cpp index 1fce5fac0..85e428cc1 100644 --- a/modules/commands/cs_entrymsg.cpp +++ b/modules/commands/cs_entrymsg.cpp @@ -15,7 +15,7 @@ struct EntryMsg : Serializable { - serialize_obj<ChannelInfo> ci; + Serialize::Reference<ChannelInfo> ci; Anope::string creator; Anope::string message; time_t when; @@ -28,31 +28,31 @@ struct EntryMsg : Serializable this->when = ct; } - Serialize::Data serialize() const anope_override + Serialize::Data Serialize() const anope_override { Serialize::Data data; data["ci"] << this->ci->name; data["creator"] << this->creator; data["message"] << this->message; - data["when"].setType(Serialize::DT_INT) << this->when; + data["when"].SetType(Serialize::DT_INT) << this->when; return data; } - static Serializable* unserialize(Serializable *obj, Serialize::Data &data); + static Serializable* Unserialize(Serializable *obj, Serialize::Data &data); }; static unsigned MaxEntries = 0; -struct EntryMessageList : serialize_checker<std::vector<EntryMsg *> >, ExtensibleItem +struct EntryMessageList : Serialize::Checker<std::vector<EntryMsg *> >, ExtensibleItem { - EntryMessageList() : serialize_checker<std::vector<EntryMsg *> >("EntryMsg") { } + EntryMessageList() : Serialize::Checker<std::vector<EntryMsg *> >("EntryMsg") { } }; -Serializable* EntryMsg::unserialize(Serializable *obj, Serialize::Data &data) +Serializable* EntryMsg::Unserialize(Serializable *obj, Serialize::Data &data) { - ChannelInfo *ci = cs_findchan(data["ci"].astr()); + ChannelInfo *ci = ChannelInfo::Find(data["ci"].astr()); if (!ci) return NULL; @@ -99,7 +99,7 @@ class CommandEntryMessage : public Command source.Reply(_("Entry message list for \002%s\002:"), ci->name.c_str()); ListFormatter list; - list.addColumn("Number").addColumn("Creator").addColumn("Created").addColumn("Message"); + list.AddColumn("Number").AddColumn("Creator").AddColumn("Created").AddColumn("Message"); for (unsigned i = 0; i < (*messages)->size(); ++i) { EntryMsg *msg = (*messages)->at(i); @@ -107,9 +107,9 @@ class CommandEntryMessage : public Command ListFormatter::ListEntry entry; entry["Number"] = stringify(i + 1); entry["Creator"] = msg->creator; - entry["Created"] = do_strftime(msg->when); + entry["Created"] = Anope::strftime(msg->when); entry["Message"] = msg->message; - list.addEntry(entry); + list.AddEntry(entry); } std::vector<Anope::string> replies; @@ -159,7 +159,7 @@ class CommandEntryMessage : public Command unsigned i = convertTo<unsigned>(message); if (i > 0 && i <= (*messages)->size()) { - (*messages)->at(i - 1)->destroy(); + (*messages)->at(i - 1)->Destroy(); (*messages)->erase((*messages)->begin() + i - 1); if ((*messages)->empty()) ci->Shrink("cs_entrymsg"); @@ -182,7 +182,7 @@ class CommandEntryMessage : public Command if (messages != NULL) { for (unsigned i = 0; i < (*messages)->size(); ++i) - (*messages)->at(i)->destroy(); + (*messages)->at(i)->Destroy(); (*messages)->clear(); ci->Shrink("cs_entrymsg"); } @@ -203,7 +203,7 @@ class CommandEntryMessage : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); @@ -258,11 +258,11 @@ class CommandEntryMessage : public Command class CSEntryMessage : public Module { - SerializeType entrymsg_type; + Serialize::Type entrymsg_type; CommandEntryMessage commandentrymsg; public: - CSEntryMessage(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), entrymsg_type("EntryMsg", EntryMsg::unserialize), commandentrymsg(this) + CSEntryMessage(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), entrymsg_type("EntryMsg", EntryMsg::Unserialize), commandentrymsg(this) { this->SetAuthor("Anope"); diff --git a/modules/commands/cs_fantasy_stats.cpp b/modules/commands/cs_fantasy_stats.cpp index 7c79593a2..bbe135298 100644 --- a/modules/commands/cs_fantasy_stats.cpp +++ b/modules/commands/cs_fantasy_stats.cpp @@ -66,7 +66,7 @@ class CSStats : public Module { CommandCSStats commandcsstats; CommandCSGStats commandcsgstats; - service_reference<SQLProvider> sql; + ServiceReference<SQLProvider> sql; MySQLInterface sqlinterface; Anope::string prefix; public: @@ -86,7 +86,7 @@ class CSStats : public Module ConfigReader config; prefix = config.ReadValue("chanstats", "prefix", "anope_", 0); Anope::string engine = config.ReadValue("chanstats", "engine", "", 0); - this->sql = service_reference<SQLProvider>("SQLProvider", engine); + this->sql = ServiceReference<SQLProvider>("SQLProvider", engine); } SQLResult RunQuery(const SQLQuery &query) @@ -108,7 +108,7 @@ class CSStats : public Module Anope::string display; if (params.empty()) display = source.nc->display; - else if (const NickAlias *na = findnick(params[0])) + else if (const NickAlias *na = NickAlias::Find(params[0])) display = na->nc->display; else { diff --git a/modules/commands/cs_fantasy_top.cpp b/modules/commands/cs_fantasy_top.cpp index 587b4c525..86e25f122 100644 --- a/modules/commands/cs_fantasy_top.cpp +++ b/modules/commands/cs_fantasy_top.cpp @@ -93,7 +93,7 @@ class CSTop : public Module CommandCSGTop commandcsgtop; CommandCSTop10 commandcstop10; CommandCSGTop10 commandcsgtop10; - service_reference<SQLProvider> sql; + ServiceReference<SQLProvider> sql; MySQLInterface sqlinterface; Anope::string prefix; @@ -115,7 +115,7 @@ class CSTop : public Module ConfigReader config; prefix = config.ReadValue("chanstats", "prefix", "anope_", 0); Anope::string engine = config.ReadValue("chanstats", "engine", "", 0); - this->sql = service_reference<SQLProvider>("SQLProvider", engine); + this->sql = ServiceReference<SQLProvider>("SQLProvider", engine); } SQLResult RunQuery(const SQLQuery &query) diff --git a/modules/commands/cs_flags.cpp b/modules/commands/cs_flags.cpp index c137b55b1..65ae33f2f 100644 --- a/modules/commands/cs_flags.cpp +++ b/modules/commands/cs_flags.cpp @@ -32,12 +32,12 @@ class FlagsChanAccess : public ChanAccess return false; } - Anope::string Serialize() const + Anope::string AccessSerialize() const { return Anope::string(this->flags.begin(), this->flags.end()); } - void Unserialize(const Anope::string &data) anope_override + void AccessUnserialize(const Anope::string &data) anope_override { for (unsigned i = data.length(); i > 0; --i) this->flags.insert(data[i - 1]); @@ -46,7 +46,7 @@ class FlagsChanAccess : public ChanAccess static Anope::string DetermineFlags(const ChanAccess *access) { if (access->provider->name == "access/flags") - return access->Serialize(); + return access->AccessSerialize(); std::set<char> buffer; @@ -86,9 +86,9 @@ class CommandCSFlags : public Command AccessGroup u_access = source.AccessFor(ci); - if (mask.find_first_of("!*@") == Anope::string::npos && !findnick(mask)) + if (mask.find_first_of("!*@") == Anope::string::npos && !NickAlias::Find(mask)) { - User *targ = finduser(mask); + User *targ = User::Find(mask, true); if (targ != NULL) mask = "*!*@" + targ->GetDisplayedHost(); else @@ -191,7 +191,7 @@ class CommandCSFlags : public Command return; } - service_reference<AccessProvider> provider("AccessProvider", "access/flags"); + ServiceReference<AccessProvider> provider("AccessProvider", "access/flags"); if (!provider) return; FlagsChanAccess *access = anope_dynamic_static_cast<FlagsChanAccess *>(provider->Create()); @@ -209,8 +209,8 @@ class CommandCSFlags : public Command FOREACH_MOD(I_OnAccessAdd, OnAccessAdd(ci, source, access)); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to modify " << mask << "'s flags to " << access->Serialize(); - source.Reply(_("Access for \002%s\002 on %s set to +\002%s\002"), access->mask.c_str(), ci->name.c_str(), access->Serialize().c_str()); + Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to modify " << mask << "'s flags to " << access->AccessSerialize(); + source.Reply(_("Access for \002%s\002 on %s set to +\002%s\002"), access->mask.c_str(), ci->name.c_str(), access->AccessSerialize().c_str()); return; } @@ -227,7 +227,7 @@ class CommandCSFlags : public Command ListFormatter list; - list.addColumn("Number").addColumn("Mask").addColumn("Flags").addColumn("Creator").addColumn("Created"); + list.AddColumn("Number").AddColumn("Mask").AddColumn("Flags").AddColumn("Creator").AddColumn("Created"); unsigned count = 0; for (unsigned i = 0, end = ci->GetAccessCount(); i < end; ++i) @@ -257,11 +257,11 @@ class CommandCSFlags : public Command entry["Mask"] = access->mask; entry["Flags"] = FlagsChanAccess::DetermineFlags(access); entry["Creator"] = access->creator; - entry["Created"] = do_strftime(access->created, source.nc, true); - list.addEntry(entry); + entry["Created"] = Anope::strftime(access->created, source.nc, true); + list.AddEntry(entry); } - if (list.isEmpty()) + if (list.IsEmpty()) source.Reply(_("No matching entries on %s access list."), ci->name.c_str()); else { @@ -311,7 +311,7 @@ class CommandCSFlags : public Command const Anope::string &chan = params[0]; const Anope::string &cmd = params[1]; - ChannelInfo *ci = cs_findchan(chan); + ChannelInfo *ci = ChannelInfo::Find(chan); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str()); @@ -329,7 +329,7 @@ class CommandCSFlags : public Command if (!has_access) source.Reply(ACCESS_DENIED); - else if (readonly && !is_list) + else if (Anope::ReadOnly && !is_list) source.Reply(_("Sorry, channel access list modification is temporarily disabled.")); else if (cmd.equals_ci("MODIFY")) this->DoModify(source, ci, params); @@ -374,7 +374,7 @@ class CommandCSFlags : public Command Privilege *p = PrivilegeManager::FindPrivilege(it->second); if (p == NULL) continue; - source.Reply(" %c - %s", it->first, translate(source.nc, p->desc.c_str())); + source.Reply(" %c - %s", it->first, Language::Translate(source.nc, p->desc.c_str())); } return true; diff --git a/modules/commands/cs_getkey.cpp b/modules/commands/cs_getkey.cpp index e0205ad03..212388e3f 100644 --- a/modules/commands/cs_getkey.cpp +++ b/modules/commands/cs_getkey.cpp @@ -26,7 +26,7 @@ class CommandCSGetKey : public Command { const Anope::string &chan = params[0]; - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::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 310879135..c485c3cb4 100644 --- a/modules/commands/cs_info.cpp +++ b/modules/commands/cs_info.cpp @@ -22,7 +22,7 @@ class CommandCSInfo : public Command if (!buf.empty()) buf += ", "; - buf += translate(nc, str); + buf += Language::Translate(nc, str); } } @@ -39,7 +39,7 @@ class CommandCSInfo : public Command const Anope::string &chan = params[0]; NickCore *nc = source.nc; - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); @@ -65,8 +65,8 @@ class CommandCSInfo : public Command if (!ci->desc.empty()) info["Description"] = ci->desc; - info["Registered"] = do_strftime(ci->time_registered); - info["Last used"] = do_strftime(ci->last_used); + info["Registered"] = Anope::strftime(ci->time_registered); + info["Last used"] = Anope::strftime(ci->last_used); const ModeLock *secret = ci->GetMLock(CMODE_SECRET); if (!ci->last_topic.empty() && (show_all || ((!secret || secret->set == false) && (!ci->c || !ci->c->HasMode(CMODE_SECRET))))) @@ -103,7 +103,7 @@ class CommandCSInfo : public Command info["Mode lock"] = ml; if (!ci->HasFlag(CI_NO_EXPIRE)) - info["Expires on"] = do_strftime(ci->last_used + Config->CSExpire); + info["Expires on"] = Anope::strftime(ci->last_used + Config->CSExpire); } if (ci->HasFlag(CI_SUSPENDED)) { diff --git a/modules/commands/cs_invite.cpp b/modules/commands/cs_invite.cpp index 32ef87e3e..1085947a2 100644 --- a/modules/commands/cs_invite.cpp +++ b/modules/commands/cs_invite.cpp @@ -27,7 +27,7 @@ class CommandCSInvite : public Command const Anope::string &chan = params[0]; User *u = source.GetUser(); - Channel *c = findchan(chan); + Channel *c = Channel::Find(chan); if (!c) { @@ -52,7 +52,7 @@ class CommandCSInvite : public Command if (params.size() == 1) u2 = u; else - u2 = finduser(params[1]); + u2 = User::Find(params[1], true); if (!u2) { @@ -71,7 +71,7 @@ class CommandCSInvite : public Command { bool override = !source.AccessFor(ci).HasPriv("INVITE"); - ircdproto->SendInvite(ci->WhoSends(), c, u2); + IRCD->SendInvite(ci->WhoSends(), c, u2); if (u2 != u) { source.Reply(_("\002%s\002 has been invited to \002%s\002."), u2->nick.c_str(), c->name.c_str()); diff --git a/modules/commands/cs_kick.cpp b/modules/commands/cs_kick.cpp index 97d879416..4073f3fe8 100644 --- a/modules/commands/cs_kick.cpp +++ b/modules/commands/cs_kick.cpp @@ -30,9 +30,9 @@ class CommandCSKick : public Command const Anope::string &reason = params.size() > 2 ? params[2] : "Requested"; User *u = source.GetUser(); - ChannelInfo *ci = cs_findchan(params[0]); - Channel *c = findchan(params[0]); - User *u2 = finduser(target); + ChannelInfo *ci = ChannelInfo::Find(params[0]); + Channel *c = Channel::Find(params[0]); + User *u2 = User::Find(target, true); if (!c) { diff --git a/modules/commands/cs_list.cpp b/modules/commands/cs_list.cpp index db5a5136a..9132d07a8 100644 --- a/modules/commands/cs_list.cpp +++ b/modules/commands/cs_list.cpp @@ -33,8 +33,9 @@ class CommandCSList : public Command if (pattern[0] == '#') { - Anope::string n1 = myStrGetToken(pattern.substr(1), '-', 0), /* Read FROM out */ - n2 = myStrGetTokenRemainder(pattern, '-', 1); + Anope::string n1, n2; + sepstream(pattern.substr(1), '-').GetToken(n1, 0); + sepstream(pattern, '-').GetToken(n2, 1); try { @@ -72,7 +73,7 @@ class CommandCSList : public Command source.Reply(_("List of entries matching \002%s\002:"), pattern.c_str()); ListFormatter list; - list.addColumn("Name").addColumn("Description"); + list.AddColumn("Name").AddColumn("Description"); for (registered_channel_map::const_iterator it = RegisteredChannelList->begin(), it_end = RegisteredChannelList->end(); it != it_end; ++it) { @@ -99,7 +100,7 @@ class CommandCSList : public Command entry["Description"] = "[Suspended]"; else entry["Description"] = ci->desc; - list.addEntry(entry); + list.AddEntry(entry); } ++count; } diff --git a/modules/commands/cs_log.cpp b/modules/commands/cs_log.cpp index bd630b4e2..4965ab561 100644 --- a/modules/commands/cs_log.cpp +++ b/modules/commands/cs_log.cpp @@ -28,7 +28,7 @@ public: { const Anope::string &channel = params[0]; - ChannelInfo *ci = cs_findchan(channel); + ChannelInfo *ci = ChannelInfo::Find(channel); if (ci == NULL) source.Reply(CHAN_X_NOT_REGISTERED, channel.c_str()); else if (!source.AccessFor(ci).HasPriv("SET") && !source.HasPriv("chanserv/set")) @@ -40,7 +40,7 @@ public: else { ListFormatter list; - list.addColumn("Number").addColumn("Service").addColumn("Command").addColumn("Method").addColumn(""); + list.AddColumn("Number").AddColumn("Service").AddColumn("Command").AddColumn("Method").AddColumn(""); for (unsigned i = 0; i < ci->log_settings->size(); ++i) { @@ -52,7 +52,7 @@ public: entry["Command"] = log->command_name; entry["Method"] = log->method; entry[""] = log->extra; - list.addEntry(entry); + list.AddEntry(entry); } source.Reply(_("Log list for %s:"), ci->name.c_str()); @@ -79,7 +79,7 @@ public: Anope::string service = command.substr(0, sl), command_name = command.substr(sl + 1); - BotInfo *bi = findbot(service); + BotInfo *bi = BotInfo::Find(service, true); if (bi == NULL || bi->commands.count(command_name) == 0) { @@ -87,7 +87,7 @@ public: return; } - service_reference<Command> c_service("Command", bi->commands[command_name].name); + ServiceReference<Command> c_service("Command", bi->commands[command_name].name); if (!c_service) { source.Reply(_("%s is not a valid command."), command.c_str()); @@ -117,7 +117,7 @@ public: { if (log->extra == extra) { - log->destroy(); + log->Destroy(); ci->log_settings->erase(ci->log_settings->begin() + i - 1); Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to remove logging for " << command << " with method " << method << (extra == "" ? "" : " ") << extra; source.Reply(_("Logging for command %s on %s with log method %s%s%s has been removed."), command_name.c_str(), bi->nick.c_str(), method.c_str(), extra.empty() ? "" : " ", extra.empty() ? "" : extra.c_str()); @@ -194,7 +194,7 @@ class CSLog : public Module void OnLog(Log *l) anope_override { - if (l->Type != LOG_COMMAND || l->u == NULL || l->c == NULL || l->ci == NULL || !Me || !Me->IsSynced()) + if (l->type != LOG_COMMAND || l->u == NULL || l->c == NULL || l->ci == NULL || !Me || !Me->IsSynced()) return; for (unsigned i = l->ci->log_settings->size(); i > 0; --i) @@ -207,13 +207,13 @@ class CSLog : public Module if (log->method.equals_ci("MESSAGE") && l->ci->c && l->ci->bi && l->ci->c->FindUser(l->ci->bi) != NULL) { - ircdproto->SendPrivmsg(l->ci->bi, log->extra + l->ci->c->name, "%s", buffer.c_str()); + IRCD->SendPrivmsg(l->ci->bi, log->extra + l->ci->c->name, "%s", buffer.c_str()); l->ci->bi->lastmsg = Anope::CurTime; } else if (log->method.equals_ci("NOTICE") && l->ci->c && l->ci->bi && l->ci->c->FindUser(l->ci->bi) != NULL) - ircdproto->SendNotice(l->ci->bi, log->extra + l->ci->c->name, "%s", buffer.c_str()); - else if (log->method.equals_ci("MEMO") && memoserv && l->ci->WhoSends() != NULL) - memoserv->Send(l->ci->WhoSends()->nick, l->ci->name, buffer, true); + IRCD->SendNotice(l->ci->bi, log->extra + l->ci->c->name, "%s", buffer.c_str()); + else if (log->method.equals_ci("MEMO") && MemoServService && l->ci->WhoSends() != NULL) + MemoServService->Send(l->ci->WhoSends()->nick, l->ci->name, buffer, true); } } } diff --git a/modules/commands/cs_mode.cpp b/modules/commands/cs_mode.cpp index 840912aaf..c33b317a2 100644 --- a/modules/commands/cs_mode.cpp +++ b/modules/commands/cs_mode.cpp @@ -17,7 +17,7 @@ class CommandCSMode : public Command { bool CanSet(CommandSource &source, ChannelInfo *ci, ChannelMode *cm) { - if (!ci || !cm || cm->Type != MODE_STATUS) + if (!ci || !cm || cm->type != MODE_STATUS) return false; const Anope::string accesses[] = { "VOICE", "HALFOP", "OPDEOP", "PROTECT", "OWNER", "" }; @@ -30,7 +30,7 @@ class CommandCSMode : public Command if (access.HasPriv(accesses[i])) { ChannelMode *cm2 = ModeManager::FindChannelModeByName(modes[i]); - if (cm2 == NULL || cm2->Type != MODE_STATUS) + if (cm2 == NULL || cm2->type != MODE_STATUS) continue; ChannelModeStatus *cms2 = anope_dynamic_static_cast<ChannelModeStatus *>(cm2); if (cms2->Level > u_level) @@ -82,15 +82,15 @@ class CommandCSMode : public Command } Anope::string mode_param; - if (((cm->Type == MODE_STATUS || cm->Type == MODE_LIST) && !sep.GetToken(mode_param)) || (cm->Type == MODE_PARAM && adding && !sep.GetToken(mode_param))) - source.Reply(_("Missing parameter for mode %c."), cm->ModeChar); + if (((cm->type == MODE_STATUS || cm->type == MODE_LIST) && !sep.GetToken(mode_param)) || (cm->type == MODE_PARAM && adding && !sep.GetToken(mode_param))) + source.Reply(_("Missing parameter for mode %c."), cm->mchar); else { ci->SetMLock(cm, adding, mode_param, source.GetNick()); if (!mode_param.empty()) mode_param = " " + mode_param; - source.Reply(_("%c%c%s locked on %s"), adding ? '+' : '-', cm->ModeChar, mode_param.c_str(), ci->name.c_str()); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to lock " << (adding ? '+' : '-') << cm->ModeChar << mode_param; + source.Reply(_("%c%c%s locked on %s"), adding ? '+' : '-', cm->mchar, mode_param.c_str(), ci->name.c_str()); + Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to lock " << (adding ? '+' : '-') << cm->mchar << mode_param; } } } @@ -132,19 +132,19 @@ class CommandCSMode : public Command } Anope::string mode_param; - if (!cm->Type == MODE_REGULAR && !sep.GetToken(mode_param)) - source.Reply(_("Missing parameter for mode %c."), cm->ModeChar); + if (!cm->type == MODE_REGULAR && !sep.GetToken(mode_param)) + source.Reply(_("Missing parameter for mode %c."), cm->mchar); else { if (ci->RemoveMLock(cm, adding, mode_param)) { if (!mode_param.empty()) mode_param = " " + mode_param; - source.Reply(_("%c%c%s has been unlocked from %s."), adding == 1 ? '+' : '-', cm->ModeChar, mode_param.c_str(), ci->name.c_str()); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to unlock " << (adding ? '+' : '-') << cm->ModeChar << mode_param; + source.Reply(_("%c%c%s has been unlocked from %s."), adding == 1 ? '+' : '-', cm->mchar, mode_param.c_str(), ci->name.c_str()); + Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to unlock " << (adding ? '+' : '-') << cm->mchar << mode_param; } else - source.Reply(_("%c%c is not locked on %s."), adding == 1 ? '+' : '-', cm->ModeChar, ci->name.c_str()); + source.Reply(_("%c%c is not locked on %s."), adding == 1 ? '+' : '-', cm->mchar, ci->name.c_str()); } } } @@ -159,7 +159,7 @@ class CommandCSMode : public Command else { ListFormatter list; - list.addColumn("Mode").addColumn("Param").addColumn("Creator").addColumn("Created"); + list.AddColumn("Mode").AddColumn("Param").AddColumn("Creator").AddColumn("Created"); for (ChannelInfo::ModeList::const_iterator it = mlocks.begin(), it_end = mlocks.end(); it != it_end; ++it) { @@ -169,11 +169,11 @@ class CommandCSMode : public Command continue; ListFormatter::ListEntry entry; - entry["Mode"] = Anope::printf("%c%c", ml->set ? '+' : '-', cm->ModeChar); + entry["Mode"] = Anope::printf("%c%c", ml->set ? '+' : '-', cm->mchar); entry["Param"] = ml->param; entry["Creator"] = ml->setter; - entry["Created"] = do_strftime(ml->created, source.nc, false); - list.addEntry(entry); + entry["Created"] = Anope::strftime(ml->created, source.nc, false); + list.AddEntry(entry); } source.Reply(_("Mode locks for %s:"), ci->name.c_str()); @@ -218,7 +218,7 @@ class CommandCSMode : public Command ChannelMode *cm = ModeManager::ChannelModes[j]; if (!u || cm->CanSet(u)) { - if (cm->Type == MODE_REGULAR || (!adding && cm->Type == MODE_PARAM)) + if (cm->type == MODE_REGULAR || (!adding && cm->type == MODE_PARAM)) { if (adding) ci->c->SetMode(NULL, cm); @@ -234,7 +234,7 @@ class CommandCSMode : public Command ChannelMode *cm = ModeManager::FindChannelModeByChar(modes[i]); if (!cm || (u && !cm->CanSet(u))) continue; - switch (cm->Type) + switch (cm->type) { case MODE_REGULAR: if (adding) @@ -257,13 +257,13 @@ class CommandCSMode : public Command if (!this->CanSet(source, ci, cm)) { - source.Reply(_("You do not have access to set mode %c."), cm->ModeChar); + source.Reply(_("You do not have access to set mode %c."), cm->mchar); break; } AccessGroup u_access = source.AccessFor(ci); - if (str_is_wildcard(param)) + if (param.find_first_of("*?") != Anope::string::npos) { for (CUserList::const_iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it) { @@ -288,7 +288,7 @@ class CommandCSMode : public Command } else { - User *target = finduser(param); + User *target = User::Find(param, true); if (target == NULL) { source.Reply(NICK_X_NOT_IN_USE, param.c_str()); @@ -316,7 +316,7 @@ class CommandCSMode : public Command ci->c->SetMode(NULL, cm, param); else { - std::pair<Channel::ModeList::iterator, Channel::ModeList::iterator> its = ci->c->GetModeList(cm->Name); + std::pair<Channel::ModeList::iterator, Channel::ModeList::iterator> its = ci->c->GetModeList(cm->name); for (; its.first != its.second;) { const Anope::string &mask = its.first->second; @@ -343,7 +343,7 @@ class CommandCSMode : public Command { const Anope::string &subcommand = params[1]; - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (!ci || !ci->c) source.Reply(CHAN_X_NOT_IN_USE, params[0].c_str()); diff --git a/modules/commands/cs_modes.cpp b/modules/commands/cs_modes.cpp index 2775e92bc..696c38dde 100644 --- a/modules/commands/cs_modes.cpp +++ b/modules/commands/cs_modes.cpp @@ -18,8 +18,8 @@ class CommandModeBase : public Command void do_mode(CommandSource &source, Command *com, ChannelMode *cm, const Anope::string &chan, const Anope::string &nick, bool set, const Anope::string &level, const Anope::string &levelself) { User *u = source.GetUser(); - User *u2 = finduser(nick); - Channel *c = findchan(chan); + User *u2 = User::Find(nick, true); + Channel *c = Channel::Find(chan); if (!c) { diff --git a/modules/commands/cs_register.cpp b/modules/commands/cs_register.cpp index 28fb931f5..e756482c7 100644 --- a/modules/commands/cs_register.cpp +++ b/modules/commands/cs_register.cpp @@ -29,10 +29,10 @@ class CommandCSRegister : public Command User *u = source.GetUser(); NickCore *nc = source.nc; - Channel *c = findchan(params[0]); - ChannelInfo *ci = cs_findchan(params[0]); + Channel *c = Channel::Find(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); - if (readonly) + if (Anope::ReadOnly) source.Reply(_("Sorry, channel registration is temporarily disabled.")); else if (nc->HasFlag(NI_UNCONFIRMED)) source.Reply(_("You must confirm your account before you can register a channel.")); @@ -40,7 +40,7 @@ class CommandCSRegister : public Command source.Reply(_("Local channels cannot be registered.")); else if (chan[0] != '#') source.Reply(CHAN_SYMBOL_REQUIRED); - else if (!ircdproto->IsChannelValid(chan)) + else if (!IRCD->IsChannelValid(chan)) source.Reply(CHAN_X_INVALID, chan.c_str()); else if (ci) source.Reply(_("Channel \002%s\002 is already registered!"), chan.c_str()); @@ -55,7 +55,7 @@ class CommandCSRegister : public Command if (!chdesc.empty()) ci->desc = chdesc; - for (ChannelInfo::ModeList::iterator it = def_mode_locks.begin(), it_end = def_mode_locks.end(); it != it_end; ++it) + for (ChannelInfo::ModeList::iterator it = ModeManager::DefaultModeLocks.begin(), it_end = ModeManager::DefaultModeLocks.end(); it != it_end; ++it) { ModeLock *ml = new ModeLock(*it->second); ml->setter = source.GetNick(); diff --git a/modules/commands/cs_saset.cpp b/modules/commands/cs_saset.cpp index a4a72ee76..211148e13 100644 --- a/modules/commands/cs_saset.cpp +++ b/modules/commands/cs_saset.cpp @@ -43,7 +43,7 @@ class CommandCSSASet : public Command const CommandInfo &info = it->second; if (c_name.find_ci(this_name + " ") == 0) { - service_reference<Command> command("Command", info.name); + ServiceReference<Command> command("Command", info.name); if (command) { source.command = it->first; diff --git a/modules/commands/cs_saset_noexpire.cpp b/modules/commands/cs_saset_noexpire.cpp index 78d8641d4..1c7b260ec 100644 --- a/modules/commands/cs_saset_noexpire.cpp +++ b/modules/commands/cs_saset_noexpire.cpp @@ -24,7 +24,7 @@ class CommandCSSASetNoexpire : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); diff --git a/modules/commands/cs_seen.cpp b/modules/commands/cs_seen.cpp index d2686e013..18a21d35e 100644 --- a/modules/commands/cs_seen.cpp +++ b/modules/commands/cs_seen.cpp @@ -38,7 +38,7 @@ struct SeenInfo : Serializable { } - Serialize::Data serialize() const anope_override + Serialize::Data Serialize() const anope_override { Serialize::Data data; @@ -48,12 +48,12 @@ struct SeenInfo : Serializable data["nick2"] << nick2; data["channel"] << channel; data["message"] << message; - data["last"].setType(Serialize::DT_INT) << last; + data["last"].SetType(Serialize::DT_INT) << last; return data; } - static Serializable* unserialize(Serializable *obj, Serialize::Data &data) + static Serializable* Unserialize(Serializable *obj, Serialize::Data &data) { SeenInfo *s; if (obj) @@ -95,8 +95,8 @@ static SeenInfo *FindInfo(const Anope::string &nick) static bool ShouldHide(const Anope::string &channel, User *u) { - Channel *targetchan = findchan(channel); - const ChannelInfo *targetchan_ci = targetchan ? *targetchan->ci : cs_findchan(channel); + Channel *targetchan = Channel::Find(channel); + const ChannelInfo *targetchan_ci = targetchan ? *targetchan->ci : ChannelInfo::Find(channel); if (targetchan && targetchan->HasMode(CMODE_SECRET)) return true; @@ -137,7 +137,7 @@ class CommandOSSeen : public Command else if (params[0].equals_ci("CLEAR")) { time_t time = 0; - if ((params.size() < 2) || (0 >= (time = dotime(params[1])))) + if ((params.size() < 2) || (0 >= (time = Anope::DoTime(params[1])))) { this->OnSyntaxError(source, params[0]); return; @@ -151,14 +151,14 @@ class CommandOSSeen : public Command ++it; if (time < buf->second->last) { - Log(LOG_DEBUG) << buf->first << " was last seen " << do_strftime(buf->second->last) << ", deleting entry"; - buf->second->destroy(); + Log(LOG_DEBUG) << buf->first << " was last seen " << Anope::strftime(buf->second->last) << ", deleting entry"; + buf->second->Destroy(); database.erase(buf); counter++; } } - Log(LOG_ADMIN, source, this) << "CLEAR and removed " << counter << " nicks that were added after " << do_strftime(time, NULL, true); - source.Reply(_("Database cleared, removed %lu nicks that were added after %s"), counter, do_strftime(time, source.nc, true).c_str()); + Log(LOG_ADMIN, source, this) << "CLEAR and removed " << counter << " nicks that were added after " << Anope::strftime(time, NULL, true); + source.Reply(_("Database cleared, removed %lu nicks that were added after %s"), counter, Anope::strftime(time, source.nc, true).c_str()); } else this->SendSyntax(source); @@ -199,7 +199,7 @@ class CommandSeen : public Command return; } - if (findbot(target) != NULL) + if (BotInfo::Find(target, true) != NULL) { source.Reply(_("%s is a client on services."), target.c_str()); return; @@ -218,15 +218,15 @@ class CommandSeen : public Command return; } - User *u2 = finduser(target); + User *u2 = User::Find(target, true); Anope::string onlinestatus; if (u2) onlinestatus = "."; else onlinestatus = Anope::printf(_(" but %s mysteriously dematerialized."), target.c_str()); - Anope::string timebuf = duration(Anope::CurTime - info->last, source.nc); - Anope::string timebuf2 = do_strftime(info->last, source.nc, true); + Anope::string timebuf = Anope::Duration(Anope::CurTime - info->last, source.nc); + Anope::string timebuf2 = Anope::strftime(info->last, source.nc, true); if (info->type == NEW) { @@ -235,7 +235,7 @@ class CommandSeen : public Command } else if (info->type == NICK_TO) { - u2 = finduser(info->nick2); + u2 = User::Find(info->nick2, true); if (u2) onlinestatus = Anope::printf( _(". %s is still online."), u2->nick.c_str()); else @@ -309,8 +309,8 @@ class DataBasePurger : public CallBack if ((Anope::CurTime - cur->second->last) > purgetime) { - Log(LOG_DEBUG) << cur->first << " was last seen " << do_strftime(cur->second->last) << ", purging entry"; - cur->second->destroy(); + Log(LOG_DEBUG) << cur->first << " was last seen " << Anope::strftime(cur->second->last) << ", purging entry"; + cur->second->Destroy(); database.erase(cur); } } @@ -320,12 +320,12 @@ class DataBasePurger : public CallBack class CSSeen : public Module { - SerializeType seeninfo_type; + Serialize::Type seeninfo_type; CommandSeen commandseen; CommandOSSeen commandosseen; DataBasePurger purger; public: - CSSeen(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), seeninfo_type("SeenInfo", SeenInfo::unserialize), commandseen(this), commandosseen(this), purger(this) + CSSeen(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), seeninfo_type("SeenInfo", SeenInfo::Unserialize), commandseen(this), commandosseen(this), purger(this) { this->SetAuthor("Anope"); @@ -344,14 +344,14 @@ class CSSeen : public Module void OnReload() anope_override { ConfigReader config; - purgetime = dotime(config.ReadValue("cs_seen", "purgetime", "30d", 0)); - expiretimeout = dotime(config.ReadValue("cs_seen", "expiretimeout", "1d", 0)); + purgetime = Anope::DoTime(config.ReadValue("cs_seen", "purgetime", "30d", 0)); + expiretimeout = Anope::DoTime(config.ReadValue("cs_seen", "expiretimeout", "1d", 0)); if (purger.GetSecs() != expiretimeout) purger.SetSecs(expiretimeout); } - void OnUserConnect(dynamic_reference<User> &u, bool &exempt) anope_override + void OnUserConnect(Reference<User> &u, bool &exempt) anope_override { if (u) UpdateUser(u, NEW, u->nick, "", "", ""); diff --git a/modules/commands/cs_set.cpp b/modules/commands/cs_set.cpp index 9851a27a1..0ac07e2b2 100644 --- a/modules/commands/cs_set.cpp +++ b/modules/commands/cs_set.cpp @@ -43,7 +43,7 @@ class CommandCSSet : public Command const CommandInfo &info = it->second; if (c_name.find_ci(this_name + " ") == 0) { - service_reference<Command> command("Command", info.name); + ServiceReference<Command> command("Command", info.name); if (command) { source.command = it->first; diff --git a/modules/commands/cs_set_autoop.cpp b/modules/commands/cs_set_autoop.cpp index 8e576be3d..0b00b151b 100644 --- a/modules/commands/cs_set_autoop.cpp +++ b/modules/commands/cs_set_autoop.cpp @@ -24,7 +24,7 @@ class CommandCSSetAutoOp : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); diff --git a/modules/commands/cs_set_bantype.cpp b/modules/commands/cs_set_bantype.cpp index a963720ff..e7dfc52ee 100644 --- a/modules/commands/cs_set_bantype.cpp +++ b/modules/commands/cs_set_bantype.cpp @@ -24,7 +24,7 @@ class CommandCSSetBanType : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); diff --git a/modules/commands/cs_set_chanstats.cpp b/modules/commands/cs_set_chanstats.cpp index 904d7fb22..118387ee4 100644 --- a/modules/commands/cs_set_chanstats.cpp +++ b/modules/commands/cs_set_chanstats.cpp @@ -24,7 +24,7 @@ class CommandCSSetChanstats : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (!ci) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); diff --git a/modules/commands/cs_set_description.cpp b/modules/commands/cs_set_description.cpp index b72c2cf8e..a5ad525ab 100644 --- a/modules/commands/cs_set_description.cpp +++ b/modules/commands/cs_set_description.cpp @@ -24,7 +24,7 @@ class CommandCSSetDescription : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); diff --git a/modules/commands/cs_set_founder.cpp b/modules/commands/cs_set_founder.cpp index a1be1ba91..25b43d481 100644 --- a/modules/commands/cs_set_founder.cpp +++ b/modules/commands/cs_set_founder.cpp @@ -24,7 +24,7 @@ class CommandCSSetFounder : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); @@ -48,7 +48,7 @@ class CommandCSSetFounder : public Command return; } - const NickAlias *na = findnick(params[1]); + const NickAlias *na = NickAlias::Find(params[1]); if (!na) { source.Reply(NICK_X_NOT_REGISTERED, params[1].c_str()); diff --git a/modules/commands/cs_set_keeptopic.cpp b/modules/commands/cs_set_keeptopic.cpp index d95d4ac2b..24b3d4f03 100644 --- a/modules/commands/cs_set_keeptopic.cpp +++ b/modules/commands/cs_set_keeptopic.cpp @@ -24,7 +24,7 @@ class CommandCSSetKeepTopic : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); diff --git a/modules/commands/cs_set_misc.cpp b/modules/commands/cs_set_misc.cpp index b5a01174e..3bf0e9bbd 100644 --- a/modules/commands/cs_set_misc.cpp +++ b/modules/commands/cs_set_misc.cpp @@ -14,7 +14,7 @@ struct CSMiscData : ExtensibleItem, Serializable { - serialize_obj<ChannelInfo> ci; + Serialize::Reference<ChannelInfo> ci; Anope::string name; Anope::string data; @@ -22,7 +22,7 @@ struct CSMiscData : ExtensibleItem, Serializable { } - Serialize::Data serialize() const anope_override + Serialize::Data Serialize() const anope_override { Serialize::Data sdata; @@ -33,9 +33,9 @@ struct CSMiscData : ExtensibleItem, Serializable return sdata; } - static Serializable* unserialize(Serializable *obj, Serialize::Data &data) + static Serializable* Unserialize(Serializable *obj, Serialize::Data &data) { - ChannelInfo *ci = cs_findchan(data["ci"].astr()); + ChannelInfo *ci = ChannelInfo::Find(data["ci"].astr()); if (ci == NULL) return NULL; @@ -75,7 +75,7 @@ class CommandCSSetMisc : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); @@ -108,12 +108,12 @@ class CommandCSSetMisc : public Command class CSSetMisc : public Module { - SerializeType csmiscdata_type; + Serialize::Type csmiscdata_type; CommandCSSetMisc commandcssetmisc; public: CSSetMisc(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), - csmiscdata_type("CSMiscData", CSMiscData::unserialize), commandcssetmisc(this) + csmiscdata_type("CSMiscData", CSMiscData::Unserialize), commandcssetmisc(this) { this->SetAuthor("Anope"); diff --git a/modules/commands/cs_set_peace.cpp b/modules/commands/cs_set_peace.cpp index f7eb8af6b..35459b59b 100644 --- a/modules/commands/cs_set_peace.cpp +++ b/modules/commands/cs_set_peace.cpp @@ -24,7 +24,7 @@ class CommandCSSetPeace : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); diff --git a/modules/commands/cs_set_persist.cpp b/modules/commands/cs_set_persist.cpp index bdd3b9004..03e5d3a84 100644 --- a/modules/commands/cs_set_persist.cpp +++ b/modules/commands/cs_set_persist.cpp @@ -24,7 +24,7 @@ class CommandCSSetPersist : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); @@ -60,21 +60,19 @@ class CommandCSSetPersist : public Command ci->bi->Join(c); } - /* No botserv bot, no channel mode */ - /* Give them ChanServ - * Yes, this works fine with no Config->s_BotServ + /* No botserv bot, no channel mode, give them ChanServ. + * Yes, this works fine with no Config->BotServ. */ if (!ci->bi && !cm) { - BotInfo *bi = findbot(Config->ChanServ); - if (!bi) + if (!ChanServ) { source.Reply(_("ChanServ is required to enable persist on this network.")); return; } - bi->Assign(NULL, ci); - if (!ci->c->FindUser(bi)) - bi->Join(ci->c); + ChanServ->Assign(NULL, ci); + if (!ci->c->FindUser(ChanServ)) + ChanServ->Join(ci->c); } /* Set the perm mode */ @@ -111,14 +109,13 @@ class CommandCSSetPersist : public Command */ if (!cm && Config->BotServ.empty() && ci->bi) { - BotInfo *bi = findbot(Config->ChanServ); - if (!bi) + if (!ChanServ) { source.Reply(_("ChanServ is required to enable persist on this network.")); return; } /* Unassign bot */ - bi->UnAssign(NULL, ci); + ChanServ->UnAssign(NULL, ci); } } diff --git a/modules/commands/cs_set_private.cpp b/modules/commands/cs_set_private.cpp index 45741eb20..a677aaf38 100644 --- a/modules/commands/cs_set_private.cpp +++ b/modules/commands/cs_set_private.cpp @@ -24,7 +24,7 @@ class CommandCSSetPrivate : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); diff --git a/modules/commands/cs_set_restricted.cpp b/modules/commands/cs_set_restricted.cpp index 8b520006a..45a9b188e 100644 --- a/modules/commands/cs_set_restricted.cpp +++ b/modules/commands/cs_set_restricted.cpp @@ -23,7 +23,7 @@ class CommandCSSetRestricted : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); diff --git a/modules/commands/cs_set_secure.cpp b/modules/commands/cs_set_secure.cpp index 84ea75121..7659c8674 100644 --- a/modules/commands/cs_set_secure.cpp +++ b/modules/commands/cs_set_secure.cpp @@ -24,7 +24,7 @@ class CommandCSSetSecure : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); diff --git a/modules/commands/cs_set_securefounder.cpp b/modules/commands/cs_set_securefounder.cpp index b8d7ac14f..d3d22f294 100644 --- a/modules/commands/cs_set_securefounder.cpp +++ b/modules/commands/cs_set_securefounder.cpp @@ -24,7 +24,7 @@ class CommandCSSetSecureFounder : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); diff --git a/modules/commands/cs_set_secureops.cpp b/modules/commands/cs_set_secureops.cpp index c92401e59..9a95735be 100644 --- a/modules/commands/cs_set_secureops.cpp +++ b/modules/commands/cs_set_secureops.cpp @@ -24,7 +24,7 @@ class CommandCSSetSecureOps : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); diff --git a/modules/commands/cs_set_signkick.cpp b/modules/commands/cs_set_signkick.cpp index 52d3934af..f3b482a67 100644 --- a/modules/commands/cs_set_signkick.cpp +++ b/modules/commands/cs_set_signkick.cpp @@ -24,7 +24,7 @@ class CommandCSSetSignKick : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); diff --git a/modules/commands/cs_set_successor.cpp b/modules/commands/cs_set_successor.cpp index 64f875dce..8b36d6853 100644 --- a/modules/commands/cs_set_successor.cpp +++ b/modules/commands/cs_set_successor.cpp @@ -24,7 +24,7 @@ class CommandCSSetSuccessor : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); @@ -55,7 +55,7 @@ class CommandCSSetSuccessor : public Command if (params.size() > 1) { - const NickAlias *na = findnick(params[1]); + const NickAlias *na = NickAlias::Find(params[1]); if (!na) { diff --git a/modules/commands/cs_set_topiclock.cpp b/modules/commands/cs_set_topiclock.cpp index eb0d75e2a..9212d291d 100644 --- a/modules/commands/cs_set_topiclock.cpp +++ b/modules/commands/cs_set_topiclock.cpp @@ -24,7 +24,7 @@ class CommandCSSetTopicLock : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); diff --git a/modules/commands/cs_status.cpp b/modules/commands/cs_status.cpp index b8ac38f77..4d609eb8d 100644 --- a/modules/commands/cs_status.cpp +++ b/modules/commands/cs_status.cpp @@ -26,7 +26,7 @@ public: { const Anope::string &channel = params[0]; - ChannelInfo *ci = cs_findchan(channel); + ChannelInfo *ci = ChannelInfo::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/access/modify")) @@ -38,20 +38,20 @@ public: nick = params[1]; AccessGroup ag; - User *u = finduser(nick); + User *u = User::Find(nick, true); NickAlias *na = NULL; if (u != NULL) ag = ci->AccessFor(u); else { - na = findnick(nick); + na = NickAlias::Find(nick); if (na != NULL) ag = ci->AccessFor(na->nc); } - if (ag.SuperAdmin) + if (ag.super_admin) source.Reply(_("\2%s\2 is a super administrator."), nick.c_str()); - else if (ag.Founder) + else if (ag.founder) source.Reply(_("\2%s\2 is the channel founder."), nick.c_str()); else if (ag.empty()) source.Reply(_("\2%s\2 has no access on \2%s\2."), nick.c_str(), ci->name.c_str()); @@ -63,7 +63,7 @@ public: { ChanAccess *acc = ag[i]; - source.Reply(_("\2%s\2 matches access entry %s, which has privilege %s."), nick.c_str(), acc->mask.c_str(), acc->Serialize().c_str()); + source.Reply(_("\2%s\2 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 bce549e79..b380d4c97 100644 --- a/modules/commands/cs_suspend.cpp +++ b/modules/commands/cs_suspend.cpp @@ -22,7 +22,7 @@ struct ChanSuspend : ExtensibleItem, Serializable { } - Serialize::Data serialize() const anope_override + Serialize::Data Serialize() const anope_override { Serialize::Data sd; @@ -32,9 +32,9 @@ struct ChanSuspend : ExtensibleItem, Serializable return sd; } - static Serializable* unserialize(Serializable *obj, Serialize::Data &sd) + static Serializable* Unserialize(Serializable *obj, Serialize::Data &sd) { - ChannelInfo *ci = cs_findchan(sd["chan"].astr()); + ChannelInfo *ci = ChannelInfo::Find(sd["chan"].astr()); if (ci == NULL) return NULL; @@ -77,7 +77,7 @@ class CommandCSSuspend : public Command expiry.clear(); } else - expiry_secs = dotime(expiry); + expiry_secs = Anope::DoTime(expiry); if (Config->ForceForbidReason && reason.empty()) { @@ -85,10 +85,10 @@ class CommandCSSuspend : public Command return; } - if (readonly) + if (Anope::ReadOnly) source.Reply(READ_ONLY_MODE); - ChannelInfo *ci = cs_findchan(chan); + ChannelInfo *ci = ChannelInfo::Find(chan); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str()); @@ -113,7 +113,7 @@ class CommandCSSuspend : public Command } for (unsigned i = 0; i < users.size(); ++i) - ci->c->Kick(NULL, users[i], "%s", !reason.empty() ? reason.c_str() : translate(users[i], _("This channel has been suspended."))); + ci->c->Kick(NULL, users[i], "%s", !reason.empty() ? reason.c_str() : Language::Translate(users[i], _("This channel has been suspended."))); } if (expiry_secs > 0) @@ -125,7 +125,7 @@ class CommandCSSuspend : public Command ci->Extend("cs_suspend_expire", cs); } - Log(LOG_ADMIN, source, this, ci) << (!reason.empty() ? reason : "No reason") << ", expires in " << (expiry_secs ? do_strftime(Anope::CurTime + expiry_secs) : "never"); + Log(LOG_ADMIN, source, this, ci) << (!reason.empty() ? reason : "No reason") << ", expires in " << (expiry_secs ? Anope::strftime(Anope::CurTime + expiry_secs) : "never"); source.Reply(_("Channel \002%s\002 is now suspended."), ci->name.c_str()); FOREACH_MOD(I_OnChanSuspend, OnChanSuspend(ci)); @@ -161,10 +161,10 @@ class CommandCSUnSuspend : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - if (readonly) + if (Anope::ReadOnly) source.Reply(READ_ONLY_MODE); - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); @@ -206,13 +206,13 @@ class CommandCSUnSuspend : public Command class CSSuspend : public Module { - SerializeType chansuspend_type; + Serialize::Type chansuspend_type; CommandCSSuspend commandcssuspend; CommandCSUnSuspend commandcsunsuspend; public: CSSuspend(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), - chansuspend_type("ChanSuspend", ChanSuspend::unserialize), commandcssuspend(this), commandcsunsuspend(this) + chansuspend_type("ChanSuspend", ChanSuspend::Unserialize), commandcssuspend(this), commandcsunsuspend(this) { this->SetAuthor("Anope"); @@ -247,7 +247,7 @@ class CSSuspend : public Module ci->Shrink("suspend_by"); ci->Shrink("suspend_reason"); - Log(LOG_NORMAL, "expire", findbot(Config->ChanServ)) << "Expiring suspend for " << ci->name; + Log(LOG_NORMAL, "expire", ChanServ) << "Expiring suspend for " << ci->name; } } }; diff --git a/modules/commands/cs_sync.cpp b/modules/commands/cs_sync.cpp index e55864f1b..23d6928a1 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> ¶ms) anope_override { - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); @@ -35,7 +35,7 @@ class CommandCSSync : public Command Log(LOG_COMMAND, source, this, ci); for (CUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it) - chan_set_correct_modes((*it)->user, ci->c, 1, false); + ci->c->SetCorrectModes((*it)->user, true, false); source.Reply(_("All user modes on \002%s\002 have been synced."), ci->name.c_str()); } diff --git a/modules/commands/cs_tban.cpp b/modules/commands/cs_tban.cpp index 1120d05d4..40fdfedb9 100644 --- a/modules/commands/cs_tban.cpp +++ b/modules/commands/cs_tban.cpp @@ -22,7 +22,7 @@ static Module *me; class TempBan : public CallBack { private: - dynamic_reference<Channel> chan; + Reference<Channel> chan; Anope::string mask; public: @@ -46,7 +46,7 @@ class CommandCSTBan : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - Channel *c = findchan(params[0]); + Channel *c = Channel::Find(params[0]); const Anope::string &nick = params[1]; const Anope::string &time = params[2]; @@ -58,23 +58,22 @@ class CommandCSTBan : public Command source.Reply(CHAN_X_NOT_REGISTERED, c->name.c_str()); else if (!source.AccessFor(c->ci).HasPriv("BAN")) source.Reply(ACCESS_DENIED); - else if (!(u2 = finduser(nick))) + else if (!(u2 = User::Find(nick, true))) source.Reply(NICK_X_NOT_IN_USE, nick.c_str()); - else if (matches_list(c, u2, CMODE_EXCEPT)) + else if (c->MatchesList(u2, CMODE_EXCEPT)) source.Reply(CHAN_EXCEPTED, u2->nick.c_str(), c->ci->name.c_str()); else if (u2->IsProtected()) source.Reply(ACCESS_DENIED); else { - time_t t = dotime(time); - Anope::string mask; - get_idealban(c->ci, u2, mask); + time_t t = Anope::DoTime(time); + Anope::string mask = c->ci->GetIdealBan(u2); c->SetMode(NULL, CMODE_BAN, mask); new TempBan(t, c, mask); - Log(LOG_COMMAND, source, this, c->ci) << "for " << mask << " to expire in " << duration(t); + Log(LOG_COMMAND, source, this, c->ci) << "for " << mask << " to expire in " << Anope::Duration(t); - source.Reply(_("%s banned from %s, will auto-expire in %s."), mask.c_str(), c->name.c_str(), duration(t).c_str()); + source.Reply(_("%s banned from %s, will auto-expire in %s."), mask.c_str(), c->name.c_str(), Anope::Duration(t).c_str()); } return; diff --git a/modules/commands/cs_topic.cpp b/modules/commands/cs_topic.cpp index 3474874d6..eccb8b2f6 100644 --- a/modules/commands/cs_topic.cpp +++ b/modules/commands/cs_topic.cpp @@ -27,7 +27,7 @@ class CommandCSTopic : public Command const Anope::string &topic = params.size() > 1 ? params[1] : ""; - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); diff --git a/modules/commands/cs_unban.cpp b/modules/commands/cs_unban.cpp index b60dfebcf..affe8eae9 100644 --- a/modules/commands/cs_unban.cpp +++ b/modules/commands/cs_unban.cpp @@ -24,7 +24,7 @@ class CommandCSUnban : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); @@ -45,7 +45,7 @@ class CommandCSUnban : public Command User *u2 = source.GetUser(); if (params.size() > 1) - u2 = finduser(params[1]); + u2 = User::Find(params[1], true); if (!u2) { @@ -55,7 +55,7 @@ class CommandCSUnban : public Command Log(LOG_COMMAND, source, this, ci) << "to unban " << u2->nick; - common_unban(ci, u2, source.GetUser() == u2); + ci->c->Unban(u2, source.GetUser() == u2); if (u2 == source.GetUser()) source.Reply(_("You have been unbanned from \002%s\002."), ci->c->name.c_str()); else diff --git a/modules/commands/cs_updown.cpp b/modules/commands/cs_updown.cpp index 4d84ff5f5..6d46c873e 100644 --- a/modules/commands/cs_updown.cpp +++ b/modules/commands/cs_updown.cpp @@ -32,19 +32,19 @@ class CommandCSUp : public Command for (UChannelList::iterator it = u->chans.begin(); it != u->chans.end(); ++it) { Channel *c = (*it)->chan; - chan_set_correct_modes(u, c, 1, false); + c->SetCorrectModes(u, true, false); } else { const Anope::string &channel = params[0]; - Channel *c = findchan(params[0]); + Channel *c = Channel::Find(params[0]); if (c == NULL) source.Reply(CHAN_X_NOT_IN_USE, channel.c_str()); else if (!c->ci) source.Reply(CHAN_X_NOT_REGISTERED, channel.c_str()); else - chan_set_correct_modes(u, c, 1, false); + c->SetCorrectModes(u, true, false); } } @@ -67,7 +67,7 @@ class CommandCSDown : public Command { ChannelMode *cm = ModeManager::ChannelModes[i]; - if (cm != NULL && cm->Type == MODE_STATUS) + if (cm != NULL && cm->type == MODE_STATUS) c->RemoveMode(NULL, cm, u->nick); } } @@ -94,7 +94,7 @@ class CommandCSDown : public Command else { const Anope::string &channel = params[0]; - Channel *c = findchan(params[0]); + Channel *c = Channel::Find(params[0]); 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 1fc3cbdf0..77f6cb5a0 100644 --- a/modules/commands/cs_xop.cpp +++ b/modules/commands/cs_xop.cpp @@ -118,7 +118,7 @@ class XOPChanAccess : public ChanAccess return false; } - Anope::string Serialize() const + Anope::string AccessSerialize() const { for (int i = 0; xopAccess[i].type != XOP_UNKNOWN; ++i) { @@ -131,7 +131,7 @@ class XOPChanAccess : public ChanAccess return ""; } - void Unserialize(const Anope::string &data) anope_override + void AccessUnserialize(const Anope::string &data) anope_override { for (int i = 0; xopAccess[i].type != XOP_UNKNOWN; ++i) { @@ -210,7 +210,7 @@ class XOPBase : public Command return; } - if (readonly) + if (Anope::ReadOnly) { source.Reply(_("Sorry, channel %s list modification is temporarily disabled."), source.command.c_str()); return; @@ -224,7 +224,7 @@ class XOPBase : public Command const ChanAccess *highest = access.Highest(); bool override = false; - if ((!access.Founder && !access.HasPriv("ACCESS_CHANGE")) || ((!highest || *highest <= tmp_access) && !access.Founder)) + if ((!access.founder && !access.HasPriv("ACCESS_CHANGE")) || ((!highest || *highest <= tmp_access) && !access.founder)) { if (source.HasPriv("chanserv/access/modify")) override = true; @@ -235,9 +235,9 @@ class XOPBase : public Command } } - if (mask.find_first_of("!*@") == Anope::string::npos && !findnick(mask)) + if (mask.find_first_of("!*@") == Anope::string::npos && !NickAlias::Find(mask)) { - User *targ = finduser(mask); + User *targ = User::Find(mask, true); if (targ != NULL) mask = "*!*@" + targ->GetDisplayedHost(); else @@ -253,7 +253,7 @@ class XOPBase : public Command if (a->mask.equals_ci(mask)) { - if ((!highest || *a >= *highest) && !access.Founder && !source.HasPriv("chanserv/access/modify")) + if ((!highest || *a >= *highest) && !access.founder && !source.HasPriv("chanserv/access/modify")) { source.Reply(ACCESS_DENIED); return; @@ -270,7 +270,7 @@ class XOPBase : public Command return; } - service_reference<AccessProvider> provider("AccessProvider", "access/xop"); + ServiceReference<AccessProvider> provider("AccessProvider", "access/xop"); if (!provider) return; XOPChanAccess *acc = anope_dynamic_static_cast<XOPChanAccess *>(provider->Create()); @@ -299,7 +299,7 @@ class XOPBase : public Command return; } - if (readonly) + if (Anope::ReadOnly) { source.Reply(_("Sorry, channel %s list modification is temporarily disabled."), source.command.c_str()); return; @@ -319,9 +319,9 @@ class XOPBase : public Command const ChanAccess *highest = access.Highest(); bool override = false; - if (mask.find_first_of("!*@") == Anope::string::npos && !findnick(mask)) + if (mask.find_first_of("!*@") == Anope::string::npos && !NickAlias::Find(mask)) { - User *targ = finduser(mask); + User *targ = User::Find(mask, true); if (targ != NULL) mask = "*!*@" + targ->GetDisplayedHost(); else @@ -331,7 +331,7 @@ class XOPBase : public Command } } - if ((!mask.equals_ci(nc->display) && !access.HasPriv("ACCESS_CHANGE") && !access.Founder) || ((!highest || tmp_access >= *highest) && !access.Founder)) + if ((!mask.equals_ci(nc->display) && !access.HasPriv("ACCESS_CHANGE") && !access.founder) || ((!highest || tmp_access >= *highest) && !access.founder)) { if (source.HasPriv("chanserv/access/modify")) override = true; @@ -350,49 +350,49 @@ class XOPBase : public Command CommandSource &source; ChannelInfo *ci; Command *c; - unsigned Deleted; - Anope::string Nicks; + unsigned deleted; + Anope::string nicks; bool override; XOPType type; public: - XOPDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, bool _override, XOPType _type, const Anope::string &numlist) : NumberList(numlist, true), source(_source), ci(_ci), c(_c), Deleted(0), override(_override), type(_type) + XOPDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, bool _override, XOPType _type, const Anope::string &numlist) : NumberList(numlist, true), source(_source), ci(_ci), c(_c), deleted(0), override(_override), type(_type) { } ~XOPDelCallback() { - if (!Deleted) + if (!deleted) source.Reply(_("No matching entries on %s %s list."), ci->name.c_str(), source.command.c_str()); else { - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, c, ci) << "to delete " << Nicks; + Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, c, ci) << "to delete " << nicks; - if (Deleted == 1) + if (deleted == 1) source.Reply(_("Deleted one entry from %s %s list."), ci->name.c_str(), source.command.c_str()); else - source.Reply(_("Deleted %d entries from %s %s list."), Deleted, ci->name.c_str(), source.command.c_str()); + source.Reply(_("Deleted %d entries from %s %s list."), deleted, ci->name.c_str(), source.command.c_str()); } } - void HandleNumber(unsigned Number) anope_override + void HandleNumber(unsigned number) anope_override { - if (!Number || Number > ci->GetAccessCount()) + if (!number || number > ci->GetAccessCount()) return; - ChanAccess *caccess = ci->GetAccess(Number - 1); + ChanAccess *caccess = ci->GetAccess(number - 1); if (this->type != XOPChanAccess::DetermineLevel(caccess)) return; - ++Deleted; - if (!Nicks.empty()) - Nicks += ", " + caccess->mask; + ++deleted; + if (!nicks.empty()) + nicks += ", " + caccess->mask; else - Nicks = caccess->mask; + nicks = caccess->mask; FOREACH_MOD(I_OnAccessDel, OnAccessDel(ci, source, caccess)); - ci->EraseAccess(Number - 1); + ci->EraseAccess(number - 1); } } delcallback(source, ci, this, override, level, mask); @@ -441,7 +441,7 @@ class XOPBase : public Command } ListFormatter list; - list.addColumn("Number").addColumn("Mask"); + list.AddColumn("Number").AddColumn("Mask"); if (!nick.empty() && nick.find_first_not_of("1234567890,-") == Anope::string::npos) { @@ -468,7 +468,7 @@ class XOPBase : public Command ListFormatter::ListEntry entry; entry["Number"] = stringify(Number); entry["Mask"] = a->mask; - this->list.addEntry(entry); + this->list.AddEntry(entry); } } nl_list(list, ci, nick, level); nl_list.Process(); @@ -487,11 +487,11 @@ class XOPBase : public Command ListFormatter::ListEntry entry; entry["Number"] = stringify(i + 1); entry["Mask"] = a->mask; - list.addEntry(entry); + list.AddEntry(entry); } } - if (list.isEmpty()) + if (list.IsEmpty()) source.Reply(_("No matching entries on %s access list."), ci->name.c_str()); else { @@ -507,7 +507,7 @@ class XOPBase : public Command void DoClear(CommandSource &source, ChannelInfo *ci, XOPType level) { - if (readonly) + if (Anope::ReadOnly) { source.Reply(_("Sorry, channel %s list modification is temporarily disabled."), source.command.c_str()); return; @@ -545,7 +545,7 @@ class XOPBase : public Command protected: void DoXop(CommandSource &source, const std::vector<Anope::string> ¶ms, XOPType level) { - ChannelInfo *ci = cs_findchan(params[0]); + ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) { source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); diff --git a/modules/commands/gl_global.cpp b/modules/commands/gl_global.cpp index 09d44f9a0..2be0164e3 100644 --- a/modules/commands/gl_global.cpp +++ b/modules/commands/gl_global.cpp @@ -27,12 +27,12 @@ class CommandGLGlobal : public Command { const Anope::string &msg = params[0]; - if (!global) + if (!GlobalService) source.Reply("No global reference, is gl_main loaded?"); else { Log(LOG_ADMIN, source, this); - global->SendGlobal(findbot(Config->Global), source.GetNick(), msg); + GlobalService->SendGlobal(Global, source.GetNick(), msg); } } diff --git a/modules/commands/help.cpp b/modules/commands/help.cpp index de80a6ec1..252406590 100644 --- a/modules/commands/help.cpp +++ b/modules/commands/help.cpp @@ -41,11 +41,12 @@ class CommandHelp : public Command const CommandInfo &info = it->second; // Smaller command exists - Anope::string cmd = myStrGetToken(c_name, ' ', 0); + Anope::string cmd; + spacesepstream(c_name).GetToken(cmd, 0); if (cmd != it->first && map.count(cmd)) continue; - service_reference<Command> c("Command", info.name); + ServiceReference<Command> c("Command", info.name); if (!c) continue; else if (!Config->HidePrivilegedCommands) @@ -76,7 +77,7 @@ class CommandHelp : public Command const CommandInfo &info = it->second; - service_reference<Command> c("Command", info.name); + ServiceReference<Command> c("Command", info.name); if (!c) continue; else if (!Config->HidePrivilegedCommands) diff --git a/modules/commands/hs_del.cpp b/modules/commands/hs_del.cpp index 9ad39a95d..4e2cdc8b7 100644 --- a/modules/commands/hs_del.cpp +++ b/modules/commands/hs_del.cpp @@ -25,7 +25,7 @@ class CommandHSDel : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { const Anope::string &nick = params[0]; - NickAlias *na = findnick(nick); + NickAlias *na = NickAlias::Find(nick); if (na) { Log(LOG_ADMIN, source, this) << "for user " << na->nick; @@ -59,12 +59,12 @@ class CommandHSDelAll : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { const Anope::string &nick = params[0]; - NickAlias *na = findnick(nick); + NickAlias *na = NickAlias::Find(nick); if (na) { FOREACH_MOD(I_OnDeleteVhost, OnDeleteVhost(na)); const NickCore *nc = na->nc; - for (std::list<serialize_obj<NickAlias> >::const_iterator it = nc->aliases.begin(), it_end = nc->aliases.end(); it != it_end; ++it) + for (std::list<Serialize::Reference<NickAlias> >::const_iterator it = nc->aliases.begin(), it_end = nc->aliases.end(); it != it_end; ++it) { na = *it; na->RemoveVhost(); diff --git a/modules/commands/hs_group.cpp b/modules/commands/hs_group.cpp index 22538ed1a..5d8bc069e 100644 --- a/modules/commands/hs_group.cpp +++ b/modules/commands/hs_group.cpp @@ -20,7 +20,7 @@ class CommandHSGroup : public Command if (!na || !na->HasVhost()) return; - for (std::list<serialize_obj<NickAlias> >::const_iterator it = na->nc->aliases.begin(), it_end = na->nc->aliases.end(); it != it_end;) + for (std::list<Serialize::Reference<NickAlias> >::const_iterator it = na->nc->aliases.begin(), it_end = na->nc->aliases.end(); it != it_end;) { NickAlias *nick = *it++; if (nick) @@ -37,7 +37,7 @@ class CommandHSGroup : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - NickAlias *na = findnick(source.GetNick()); + NickAlias *na = NickAlias::Find(source.GetNick()); if (na && source.GetAccount() == na->nc && na->HasVhost()) { this->Sync(na); diff --git a/modules/commands/hs_list.cpp b/modules/commands/hs_list.cpp index 9e708f0b4..29fa145b3 100644 --- a/modules/commands/hs_list.cpp +++ b/modules/commands/hs_list.cpp @@ -57,7 +57,7 @@ class CommandHSList : public Command unsigned display_counter = 0; ListFormatter list; - list.addColumn("Number").addColumn("Nick").addColumn("Vhost").addColumn("Creator").addColumn("Created"); + 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) { @@ -80,8 +80,8 @@ class CommandHSList : public Command else entry["Vhost"] = na->GetVhostHost(); entry["Creator"] = na->GetVhostCreator(); - entry["Created"] = do_strftime(na->GetVhostCreated()); - list.addEntry(entry); + entry["Created"] = Anope::strftime(na->GetVhostCreated()); + list.AddEntry(entry); } } else @@ -101,8 +101,8 @@ class CommandHSList : public Command else entry["Vhost"] = na->GetVhostHost(); entry["Creator"] = na->GetVhostCreator(); - entry["Created"] = do_strftime(na->GetVhostCreated()); - list.addEntry(entry); + entry["Created"] = Anope::strftime(na->GetVhostCreated()); + list.AddEntry(entry); } } ++counter; diff --git a/modules/commands/hs_off.cpp b/modules/commands/hs_off.cpp index 39b701fed..27c6c0756 100644 --- a/modules/commands/hs_off.cpp +++ b/modules/commands/hs_off.cpp @@ -28,13 +28,13 @@ class CommandHSOff : public Command if (!u) return; - const NickAlias *na = findnick(u->nick); + const NickAlias *na = NickAlias::Find(u->nick); if (!na || !na->HasVhost()) source.Reply(HOST_NOT_ASSIGNED); else { - ircdproto->SendVhostDel(u); + IRCD->SendVhostDel(u); Log(LOG_COMMAND, source, this) << "to disable their vhost"; source.Reply(_("Your vhost was removed and the normal cloaking restored.")); } diff --git a/modules/commands/hs_on.cpp b/modules/commands/hs_on.cpp index d02dd7dfe..c4cf2fee8 100644 --- a/modules/commands/hs_on.cpp +++ b/modules/commands/hs_on.cpp @@ -27,10 +27,10 @@ class CommandHSOn : public Command User *u = source.GetUser(); if (!u) return; - else if (!ircdproto->CanSetVHost) + else if (!IRCD->CanSetVHost) return; // HostServ wouldn't even be loaded at this point - const NickAlias *na = findnick(u->nick); + const NickAlias *na = NickAlias::Find(u->nick); if (na && u->Account() == na->nc && na->HasVhost()) { if (!na->GetVhostIdent().empty()) @@ -38,9 +38,9 @@ class CommandHSOn : public Command else source.Reply(_("Your vhost of \002%s\002 is now activated."), na->GetVhostHost().c_str()); Log(LOG_COMMAND, source, this) << "to enable their vhost of " << (!na->GetVhostIdent().empty() ? na->GetVhostIdent() + "@" : "") << na->GetVhostHost(); - ircdproto->SendVhost(u, na->GetVhostIdent(), na->GetVhostHost()); + IRCD->SendVhost(u, na->GetVhostIdent(), na->GetVhostHost()); u->vhost = na->GetVhostHost(); - if (ircdproto->CanSetVIdent && !na->GetVhostIdent().empty()) + if (IRCD->CanSetVIdent && !na->GetVhostIdent().empty()) u->SetVIdent(na->GetVhostIdent()); u->UpdateHost(); } diff --git a/modules/commands/hs_request.cpp b/modules/commands/hs_request.cpp index 8a9de386b..b11059f90 100644 --- a/modules/commands/hs_request.cpp +++ b/modules/commands/hs_request.cpp @@ -32,21 +32,21 @@ struct HostRequest : ExtensibleItem, Serializable HostRequest() : Serializable("HostRequest") { } - Serialize::Data serialize() const anope_override + Serialize::Data Serialize() const anope_override { Serialize::Data data; data["nick"] << this->nick; data["ident"] << this->ident; data["host"] << this->host; - data["time"].setType(Serialize::DT_INT) << this->time; + data["time"].SetType(Serialize::DT_INT) << this->time; return data; } - static Serializable* unserialize(Serializable *obj, Serialize::Data &data) + static Serializable* Unserialize(Serializable *obj, Serialize::Data &data) { - NickAlias *na = findnick(data["nick"].astr()); + NickAlias *na = NickAlias::Find(data["nick"].astr()); if (na == NULL) return NULL; @@ -85,7 +85,7 @@ class CommandHSRequest : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { User *u = source.GetUser(); - NickAlias *na = findnick(source.GetNick()); + NickAlias *na = NickAlias::Find(source.GetNick()); if (!na || na->nc != source.GetAccount()) { source.Reply(ACCESS_DENIED); @@ -118,7 +118,7 @@ class CommandHSRequest : public Command source.Reply(HOST_SET_IDENTTOOLONG, Config->UserLen); return; } - else if (!ircdproto->CanSetVIdent) + else if (!IRCD->CanSetVIdent) { source.Reply(HOST_NO_VIDENT); return; @@ -137,7 +137,7 @@ class CommandHSRequest : public Command return; } - if (!IsValidHost(host)) + if (!IRCD->IsHostValid(host)) { source.Reply(HOST_SET_ERROR); return; @@ -190,15 +190,15 @@ class CommandHSActivate : public Command const Anope::string &nick = params[0]; - NickAlias *na = findnick(nick); + NickAlias *na = NickAlias::Find(nick); HostRequest *req = na ? na->GetExt<HostRequest *>("hs_request") : NULL; if (req) { na->SetVhost(req->ident, req->host, source.GetNick(), req->time); FOREACH_MOD(I_OnSetVhost, OnSetVhost(na)); - if (HSRequestMemoUser && memoserv) - memoserv->Send(Config->HostServ, na->nick, _("[auto memo] Your requested vHost has been approved."), true); + if (HSRequestMemoUser && MemoServService) + MemoServService->Send(Config->HostServ, na->nick, _("[auto memo] Your requested vHost has been approved."), true); source.Reply(_("vHost for %s has been activated"), na->nick.c_str()); Log(LOG_COMMAND, source, this) << "for " << na->nick << " for vhost " << (!req->ident.empty() ? req->ident + "@" : "") << req->host; @@ -234,13 +234,13 @@ class CommandHSReject : public Command const Anope::string &nick = params[0]; const Anope::string &reason = params.size() > 1 ? params[1] : ""; - NickAlias *na = findnick(nick); + NickAlias *na = NickAlias::Find(nick); HostRequest *req = na ? na->GetExt<HostRequest *>("hs_request") : NULL; if (req) { na->Shrink("hs_request"); - if (HSRequestMemoUser && memoserv) + if (HSRequestMemoUser && MemoServService) { Anope::string message; if (!reason.empty()) @@ -248,7 +248,7 @@ class CommandHSReject : public Command else message = _("[auto memo] Your requested vHost has been rejected."); - memoserv->Send(Config->HostServ, nick, message, true); + MemoServService->Send(Config->HostServ, nick, message, true); } source.Reply(_("vHost for %s has been rejected"), nick.c_str()); @@ -281,7 +281,7 @@ class CommandHSWaiting : public Command unsigned display_counter = 0; ListFormatter list; - list.addColumn("Number").addColumn("Nick").addColumn("Vhost").addColumn("Created"); + 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) { @@ -301,8 +301,8 @@ class CommandHSWaiting : public Command entry["Vhost"] = hr->ident + "@" + hr->host; else entry["Vhost"] = hr->host; - entry["Created"] = do_strftime(hr->time); - list.addEntry(entry); + entry["Created"] = Anope::strftime(hr->time); + list.AddEntry(entry); } ++counter; } @@ -339,7 +339,7 @@ class CommandHSWaiting : public Command class HSRequest : public Module { - SerializeType request_type; + Serialize::Type request_type; CommandHSRequest commandhsrequest; CommandHSActivate commandhsactive; CommandHSReject commandhsreject; @@ -347,11 +347,11 @@ class HSRequest : public Module public: HSRequest(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), - request_type("HostRequest", HostRequest::unserialize), commandhsrequest(this), commandhsactive(this), commandhsreject(this), commandhswaiting(this) + request_type("HostRequest", HostRequest::Unserialize), commandhsrequest(this), commandhsactive(this), commandhsreject(this), commandhswaiting(this) { this->SetAuthor("Anope"); - if (!ircdproto || !ircdproto->CanSetVHost) + if (!IRCD || !IRCD->CanSetVHost) throw ModuleException("Your IRCd does not support vhosts"); Implementation i[] = { I_OnReload }; @@ -389,18 +389,18 @@ void req_send_memos(CommandSource &source, const Anope::string &vIdent, const An else host = vHost; - if (HSRequestMemoOper == 1 && memoserv) + if (HSRequestMemoOper == 1 && MemoServService) for (unsigned i = 0; i < Config->Opers.size(); ++i) { Oper *o = Config->Opers[i]; - const NickAlias *na = findnick(o->name); + const NickAlias *na = NickAlias::Find(o->name); if (!na) continue; Anope::string message = Anope::printf(_("[auto memo] vHost \002%s\002 has been requested by %s."), host.c_str(), source.GetNick().c_str()); - memoserv->Send(Config->HostServ, na->nick, message, true); + MemoServService->Send(Config->HostServ, na->nick, message, true); } } diff --git a/modules/commands/hs_set.cpp b/modules/commands/hs_set.cpp index 2189f2483..bb4091da4 100644 --- a/modules/commands/hs_set.cpp +++ b/modules/commands/hs_set.cpp @@ -27,7 +27,7 @@ class CommandHSSet : public Command const Anope::string &nick = params[0]; - NickAlias *na = findnick(nick); + NickAlias *na = NickAlias::Find(nick); if (na == NULL) { source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); @@ -55,12 +55,12 @@ class CommandHSSet : public Command if (!user.empty()) { - if (!ircdproto->CanSetVIdent) + if (!IRCD->CanSetVIdent) { source.Reply(HOST_NO_VIDENT); return; } - else if (!IsValidIdent(user)) + else if (!IRCD->IsIdentValid(user)) { source.Reply(HOST_SET_IDENT_ERROR); return; @@ -73,7 +73,7 @@ class CommandHSSet : public Command return; } - if (!IsValidHost(host)) + if (!IRCD->IsHostValid(host)) { source.Reply(HOST_SET_ERROR); return; @@ -108,7 +108,7 @@ class CommandHSSetAll : public Command if (!na || !na->HasVhost()) return; - for (std::list<serialize_obj<NickAlias> >::const_iterator it = na->nc->aliases.begin(), it_end = na->nc->aliases.end(); it != it_end;) + for (std::list<Serialize::Reference<NickAlias> >::const_iterator it = na->nc->aliases.begin(), it_end = na->nc->aliases.end(); it != it_end;) { NickAlias *nick = *it++; if (nick) @@ -128,7 +128,7 @@ class CommandHSSetAll : public Command Anope::string nick = params[0]; - NickAlias *na = findnick(nick); + NickAlias *na = NickAlias::Find(nick); if (na == NULL) { source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); @@ -156,12 +156,12 @@ class CommandHSSetAll : public Command if (!user.empty()) { - if (!ircdproto->CanSetVIdent) + if (!IRCD->CanSetVIdent) { source.Reply(HOST_NO_VIDENT); return; } - else if (!IsValidIdent(user)) + else if (!IRCD->IsIdentValid(user)) { source.Reply(HOST_SET_IDENT_ERROR); return; @@ -174,7 +174,7 @@ class CommandHSSetAll : public Command return; } - if (!IsValidHost(host)) + if (!IRCD->IsHostValid(host)) { source.Reply(HOST_SET_ERROR); return; diff --git a/modules/commands/ms_cancel.cpp b/modules/commands/ms_cancel.cpp index e4ee9375e..8949baf17 100644 --- a/modules/commands/ms_cancel.cpp +++ b/modules/commands/ms_cancel.cpp @@ -25,14 +25,14 @@ class CommandMSCancel : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - if (!memoserv) + if (!MemoServService) return; const Anope::string &nname = params[0]; bool ischan; - MemoInfo *mi = memoserv->GetMemoInfo(nname, ischan); + MemoInfo *mi = MemoServService->GetMemoInfo(nname, ischan); if (mi == NULL) source.Reply(ischan ? CHAN_X_NOT_REGISTERED : _(NICK_X_NOT_REGISTERED), nname.c_str()); @@ -41,9 +41,9 @@ class CommandMSCancel : public Command ChannelInfo *ci = NULL; NickAlias *na = NULL; if (ischan) - ci = cs_findchan(nname); + ci = ChannelInfo::Find(nname); else - na = findnick(nname); + na = NickAlias::Find(nname); for (int i = mi->memos->size() - 1; i >= 0; --i) if (mi->GetMemo(i)->HasFlag(MF_UNREAD) && source.nc->display.equals_ci(mi->GetMemo(i)->sender)) { @@ -81,7 +81,7 @@ class MSCancel : public Module { this->SetAuthor("Anope"); - if (!memoserv) + if (!MemoServService) throw ModuleException("No MemoServ!"); } }; diff --git a/modules/commands/ms_check.cpp b/modules/commands/ms_check.cpp index 59340b6d7..8f34e7b9a 100644 --- a/modules/commands/ms_check.cpp +++ b/modules/commands/ms_check.cpp @@ -29,7 +29,7 @@ class CommandMSCheck : public Command bool found = false; - const NickAlias *na = findnick(recipient); + const NickAlias *na = NickAlias::Find(recipient); if (!na) { source.Reply(NICK_X_NOT_REGISTERED, recipient.c_str()); @@ -48,9 +48,9 @@ class CommandMSCheck : public Command found = true; /* Yes, we've found the memo */ if (mi->GetMemo(i)->HasFlag(MF_UNREAD)) - source.Reply(_("The last memo you sent to %s (sent on %s) has not yet been read."), na->nick.c_str(), do_strftime(mi->GetMemo(i)->time).c_str()); + source.Reply(_("The last memo you sent to %s (sent on %s) has not yet been read."), na->nick.c_str(), Anope::strftime(mi->GetMemo(i)->time).c_str()); else - source.Reply(_("The last memo you sent to %s (sent on %s) has been read."), na->nick.c_str(), do_strftime(mi->GetMemo(i)->time).c_str()); + source.Reply(_("The last memo you sent to %s (sent on %s) has been read."), na->nick.c_str(), Anope::strftime(mi->GetMemo(i)->time).c_str()); break; } } diff --git a/modules/commands/ms_del.cpp b/modules/commands/ms_del.cpp index 330f45e87..99b388e52 100644 --- a/modules/commands/ms_del.cpp +++ b/modules/commands/ms_del.cpp @@ -23,18 +23,18 @@ class MemoDelCallback : public NumberList { } - void HandleNumber(unsigned Number) anope_override + void HandleNumber(unsigned number) anope_override { - if (!Number || Number > mi->memos->size()) + if (!number || number > mi->memos->size()) return; if (ci) - FOREACH_MOD(I_OnMemoDel, OnMemoDel(ci, mi, mi->GetMemo(Number - 1))); + FOREACH_MOD(I_OnMemoDel, OnMemoDel(ci, mi, mi->GetMemo(number - 1))); else - FOREACH_MOD(I_OnMemoDel, OnMemoDel(source.nc, mi, mi->GetMemo(Number - 1))); + FOREACH_MOD(I_OnMemoDel, OnMemoDel(source.nc, mi, mi->GetMemo(number - 1))); - mi->Del(Number - 1); - source.Reply(_("Memo %d has been deleted."), Number); + mi->Del(number - 1); + source.Reply(_("Memo %d has been deleted."), number); } }; @@ -59,13 +59,13 @@ class CommandMSDel : public Command chan = numstr; numstr = params.size() > 1 ? params[1] : ""; - ci = cs_findchan(chan); + ci = ChannelInfo::Find(chan); if (!ci) { source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str()); return; } - else if (readonly) + else if (Anope::ReadOnly) { source.Reply(READ_ONLY_MODE); return; @@ -114,7 +114,7 @@ class CommandMSDel : public Command FOREACH_MOD(I_OnMemoDel, OnMemoDel(ci, mi, mi->GetMemo(i))); else FOREACH_MOD(I_OnMemoDel, OnMemoDel(source.nc, mi, mi->GetMemo(i))); - mi->GetMemo(i)->destroy(); + mi->GetMemo(i)->Destroy(); } mi->memos->clear(); if (!chan.empty()) diff --git a/modules/commands/ms_ignore.cpp b/modules/commands/ms_ignore.cpp index 84ce540a8..465714852 100644 --- a/modules/commands/ms_ignore.cpp +++ b/modules/commands/ms_ignore.cpp @@ -26,7 +26,7 @@ class CommandMSIgnore : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - if (!memoserv) + if (!MemoServService) return; @@ -42,8 +42,8 @@ class CommandMSIgnore : public Command } bool ischan; - MemoInfo *mi = memoserv->GetMemoInfo(channel, ischan); - ChannelInfo *ci = cs_findchan(channel); + MemoInfo *mi = MemoServService->GetMemoInfo(channel, ischan); + ChannelInfo *ci = ChannelInfo::Find(channel); if (!mi) source.Reply(ischan ? CHAN_X_NOT_REGISTERED : _(NICK_X_NOT_REGISTERED), channel.c_str()); else if (ischan && !source.AccessFor(ci).HasPriv("MEMO")) @@ -77,12 +77,12 @@ class CommandMSIgnore : public Command else { ListFormatter list; - list.addColumn("Mask"); + list.AddColumn("Mask"); for (unsigned i = 0; i < mi->ignores.size(); ++i) { ListFormatter::ListEntry entry; entry["Mask"] = mi->ignores[i]; - list.addEntry(entry); + list.AddEntry(entry); } source.Reply(_("Ignore list:")); @@ -120,7 +120,7 @@ class MSIgnore : public Module { this->SetAuthor("Anope"); - if (!memoserv) + if (!MemoServService) throw ModuleException("No MemoServ!"); } }; diff --git a/modules/commands/ms_info.cpp b/modules/commands/ms_info.cpp index d2c7eea3b..b209d0bf4 100644 --- a/modules/commands/ms_info.cpp +++ b/modules/commands/ms_info.cpp @@ -33,7 +33,7 @@ class CommandMSInfo : public Command if (!nname.empty() && nname[0] != '#' && source.HasPriv("memoserv/info")) { - na = findnick(nname); + na = NickAlias::Find(nname); if (!na) { source.Reply(NICK_X_NOT_REGISTERED, nname.c_str()); @@ -44,7 +44,7 @@ class CommandMSInfo : public Command } else if (!nname.empty() && nname[0] == '#') { - ci = cs_findchan(nname); + ci = ChannelInfo::Find(nname); if (!ci) { source.Reply(CHAN_X_NOT_REGISTERED, nname.c_str()); diff --git a/modules/commands/ms_list.cpp b/modules/commands/ms_list.cpp index f6a92e9df..91196cfee 100644 --- a/modules/commands/ms_list.cpp +++ b/modules/commands/ms_list.cpp @@ -34,7 +34,7 @@ class CommandMSList : public Command chan = param; param = params.size() > 1 ? params[1] : ""; - ci = cs_findchan(chan); + ci = ChannelInfo::Find(chan); if (!ci) { source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str()); @@ -63,7 +63,7 @@ class CommandMSList : public Command { ListFormatter list; - list.addColumn("Number").addColumn("Sender").addColumn("Date/Time"); + list.AddColumn("Number").AddColumn("Sender").AddColumn("Date/Time"); if (!param.empty() && isdigit(param[0])) { @@ -77,18 +77,18 @@ class CommandMSList : public Command { } - void HandleNumber(unsigned Number) anope_override + void HandleNumber(unsigned number) anope_override { - if (!Number || Number > mi->memos->size()) + if (!number || number > mi->memos->size()) return; - const Memo *m = mi->GetMemo(Number); + const Memo *m = mi->GetMemo(number); ListFormatter::ListEntry entry; - entry["Number"] = (m->HasFlag(MF_UNREAD) ? "* " : " ") + stringify(Number + 1); + entry["Number"] = (m->HasFlag(MF_UNREAD) ? "* " : " ") + stringify(number + 1); entry["Sender"] = m->sender; - entry["Date/Time"] = do_strftime(m->time); - this->list.addEntry(entry); + entry["Date/Time"] = Anope::strftime(m->time); + this->list.AddEntry(entry); } } mlc(list, source, mi, param); @@ -122,8 +122,8 @@ class CommandMSList : public Command ListFormatter::ListEntry entry; entry["Number"] = (m->HasFlag(MF_UNREAD) ? "* " : " ") + stringify(i + 1); entry["Sender"] = m->sender; - entry["Date/Time"] = do_strftime(m->time); - list.addEntry(entry); + entry["Date/Time"] = Anope::strftime(m->time); + list.AddEntry(entry); } } diff --git a/modules/commands/ms_read.cpp b/modules/commands/ms_read.cpp index 5b46ef0dd..6d5adfb05 100644 --- a/modules/commands/ms_read.cpp +++ b/modules/commands/ms_read.cpp @@ -17,10 +17,10 @@ static void rsend_notify(CommandSource &source, MemoInfo *mi, Memo *m, const Anope::string &targ) { /* Only send receipt if memos are allowed */ - if (memoserv && !readonly) + if (MemoServService && !Anope::ReadOnly) { /* Get nick alias for sender */ - const NickAlias *na = findnick(m->sender); + const NickAlias *na = NickAlias::Find(m->sender); if (!na) return; @@ -33,10 +33,10 @@ static void rsend_notify(CommandSource &source, MemoInfo *mi, Memo *m, const Ano /* Text of the memo varies if the recepient was a nick or channel */ - Anope::string text = Anope::printf(translate(na->nc, _("\002[auto-memo]\002 The memo you sent to %s has been viewed.")), targ.c_str()); + Anope::string text = Anope::printf(Language::Translate(na->nc, _("\002[auto-memo]\002 The memo you sent to %s has been viewed.")), targ.c_str()); /* Send notification */ - memoserv->Send(source.GetNick(), m->sender, text, true); + MemoServService->Send(source.GetNick(), m->sender, text, true); /* Notify recepient of the memo that a notification has been sent to the sender */ @@ -58,21 +58,21 @@ class MemoListCallback : public NumberList { } - void HandleNumber(unsigned Number) anope_override + void HandleNumber(unsigned number) anope_override { - if (!Number || Number > mi->memos->size()) + if (!number || number > mi->memos->size()) return; - MemoListCallback::DoRead(source, mi, ci, Number - 1); + MemoListCallback::DoRead(source, mi, ci, number - 1); } static void DoRead(CommandSource &source, MemoInfo *mi, const ChannelInfo *ci, unsigned index) { Memo *m = mi->GetMemo(index); if (ci) - source.Reply(_("Memo %d from %s (%s). To delete, type: \002%s%s DEL %s %d\002"), index + 1, m->sender.c_str(), do_strftime(m->time).c_str(), Config->UseStrictPrivMsgString.c_str(), Config->MemoServ.c_str(), ci->name.c_str(), index + 1); + source.Reply(_("Memo %d from %s (%s). To delete, type: \002%s%s DEL %s %d\002"), index + 1, m->sender.c_str(), Anope::strftime(m->time).c_str(), Config->UseStrictPrivMsgString.c_str(), Config->MemoServ.c_str(), ci->name.c_str(), index + 1); else - source.Reply(_("Memo %d from %s (%s). To delete, type: \002%s%s DEL %d\002"), index + 1, m->sender.c_str(), do_strftime(m->time).c_str(), Config->UseStrictPrivMsgString.c_str(), Config->MemoServ.c_str(), index + 1); + source.Reply(_("Memo %d from %s (%s). To delete, type: \002%s%s DEL %d\002"), index + 1, m->sender.c_str(), Anope::strftime(m->time).c_str(), Config->UseStrictPrivMsgString.c_str(), Config->MemoServ.c_str(), index + 1); source.Reply("%s", m->text.c_str()); m->UnsetFlag(MF_UNREAD); @@ -103,7 +103,7 @@ class CommandMSRead : public Command chan = numstr; numstr = params.size() > 1 ? params[1] : ""; - ci = cs_findchan(chan); + ci = ChannelInfo::Find(chan); if (!ci) { source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str()); diff --git a/modules/commands/ms_rsend.cpp b/modules/commands/ms_rsend.cpp index 9c47b9f53..b08b9be85 100644 --- a/modules/commands/ms_rsend.cpp +++ b/modules/commands/ms_rsend.cpp @@ -25,7 +25,7 @@ class CommandMSRSend : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - if (!memoserv) + if (!MemoServService) return; @@ -34,7 +34,7 @@ class CommandMSRSend : public Command const NickAlias *na = NULL; /* prevent user from rsend to themselves */ - if ((na = findnick(nick)) && na->nc == source.GetAccount()) + if ((na = NickAlias::Find(nick)) && na->nc == source.GetAccount()) { source.Reply(_("You can not request a receipt when sending a memo to yourself.")); return; @@ -49,7 +49,7 @@ class CommandMSRSend : public Command } else { - MemoServService::MemoResult result = memoserv->Send(source.GetNick(), nick, text); + MemoServService::MemoResult result = MemoServService->Send(source.GetNick(), nick, text); if (result == MemoServService::MEMO_INVALID_TARGET) source.Reply(_("\002%s\002 is not a registered unforbidden nick or channel."), nick.c_str()); else if (result == MemoServService::MEMO_TOO_FAST) @@ -61,7 +61,7 @@ class CommandMSRSend : public Command source.Reply(_("Memo sent to \002%s\002."), name.c_str()); bool ischan; - MemoInfo *mi = memoserv->GetMemoInfo(nick, ischan); + MemoInfo *mi = MemoServService->GetMemoInfo(nick, ischan); if (mi == NULL) throw CoreException("NULL mi in ms_rsend"); Memo *m = (mi->memos->size() ? mi->GetMemo(mi->memos->size() - 1) : NULL); @@ -98,7 +98,7 @@ class MSRSend : public Module { this->SetAuthor("Anope"); - if (!memoserv) + if (!MemoServService) throw ModuleException("No MemoServ!"); else if (!Config->MSMemoReceipt) throw ModuleException("Invalid value for memoreceipt"); diff --git a/modules/commands/ms_send.cpp b/modules/commands/ms_send.cpp index a2ba53a9e..42024227e 100644 --- a/modules/commands/ms_send.cpp +++ b/modules/commands/ms_send.cpp @@ -25,13 +25,13 @@ class CommandMSSend : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - if (!memoserv) + if (!MemoServService) return; const Anope::string &nick = params[0]; const Anope::string &text = params[1]; - MemoServService::MemoResult result = memoserv->Send(source.GetNick(), nick, text); + MemoServService::MemoResult result = MemoServService->Send(source.GetNick(), nick, text); if (result == MemoServService::MEMO_SUCCESS) source.Reply(_("Memo sent to \002%s\002."), nick.c_str()); else if (result == MemoServService::MEMO_INVALID_TARGET) @@ -66,7 +66,7 @@ class MSSend : public Module { this->SetAuthor("Anope"); - if (!memoserv) + if (!MemoServService) throw ModuleException("No MemoServ!"); } }; diff --git a/modules/commands/ms_sendall.cpp b/modules/commands/ms_sendall.cpp index 2fba2ecb3..5ade6722b 100644 --- a/modules/commands/ms_sendall.cpp +++ b/modules/commands/ms_sendall.cpp @@ -25,12 +25,12 @@ class CommandMSSendAll : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - if (!memoserv) + if (!MemoServService) return; const Anope::string &text = params[0]; - if (readonly) + if (Anope::ReadOnly) { source.Reply(MEMO_SEND_DISABLED); return; @@ -41,7 +41,7 @@ class CommandMSSendAll : public Command const NickCore *nc = it->second; if (nc != source.nc) - memoserv->Send(source.GetNick(), nc->display, text); + MemoServService->Send(source.GetNick(), nc->display, text); } source.Reply(_("A massmemo has been sent to all registered users.")); @@ -67,7 +67,7 @@ class MSSendAll : public Module { this->SetAuthor("Anope"); - if (!memoserv) + if (!MemoServService) throw ModuleException("No MemoServ!"); } }; diff --git a/modules/commands/ms_set.cpp b/modules/commands/ms_set.cpp index 02ce8d32c..497dffd4c 100644 --- a/modules/commands/ms_set.cpp +++ b/modules/commands/ms_set.cpp @@ -86,7 +86,7 @@ class CommandMSSet : public Command p2 = p3; p3 = params.size() > 4 ? params[4] : ""; - ci = cs_findchan(chan); + ci = ChannelInfo::Find(chan); if (!ci) { source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str()); @@ -104,7 +104,7 @@ class CommandMSSet : public Command if (!p2.empty() && !p2.equals_ci("HARD") && chan.empty()) { const NickAlias *na; - if (!(na = findnick(p1))) + if (!(na = NickAlias::Find(p1))) { source.Reply(NICK_X_NOT_REGISTERED, p1.c_str()); return; @@ -211,7 +211,7 @@ class CommandMSSet : public Command const Anope::string &cmd = params[0]; MemoInfo *mi = const_cast<MemoInfo *>(&source.nc->memos); - if (readonly) + if (Anope::ReadOnly) source.Reply(_("Sorry, memo option setting is temporarily disabled.")); else if (cmd.equals_ci("NOTIFY")) return this->DoNotify(source, params, mi); diff --git a/modules/commands/ms_staff.cpp b/modules/commands/ms_staff.cpp index 9896d5971..a1fbdf65d 100644 --- a/modules/commands/ms_staff.cpp +++ b/modules/commands/ms_staff.cpp @@ -25,12 +25,12 @@ class CommandMSStaff : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - if (!memoserv) + if (!MemoServService) return; const Anope::string &text = params[0]; - if (readonly) + if (Anope::ReadOnly) { source.Reply(MEMO_SEND_DISABLED); return; @@ -41,7 +41,7 @@ class CommandMSStaff : public Command const NickCore *nc = it->second; if (source.nc != nc && nc->IsServicesOper()) - memoserv->Send(source.GetNick(), nc->display, text, true); + MemoServService->Send(source.GetNick(), nc->display, text, true); } return; @@ -67,7 +67,7 @@ class MSStaff : public Module { this->SetAuthor("Anope"); - if (!memoserv) + if (!MemoServService) throw ModuleException("No MemoServ!"); } }; diff --git a/modules/commands/ns_access.cpp b/modules/commands/ns_access.cpp index 915b70cb3..f77836909 100644 --- a/modules/commands/ns_access.cpp +++ b/modules/commands/ns_access.cpp @@ -108,7 +108,7 @@ class CommandNSAccess : public Command NickCore *nc; if (!nick.empty()) { - const NickAlias *na = findnick(nick); + const NickAlias *na = NickAlias::Find(nick); if (na == NULL) { source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); diff --git a/modules/commands/ns_ajoin.cpp b/modules/commands/ns_ajoin.cpp index 46f012c46..54e37ad36 100644 --- a/modules/commands/ns_ajoin.cpp +++ b/modules/commands/ns_ajoin.cpp @@ -15,20 +15,20 @@ struct AJoinEntry; -struct AJoinList : serialize_checker<std::vector<AJoinEntry *> >, ExtensibleItem +struct AJoinList : Serialize::Checker<std::vector<AJoinEntry *> >, ExtensibleItem { - AJoinList() : serialize_checker<std::vector<AJoinEntry *> >("AJoinEntry") { } + AJoinList() : Serialize::Checker<std::vector<AJoinEntry *> >("AJoinEntry") { } }; struct AJoinEntry : Serializable { - serialize_obj<NickCore> owner; + Serialize::Reference<NickCore> owner; Anope::string channel; Anope::string key; AJoinEntry() : Serializable("AJoinEntry") { } - Serialize::Data serialize() const anope_override + Serialize::Data Serialize() const anope_override { Serialize::Data sd; @@ -42,9 +42,9 @@ struct AJoinEntry : Serializable return sd; } - static Serializable* unserialize(Serializable *obj, Serialize::Data &sd) + static Serializable* Unserialize(Serializable *obj, Serialize::Data &sd) { - NickCore *nc = findcore(sd["owner"].astr()); + NickCore *nc = NickCore::Find(sd["owner"].astr()); if (nc == NULL) return NULL; @@ -91,7 +91,7 @@ class CommandNSAJoin : public Command else { ListFormatter list; - list.addColumn("Number").addColumn("Channel").addColumn("Key"); + list.AddColumn("Number").AddColumn("Channel").AddColumn("Key"); for (unsigned i = 0; i < (*channels)->size(); ++i) { AJoinEntry *aj = (*channels)->at(i); @@ -99,7 +99,7 @@ class CommandNSAJoin : public Command entry["Number"] = stringify(i + 1); entry["Channel"] = aj->channel; entry["Key"] = aj->key; - list.addEntry(entry); + list.AddEntry(entry); } source.Reply(_("%s's auto join list:"), nc->display.c_str()); @@ -130,7 +130,7 @@ class CommandNSAJoin : public Command source.Reply(_("Your auto join list is full.")); else if (i != (*channels)->size()) source.Reply(_("%s is already on %s's auto join list."), chan.c_str(), nc->display.c_str()); - else if (ircdproto->IsChannelValid(chan) == false) + else if (IRCD->IsChannelValid(chan) == false) source.Reply(CHAN_X_INVALID, chan.c_str()); else { @@ -161,7 +161,7 @@ class CommandNSAJoin : public Command source.Reply(_("%s was not found on %s's auto join list."), chan.c_str(), nc->display.c_str()); else { - (*channels)->at(i)->destroy(); + (*channels)->at(i)->Destroy(); (*channels)->erase((*channels)->begin() + i); source.Reply(_("%s was removed from %s's auto join list."), chan.c_str(), nc->display.c_str()); } @@ -179,9 +179,9 @@ class CommandNSAJoin : public Command NickCore *nc = source.GetAccount(); Anope::string param, param2; - if (params.size() > 1 && source.IsServicesOper() && ircdproto->IsNickValid(params[1])) + if (params.size() > 1 && source.IsServicesOper() && IRCD->IsNickValid(params[1])) { - NickAlias *na = findnick(params[1]); + NickAlias *na = NickAlias::Find(params[1]); if (!na) { source.Reply(NICK_X_NOT_REGISTERED, params[1].c_str()); @@ -224,12 +224,12 @@ class CommandNSAJoin : public Command class NSAJoin : public Module { - SerializeType ajoinentry_type; + Serialize::Type ajoinentry_type; CommandNSAJoin commandnsajoin; public: NSAJoin(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), - ajoinentry_type("AJoinEntry", AJoinEntry::unserialize), commandnsajoin(this) + ajoinentry_type("AJoinEntry", AJoinEntry::Unserialize), commandnsajoin(this) { this->SetAuthor("Anope"); @@ -239,6 +239,9 @@ class NSAJoin : public Module void OnNickIdentify(User *u) anope_override { + if (!NickServ) + return; + AJoinList *channels = u->Account()->GetExt<AJoinList *>("ns_ajoin_channels"); if (channels == NULL) { @@ -246,20 +249,16 @@ class NSAJoin : public Module u->Account()->Extend("ns_ajoin_channels", channels); } - const BotInfo *bi = findbot(Config->NickServ); - if (bi == NULL) - return; - for (unsigned i = 0; i < (*channels)->size(); ++i) { AJoinEntry *entry = (*channels)->at(i); - Channel *c = findchan(entry->channel); + Channel *c = Channel::Find(entry->channel); ChannelInfo *ci; if (c) ci = c->ci; else - ci = cs_findchan(entry->channel); + ci = ChannelInfo::Find(entry->channel); bool need_invite = false; Anope::string key = entry->key; @@ -279,9 +278,9 @@ class NSAJoin : public Module continue; else if (c->HasMode(CMODE_SSL) && !u->HasMode(UMODE_SSL)) continue; - else if (matches_list(c, u, CMODE_BAN) == true && matches_list(c, u, CMODE_EXCEPT) == false) + else if (c->MatchesList(u, CMODE_BAN) == true && c->MatchesList(u, CMODE_EXCEPT) == false) need_invite = true; - else if (c->HasMode(CMODE_INVITE) && matches_list(c, u, CMODE_INVITEOVERRIDE) == false) + else if (c->HasMode(CMODE_INVITE) && c->MatchesList(u, CMODE_INVITEOVERRIDE) == false) need_invite = true; if (c->HasMode(CMODE_KEY)) @@ -315,10 +314,10 @@ class NSAJoin : public Module { if (!ci->AccessFor(u).HasPriv("INVITE")) continue; - ircdproto->SendInvite(bi, c, u); + IRCD->SendInvite(NickServ, c, u); } - ircdproto->SendSVSJoin(bi, u->nick, entry->channel, key); + IRCD->SendSVSJoin(NickServ, u->nick, entry->channel, key); } } }; diff --git a/modules/commands/ns_alist.cpp b/modules/commands/ns_alist.cpp index ef018ea8b..8da1b8346 100644 --- a/modules/commands/ns_alist.cpp +++ b/modules/commands/ns_alist.cpp @@ -30,7 +30,7 @@ class CommandNSAList : public Command if (params.size() && source.IsServicesOper()) { nick = params[0]; - const NickAlias *na = findnick(nick); + const NickAlias *na = NickAlias::Find(nick); if (!na) { source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); @@ -42,7 +42,7 @@ class CommandNSAList : public Command ListFormatter list; int chan_count = 0; - list.addColumn("Number").addColumn("Channel").addColumn("Access"); + list.AddColumn("Number").AddColumn("Channel").AddColumn("Access"); source.Reply(_("Channels that \002%s\002 has access on:"), nc->display.c_str()); @@ -57,7 +57,7 @@ class CommandNSAList : public Command entry["Number"] = stringify(chan_count); entry["Channel"] = (ci->HasFlag(CI_NO_EXPIRE) ? "!" : "") + ci->name; entry["Access"] = "Founder"; - list.addEntry(entry); + list.AddEntry(entry); continue; } @@ -70,9 +70,9 @@ class CommandNSAList : public Command entry["Number"] = stringify(chan_count); entry["Channel"] = (ci->HasFlag(CI_NO_EXPIRE) ? "!" : "") + ci->name; for (unsigned i = 0; i < access.size(); ++i) - entry["Access"] = entry["Access"] + ", " + access[i]->Serialize(); + entry["Access"] = entry["Access"] + ", " + access[i]->AccessSerialize(); entry["Access"] = entry["Access"].substr(2); - list.addEntry(entry); + list.AddEntry(entry); } std::vector<Anope::string> replies; diff --git a/modules/commands/ns_cert.cpp b/modules/commands/ns_cert.cpp index a06dd1a3a..6c2100adf 100644 --- a/modules/commands/ns_cert.cpp +++ b/modules/commands/ns_cert.cpp @@ -31,14 +31,14 @@ class CommandNSCert : public Command } ListFormatter list; - list.addColumn("Certificate"); + list.AddColumn("Certificate"); for (unsigned i = 0, end = nc->cert.size(); i < end; ++i) { Anope::string fingerprint = nc->GetCert(i); ListFormatter::ListEntry entry; entry["Certificate"] = fingerprint; - list.addEntry(entry); + list.AddEntry(entry); } source.Reply(_("Certificate list for \002%s\002:"), nc->display.c_str()); @@ -121,13 +121,13 @@ class CommandNSCert : public Command } ListFormatter list; - list.addColumn("Certificate"); + list.AddColumn("Certificate"); for (unsigned i = 0, end = nc->cert.size(); i < end; ++i) { ListFormatter::ListEntry entry; entry["Certificate"] = nc->GetCert(i); - list.addEntry(entry); + list.AddEntry(entry); } source.Reply(_("Certificate list:")); @@ -152,7 +152,7 @@ class CommandNSCert : public Command const Anope::string &mask = params.size() > 1 ? params[1] : ""; const NickAlias *na; - if (cmd.equals_ci("LIST") && source.IsServicesOper() && !mask.empty() && (na = findnick(mask))) + if (cmd.equals_ci("LIST") && source.IsServicesOper() && !mask.empty() && (na = NickAlias::Find(mask))) return this->DoServAdminList(source, na->nc); NickCore *nc = source.nc; @@ -202,9 +202,8 @@ class NSCert : public Module void DoAutoIdentify(User *u) { - const BotInfo *bi = findbot(Config->NickServ); - NickAlias *na = findnick(u->nick); - if (!bi || !na) + NickAlias *na = NickAlias::Find(u->nick); + if (!NickServ || !na) return; if (u->IsIdentified() && u->Account() == na->nc) return; @@ -214,7 +213,7 @@ class NSCert : public Module return; u->Identify(na); - u->SendMessage(bi, _("SSL Fingerprint accepted. You are now identified.")); + u->SendMessage(NickServ, _("SSL Fingerprint accepted. You are now identified.")); Log(u) << "automatically identified for account " << na->nc->display << " using a valid SSL fingerprint"; return; } @@ -225,7 +224,7 @@ class NSCert : public Module { this->SetAuthor("Anope"); - if (!ircdproto || !ircdproto->CanCertFP) + if (!IRCD || !IRCD->CanCertFP) throw ModuleException("Your IRCd does not support ssl client certificates"); Implementation i[] = { I_OnFingerprint }; diff --git a/modules/commands/ns_drop.cpp b/modules/commands/ns_drop.cpp index d5ac7cef8..efd95cf1c 100644 --- a/modules/commands/ns_drop.cpp +++ b/modules/commands/ns_drop.cpp @@ -25,13 +25,13 @@ class CommandNSDrop : public Command { Anope::string nick = !params.empty() ? params[0] : ""; - if (readonly) + if (Anope::ReadOnly) { source.Reply(_("Sorry, nickname de-registration is temporarily disabled.")); return; } - NickAlias *na = findnick(!nick.empty() ? nick : source.GetNick()); + NickAlias *na = NickAlias::Find(!nick.empty() ? nick : source.GetNick()); if (!na) { source.Reply(NICK_NOT_REGISTERED); @@ -49,13 +49,13 @@ class CommandNSDrop : public Command source.Reply(_("You may not drop other services operators nicknames.")); else { - if (readonly) + if (Anope::ReadOnly) source.Reply(READ_ONLY_MODE); FOREACH_MOD(I_OnNickDrop, OnNickDrop(source, na)); Log(!is_mine ? LOG_OVERRIDE : LOG_COMMAND, source, this) << "to drop nickname " << na->nick << " (group: " << na->nc->display << ") (email: " << (!na->nc->email.empty() ? na->nc->email : "none") << ")"; - na->destroy(); + na->Destroy(); if (!is_mine) { diff --git a/modules/commands/ns_getpass.cpp b/modules/commands/ns_getpass.cpp index 2e5efdf4d..998316f5b 100644 --- a/modules/commands/ns_getpass.cpp +++ b/modules/commands/ns_getpass.cpp @@ -28,13 +28,13 @@ class CommandNSGetPass : public Command Anope::string tmp_pass; const NickAlias *na; - if (!(na = findnick(nick))) + if (!(na = NickAlias::Find(nick))) source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); else if (Config->NSSecureAdmins && na->nc->IsServicesOper()) source.Reply(_("You may not get the password of other services operators.")); else { - if (enc_decrypt(na->nc->pass, tmp_pass) == 1) + if (Anope::Decrypt(na->nc->pass, tmp_pass) == 1) { Log(LOG_ADMIN, source, this) << "for " << nick; source.Reply(_("Password for %s is \002%s\002."), nick.c_str(), tmp_pass.c_str()); @@ -68,7 +68,7 @@ class NSGetPass : public Module this->SetAuthor("Anope"); Anope::string tmp_pass = "plain:tmp"; - if (enc_decrypt(tmp_pass, tmp_pass) == -1) + if (Anope::Decrypt(tmp_pass, tmp_pass) == -1) throw ModuleException("Incompatible with the encryption module being used"); } diff --git a/modules/commands/ns_ghost.cpp b/modules/commands/ns_ghost.cpp index e7289f728..de85a941f 100644 --- a/modules/commands/ns_ghost.cpp +++ b/modules/commands/ns_ghost.cpp @@ -19,7 +19,7 @@ class NSGhostRequest : public IdentifyRequest { CommandSource source; Command *cmd; - dynamic_reference<User> u; + Reference<User> u; public: NSGhostRequest(Module *o, CommandSource &src, Command *c, User *user, const Anope::string &pass) : IdentifyRequest(o, user->nick, pass), source(src), cmd(c), u(user) { } @@ -38,7 +38,7 @@ class NSGhostRequest : public IdentifyRequest { NSGhostExtensibleInfo *ei = new NSGhostExtensibleInfo; for (UChannelList::iterator it = u->chans.begin(), it_end = u->chans.end(); it != it_end; ++it) - (*ei)[(*it)->chan->name] = *(*it)->Status; + (*ei)[(*it)->chan->name] = *(*it)->status; source.GetUser()->Extend("ns_ghost_info", ei); } @@ -50,14 +50,14 @@ class NSGhostRequest : public IdentifyRequest source.Reply(_("Ghost with your nick has been killed.")); if (Config->NSRestoreOnGhost) - ircdproto->SendForceNickChange(source.GetUser(), GetAccount(), Anope::CurTime); + IRCD->SendForceNickChange(source.GetUser(), GetAccount(), Anope::CurTime); } void OnFail() anope_override { if (!u) ; - else if (!findnick(GetAccount())) + else if (!NickAlias::Find(GetAccount())) source.Reply(NICK_X_NOT_REGISTERED, GetAccount().c_str()); else { @@ -66,7 +66,7 @@ class NSGhostRequest : public IdentifyRequest { Log(LOG_COMMAND, source, cmd) << "with an invalid password for " << GetAccount(); if (source.GetUser()) - bad_password(source.GetUser()); + source.GetUser()->BadPassword(); } } } @@ -87,8 +87,8 @@ class CommandNSGhost : public Command const Anope::string &nick = params[0]; const Anope::string &pass = params.size() > 1 ? params[1] : ""; - User *user = finduser(nick); - const NickAlias *na = findnick(nick); + User *user = User::Find(nick, true); + const NickAlias *na = NickAlias::Find(nick); if (!user) source.Reply(NICK_X_NOT_IN_USE, nick.c_str()); @@ -107,7 +107,7 @@ class CommandNSGhost : public Command bool ok = false; if (source.GetAccount() == na->nc) ok = true; - else if (!na->nc->HasFlag(NI_SECURE) && source.GetUser() && is_on_access(source.GetUser(), na->nc)) + else if (!na->nc->HasFlag(NI_SECURE) && source.GetUser() && na->nc->IsOnAccess(source.GetUser())) ok = true; else if (source.GetUser() && !source.GetUser()->fingerprint.empty() && na->nc->FindCert(source.GetUser()->fingerprint)) ok = true; @@ -183,7 +183,7 @@ class NSGhost : public Module if (ei != NULL) for (std::map<Anope::string, ChannelStatus>::iterator it = ei->begin(), it_end = ei->end(); it != it_end; ++it) - ircdproto->SendSVSJoin(findbot(Config->NickServ), u->GetUID(), it->first, ""); + IRCD->SendSVSJoin(NickServ, u->GetUID(), it->first, ""); } } diff --git a/modules/commands/ns_group.cpp b/modules/commands/ns_group.cpp index 58251d76d..f4a464d28 100644 --- a/modules/commands/ns_group.cpp +++ b/modules/commands/ns_group.cpp @@ -18,7 +18,7 @@ class NSGroupRequest : public IdentifyRequest CommandSource source; Command *cmd; Anope::string nick; - dynamic_reference<NickAlias> target; + Reference<NickAlias> target; public: NSGroupRequest(Module *o, CommandSource &src, Command *c, const Anope::string &n, NickAlias *targ, const Anope::string &pass) : IdentifyRequest(o, targ->nc->display, pass), source(src), cmd(c), nick(n), target(targ) { } @@ -29,12 +29,12 @@ class NSGroupRequest : public IdentifyRequest return; User *u = source.GetUser(); - NickAlias *na = findnick(nick); + NickAlias *na = NickAlias::Find(nick); /* If the nick is already registered, drop it. */ if (na) { FOREACH_MOD(I_OnChangeCoreDisplay, OnChangeCoreDisplay(na->nc, u->nick)); - na->destroy(); + na->Destroy(); } na = new NickAlias(nick, target->nc); @@ -45,9 +45,9 @@ class NSGroupRequest : public IdentifyRequest na->time_registered = na->last_seen = Anope::CurTime; u->Login(target->nc); - ircdproto->SendLogin(u); + IRCD->SendLogin(u); if (!Config->NoNicknameOwnership && na->nc == u->Account() && na->nc->HasFlag(NI_UNCONFIRMED) == false) - u->SetMode(findbot(Config->NickServ), UMODE_REGISTERED); + u->SetMode(NickServ, UMODE_REGISTERED); FOREACH_MOD(I_OnNickGroup, OnNickGroup(u, target)); Log(LOG_COMMAND, source, cmd) << "makes " << nick << " join group of " << target->nick << " (" << target->nc->display << ") (email: " << (!target->nc->email.empty() ? target->nc->email : "none") << ")"; @@ -64,7 +64,7 @@ class NSGroupRequest : public IdentifyRequest Log(LOG_COMMAND, source, cmd) << "failed group for " << target->nick; source.Reply(PASSWORD_INCORRECT); - bad_password(source.GetUser()); + source.GetUser()->BadPassword(); } }; @@ -88,13 +88,13 @@ class CommandNSGroup : public Command const Anope::string &nick = params[0]; const Anope::string &pass = params.size() > 1 ? params[1] : ""; - if (readonly) + if (Anope::ReadOnly) { source.Reply(_("Sorry, nickname grouping is temporarily disabled.")); return; } - if (!ircdproto->IsNickValid(u->nick)) + if (!IRCD->IsNickValid(u->nick)) { source.Reply(NICK_CANNOT_BE_REGISTERED, u->nick.c_str()); return; @@ -112,8 +112,8 @@ class CommandNSGroup : public Command } } - NickAlias *target, *na = findnick(u->nick); - if (!(target = findnick(nick))) + NickAlias *target, *na = NickAlias::Find(u->nick); + if (!(target = NickAlias::Find(nick))) source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); else if (Anope::CurTime < u->lastnickreg + Config->NSRegDelay) source.Reply(_("Please wait %d seconds before using the GROUP command again."), (Config->NSRegDelay + u->lastnickreg) - Anope::CurTime); @@ -212,7 +212,7 @@ class CommandNSUngroup : public Command return; Anope::string nick = !params.empty() ? params[0] : ""; - NickAlias *na = findnick(!nick.empty() ? nick : u->nick); + NickAlias *na = NickAlias::Find(!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.")); @@ -224,12 +224,12 @@ class CommandNSUngroup : public Command { NickCore *oldcore = na->nc; - std::list<serialize_obj<NickAlias> >::iterator it = std::find(oldcore->aliases.begin(), oldcore->aliases.end(), na); + std::list<Serialize::Reference<NickAlias> >::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)) - change_core_display(oldcore); + oldcore->SetDisplay(oldcore->aliases.front()); NickCore *nc = new NickCore(na->nick); na->nc = nc; @@ -244,10 +244,10 @@ class CommandNSUngroup : public Command source.Reply(_("Nick %s has been ungrouped from %s."), na->nick.c_str(), oldcore->display.c_str()); - User *user = finduser(na->nick); + User *user = User::Find(na->nick); if (user) /* The user on the nick who was ungrouped may be identified to the old group, set -r */ - user->RemoveMode(findbot(Config->NickServ), UMODE_REGISTERED); + user->RemoveMode(NickServ, UMODE_REGISTERED); } return; @@ -281,7 +281,7 @@ class CommandNSGList : public Command if (!nick.empty()) { - const NickAlias *na = findnick(nick); + const NickAlias *na = NickAlias::Find(nick); if (!na) { source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); @@ -299,8 +299,8 @@ class CommandNSGList : public Command nc = source.GetAccount(); ListFormatter list; - list.addColumn("Nick").addColumn("Expires"); - for (std::list<serialize_obj<NickAlias> >::const_iterator it = nc->aliases.begin(), it_end = nc->aliases.end(); it != it_end;) + list.AddColumn("Nick").AddColumn("Expires"); + for (std::list<Serialize::Reference<NickAlias> >::const_iterator it = nc->aliases.begin(), it_end = nc->aliases.end(); it != it_end;) { const NickAlias *na2 = *it++; if (!na2) @@ -308,8 +308,8 @@ class CommandNSGList : public Command ListFormatter::ListEntry entry; entry["Nick"] = na2->nick; - entry["Expires"] = (na2->HasFlag(NS_NO_EXPIRE) || !Config->NSExpire) ? "Does not expire" : ("expires in " + do_strftime(na2->last_seen + Config->NSExpire)); - list.addEntry(entry); + entry["Expires"] = (na2->HasFlag(NS_NO_EXPIRE) || !Config->NSExpire) ? "Does not expire" : ("expires in " + Anope::strftime(na2->last_seen + Config->NSExpire)); + list.AddEntry(entry); } source.Reply(!nick.empty() ? _("List of nicknames in the group of \002%s\002:") : _("List of nicknames in your group:"), nc->display.c_str()); diff --git a/modules/commands/ns_identify.cpp b/modules/commands/ns_identify.cpp index dde24d72d..4796e7bb6 100644 --- a/modules/commands/ns_identify.cpp +++ b/modules/commands/ns_identify.cpp @@ -27,7 +27,7 @@ class NSIdentifyRequest : public IdentifyRequest return; User *u = source.GetUser(); - NickAlias *na = findnick(GetAccount()); + NickAlias *na = NickAlias::Find(GetAccount()); if (!na) source.Reply(NICK_X_NOT_REGISTERED, GetAccount().c_str()); @@ -49,7 +49,7 @@ class NSIdentifyRequest : public IdentifyRequest { Log(LOG_COMMAND, source, cmd) << "and failed to identify"; source.Reply(PASSWORD_INCORRECT); - bad_password(source.GetUser()); + source.GetUser()->BadPassword(); } } }; @@ -74,7 +74,7 @@ class CommandNSIdentify : public Command const Anope::string &nick = params.size() == 2 ? params[0] : u->nick; Anope::string pass = params[params.size() - 1]; - NickAlias *na = findnick(nick); + NickAlias *na = NickAlias::Find(nick); if (na && na->nc->HasFlag(NI_SUSPENDED)) source.Reply(NICK_X_SUSPENDED, na->nick.c_str()); else if (u->Account() && na && u->Account() == na->nc) diff --git a/modules/commands/ns_info.cpp b/modules/commands/ns_info.cpp index 5daf2357e..976589718 100644 --- a/modules/commands/ns_info.cpp +++ b/modules/commands/ns_info.cpp @@ -16,14 +16,14 @@ class CommandNSInfo : public Command { private: - template<typename T, unsigned END> void CheckOptStr(NickCore *core, Anope::string &buf, T opt, const char *str, const Flags<T, END> *nc, bool reverse_logic = false) + template<typename T> void CheckOptStr(NickCore *core, Anope::string &buf, T opt, const char *str, const Flags<T> *nc, bool reverse_logic = false) { if (reverse_logic ? !nc->HasFlag(opt) : nc->HasFlag(opt)) { if (!buf.empty()) buf += ", "; - buf += translate(core, str); + buf += Language::Translate(core, str); } } public: @@ -38,12 +38,12 @@ class CommandNSInfo : public Command { const Anope::string &nick = params.size() ? params[0] : (source.nc ? source.nc->display : source.GetNick()); - NickAlias *na = findnick(nick); + NickAlias *na = NickAlias::Find(nick); bool has_auspex = source.HasPriv("nickserv/auspex"); if (!na) { - if (nickIsServices(nick, true)) + if (BotInfo::Find(nick, true)) source.Reply(_("Nick \002%s\002 is part of this Network's Services."), nick.c_str()); else source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); @@ -53,7 +53,7 @@ class CommandNSInfo : public Command bool nick_online = false, show_hidden = false; /* Is the real owner of the nick we're looking up online? -TheShadow */ - User *u2 = finduser(na->nick); + User *u2 = User::Find(na->nick); if (u2 && u2->Account() == na->nc) nick_online = true; @@ -87,10 +87,10 @@ class CommandNSInfo : public Command info[_("Last seen address")] = na->last_realhost; } - info[_("Time registered")] = do_strftime(na->time_registered); + info[_("Time registered")] = Anope::strftime(na->time_registered); if (!nick_online) - info[_("Last seen")] = do_strftime(na->last_seen); + info[_("Last seen")] = Anope::strftime(na->last_seen); if (!na->last_quit.empty() && (show_hidden || !na->nc->HasFlag(NI_HIDE_QUIT))) info[_("Last quit message")] = na->last_quit; @@ -102,7 +102,7 @@ class CommandNSInfo : public Command { if (na->HasVhost()) { - if (ircdproto->CanSetVIdent && !na->GetVhostIdent().empty()) + if (IRCD->CanSetVIdent && !na->GetVhostIdent().empty()) info[_("VHost")] = na->GetVhostIdent() + "@" + na->GetVhostHost(); else info[_("VHost")] = na->GetVhostHost(); @@ -113,14 +113,14 @@ class CommandNSInfo : public Command Anope::string optbuf; - CheckOptStr<NickCoreFlag, NI_END>(source.nc, optbuf, NI_KILLPROTECT, _("Protection"), na->nc); - CheckOptStr<NickCoreFlag, NI_END>(source.nc, optbuf, NI_SECURE, _("Security"), na->nc); - CheckOptStr<NickCoreFlag, NI_END>(source.nc, optbuf, NI_PRIVATE, _("Private"), na->nc); - CheckOptStr<NickCoreFlag, NI_END>(source.nc, optbuf, NI_MSG, _("Message mode"), na->nc); - CheckOptStr<NickCoreFlag, NI_END>(source.nc, optbuf, NI_AUTOOP, _("Auto-op"), na->nc); - CheckOptStr<NickCoreFlag, NI_END>(source.nc, optbuf, NI_SUSPENDED, _("Suspended"), na->nc); - CheckOptStr<NickCoreFlag, NI_END>(source.nc, optbuf, NI_STATS, _("Chanstats"), na->nc); - CheckOptStr<NickNameFlag, NS_END>(source.nc, optbuf, NS_NO_EXPIRE, _("No expire"), na); + CheckOptStr<NickCoreFlag>(source.nc, optbuf, NI_KILLPROTECT, _("Protection"), na->nc); + CheckOptStr<NickCoreFlag>(source.nc, optbuf, NI_SECURE, _("Security"), na->nc); + CheckOptStr<NickCoreFlag>(source.nc, optbuf, NI_PRIVATE, _("Private"), na->nc); + CheckOptStr<NickCoreFlag>(source.nc, optbuf, NI_MSG, _("Message mode"), na->nc); + CheckOptStr<NickCoreFlag>(source.nc, optbuf, NI_AUTOOP, _("Auto-op"), na->nc); + CheckOptStr<NickCoreFlag>(source.nc, optbuf, NI_SUSPENDED, _("Suspended"), na->nc); + CheckOptStr<NickCoreFlag>(source.nc, optbuf, NI_STATS, _("Chanstats"), na->nc); + CheckOptStr<NickNameFlag>(source.nc, optbuf, NS_NO_EXPIRE, _("No expire"), na); info[_("Options")] = optbuf.empty() ? _("None") : optbuf; @@ -129,10 +129,10 @@ class CommandNSInfo : public Command if (na->HasFlag(NS_NO_EXPIRE) || !Config->NSExpire) ; else - info[_("Expires")] = do_strftime(na->last_seen + Config->NSExpire); + info[_("Expires")] = Anope::strftime(na->last_seen + Config->NSExpire); } else - info[_("Expires")] = do_strftime(na->time_registered + Config->NSUnconfirmedExpire); + info[_("Expires")] = Anope::strftime(na->time_registered + Config->NSUnconfirmedExpire); } FOREACH_MOD(I_OnNickInfo, OnNickInfo(source, na, info, show_hidden)); diff --git a/modules/commands/ns_list.cpp b/modules/commands/ns_list.cpp index 89adfc6ea..9c3c164dd 100644 --- a/modules/commands/ns_list.cpp +++ b/modules/commands/ns_list.cpp @@ -36,8 +36,9 @@ class CommandNSList : public Command if (pattern[0] == '#') { - Anope::string n1 = myStrGetToken(pattern.substr(1), '-', 0), /* Read FROM out */ - n2 = myStrGetToken(pattern, '-', 1); + Anope::string n1, n2; + sepstream(pattern.substr(1), '-').GetToken(n1, 0); + sepstream(pattern, '-').GetToken(n2, 1); try { from = convertTo<int>(n1); @@ -72,7 +73,7 @@ class CommandNSList : public Command mync = source.nc; ListFormatter list; - list.addColumn("Nick").addColumn("Last usermask"); + list.AddColumn("Nick").AddColumn("Last usermask"); for (nickalias_map::const_iterator it = NickAliasList->begin(), it_end = NickAliasList->end(); it != it_end; ++it) { @@ -110,7 +111,7 @@ class CommandNSList : public Command entry["Last usermask"] = "[Unconfirmed]"; else entry["Last usermask"] = na->last_usermask; - list.addEntry(entry); + list.AddEntry(entry); } ++count; } diff --git a/modules/commands/ns_logout.cpp b/modules/commands/ns_logout.cpp index 4e0dc7131..5519e6ae8 100644 --- a/modules/commands/ns_logout.cpp +++ b/modules/commands/ns_logout.cpp @@ -32,16 +32,16 @@ class CommandNSLogout : public Command User *u2; if (!source.IsServicesOper() && !nick.empty()) this->OnSyntaxError(source, ""); - else if (!(u2 = (!nick.empty() ? finduser(nick) : source.GetUser()))) + else if (!(u2 = (!nick.empty() ? User::Find(nick, true) : source.GetUser()))) source.Reply(NICK_X_NOT_IN_USE, !nick.empty() ? nick.c_str() : source.GetNick().c_str()); else if (!nick.empty() && u2->IsServicesOper()) source.Reply(_("You can't logout %s because they are a Services Operator."), nick.c_str()); else { - if (!nick.empty() && !param.empty() && param.equals_ci("REVALIDATE") && nickserv) - nickserv->Validate(u2); + if (!nick.empty() && !param.empty() && param.equals_ci("REVALIDATE") && NickServService) + NickServService->Validate(u2); - u2->SuperAdmin = 0; /* Dont let people logout and remain a SuperAdmin */ + u2->super_admin = false; /* Dont let people logout and remain a SuperAdmin */ Log(LOG_COMMAND, source, this) << "to logout " << u2->nick; /* Remove founder status from this user in all channels */ @@ -50,8 +50,8 @@ class CommandNSLogout : public Command else source.Reply(_("Your nick has been logged out.")); - ircdproto->SendLogout(u2); - u2->RemoveMode(findbot(Config->NickServ), UMODE_REGISTERED); + IRCD->SendLogout(u2); + u2->RemoveMode(NickServ, UMODE_REGISTERED); u2->Logout(); /* Send out an event */ diff --git a/modules/commands/ns_recover.cpp b/modules/commands/ns_recover.cpp index 63d503553..54a10f3b4 100644 --- a/modules/commands/ns_recover.cpp +++ b/modules/commands/ns_recover.cpp @@ -18,8 +18,8 @@ class NSRecoverRequest : public IdentifyRequest { CommandSource source; Command *cmd; - dynamic_reference<NickAlias> na; - dynamic_reference<User> u; + Reference<NickAlias> na; + Reference<User> u; public: NSRecoverRequest(Module *m, CommandSource &src, Command *c, User *user, NickAlias *n, const Anope::string &pass) : IdentifyRequest(m, n->nc->display, pass), source(src), cmd(c), na(n), u(user) { } @@ -33,14 +33,14 @@ class NSRecoverRequest : public IdentifyRequest if (u->Account() == na->nc) { - ircdproto->SendLogout(u); - u->RemoveMode(findbot(Config->NickServ), UMODE_REGISTERED); + IRCD->SendLogout(u); + u->RemoveMode(NickServ, UMODE_REGISTERED); } u->Collide(na); /* Convert Config->NSReleaseTimeout seconds to string format */ - Anope::string relstr = duration(Config->NSReleaseTimeout); + Anope::string relstr = Anope::Duration(Config->NSReleaseTimeout); source.Reply(NICK_RECOVERED, Config->UseStrictPrivMsgString.c_str(), Config->NickServ.c_str(), na->nick.c_str(), relstr.c_str()); } @@ -53,7 +53,7 @@ class NSRecoverRequest : public IdentifyRequest if (!GetPassword().empty()) { Log(LOG_COMMAND, source, cmd) << "with invalid password for " << na->nick; - bad_password(u); + u->BadPassword(); } } }; @@ -76,11 +76,11 @@ class CommandNSRecover : public Command NickAlias *na; User *u2; - if (!(u2 = finduser(nick))) + if (!(u2 = User::Find(nick, true))) source.Reply(NICK_X_NOT_IN_USE, nick.c_str()); else if (u2->server == Me) source.Reply(_("\2%s\2 has already been recovered."), u2->nick.c_str()); - else if (!(na = findnick(u2->nick))) + else if (!(na = NickAlias::Find(u2->nick))) source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); else if (na->nc->HasFlag(NI_SUSPENDED)) source.Reply(NICK_X_SUSPENDED, na->nick.c_str()); @@ -91,7 +91,7 @@ class CommandNSRecover : public Command bool ok = false; if (source.GetAccount() == na->nc) ok = true; - else if (!na->nc->HasFlag(NI_SECURE) && source.GetUser() && is_on_access(source.GetUser(), na->nc)) + else if (!na->nc->HasFlag(NI_SECURE) && source.GetUser() && na->nc->IsOnAccess(source.GetUser())) ok = true; else if (source.GetUser() && !source.GetUser()->fingerprint.empty() && na->nc->FindCert(source.GetUser()->fingerprint)) ok = true; @@ -117,7 +117,7 @@ class CommandNSRecover : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override { /* Convert Config->NSReleaseTimeout seconds to string format */ - Anope::string relstr = duration(Config->NSReleaseTimeout); + Anope::string relstr = Anope::Duration(Config->NSReleaseTimeout); this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/ns_register.cpp b/modules/commands/ns_register.cpp index 0413f8cc8..d16144a18 100644 --- a/modules/commands/ns_register.cpp +++ b/modules/commands/ns_register.cpp @@ -31,7 +31,7 @@ class CommandNSConfirm : public Command if (source.nc && !source.nc->HasFlag(NI_UNCONFIRMED) && source.HasPriv("nickserv/confirm")) { - NickAlias *na = findnick(passcode); + NickAlias *na = NickAlias::Find(passcode); if (na == NULL) source.Reply(NICK_X_NOT_REGISTERED, passcode.c_str()); else if (na->nc->HasFlag(NI_UNCONFIRMED) == false) @@ -56,10 +56,10 @@ class CommandNSConfirm : public Command if (source.GetUser()) { - ircdproto->SendLogin(source.GetUser()); - const NickAlias *na = findnick(source.GetNick()); + IRCD->SendLogin(source.GetUser()); + const NickAlias *na = NickAlias::Find(source.GetNick()); if (!Config->NoNicknameOwnership && na != NULL && na->nc == source.GetAccount() && na->nc->HasFlag(NI_UNCONFIRMED) == false) - source.GetUser()->SetMode(findbot(Config->NickServ), UMODE_REGISTERED); + source.GetUser()->SetMode(NickServ, UMODE_REGISTERED); } } else @@ -118,7 +118,7 @@ class CommandNSRegister : public Command Anope::string pass = params[0]; Anope::string email = params.size() > 1 ? params[1] : ""; - if (readonly) + if (Anope::ReadOnly) { source.Reply(_("Sorry, nickname registration is temporarily disabled.")); return; @@ -147,7 +147,7 @@ class CommandNSRegister : public Command return; } - if (!ircdproto->IsNickValid(u_nick)) + if (!IRCD->IsNickValid(u_nick)) { source.Reply(NICK_CANNOT_BE_REGISTERED, u_nick.c_str()); return; @@ -169,19 +169,19 @@ class CommandNSRegister : public Command this->OnSyntaxError(source, ""); else if (u && Anope::CurTime < u->lastnickreg + Config->NSRegDelay) source.Reply(_("Please wait %d seconds before using the REGISTER command again."), (u->lastnickreg + Config->NSRegDelay) - Anope::CurTime); - else if ((na = findnick(u_nick))) + else if ((na = NickAlias::Find(u_nick))) source.Reply(NICK_ALREADY_REGISTERED, u_nick.c_str()); else if (pass.equals_ci(u_nick) || (Config->StrictPasswords && pass.length() < 5)) source.Reply(MORE_OBSCURE_PASSWORD); else if (pass.length() > Config->PassLen) source.Reply(PASSWORD_TOO_LONG); - else if (!email.empty() && !MailValidate(email)) + else if (!email.empty() && !Mail::Validate(email)) source.Reply(MAIL_X_INVALID, email.c_str()); else { NickCore *nc = new NickCore(u_nick); na = new NickAlias(u_nick, nc); - enc_encrypt(pass, nc->pass); + Anope::Encrypt(pass, nc->pass); if (!email.empty()) nc->email = email; @@ -193,7 +193,7 @@ class CommandNSRegister : public Command u->Login(nc); if (Config->NSAddAccessOnReg) - nc->AddAccess(create_mask(u)); + nc->AddAccess(u->Mask()); } Log(LOG_COMMAND, source, this) << "to register " << na->nick << " (email: " << (!na->nc->email.empty() ? na->nc->email : "none") << ")"; @@ -206,7 +206,7 @@ class CommandNSRegister : public Command source.Reply(_("Nickname \002%s\002 registered."), u_nick.c_str()); Anope::string tmp_pass; - if (enc_decrypt(na->nc->pass, tmp_pass) == 1) + if (Anope::Decrypt(na->nc->pass, tmp_pass) == 1) source.Reply(_("Your password is \002%s\002 - remember this for later use."), tmp_pass.c_str()); if (Config->NSRegistration.equals_ci("admin")) @@ -220,16 +220,16 @@ class CommandNSRegister : public Command if (SendRegmail(u, na, source.service)) { source.Reply(_("A passcode has been sent to %s, please type %s%s confirm <passcode> to confirm your email address."), email.c_str(), Config->UseStrictPrivMsgString.c_str(), Config->NickServ.c_str()); - source.Reply(_("If you do not confirm your email address within %s your account will expire."), duration(Config->NSUnconfirmedExpire).c_str()); + source.Reply(_("If you do not confirm your email address within %s your account will expire."), Anope::Duration(Config->NSUnconfirmedExpire).c_str()); } } else if (Config->NSRegistration.equals_ci("none")) { if (u) { - ircdproto->SendLogin(u); + IRCD->SendLogin(u); if (!Config->NoNicknameOwnership && na->nc == u->Account() && na->nc->HasFlag(NI_UNCONFIRMED) == false) - u->SetMode(findbot(Config->NickServ), UMODE_REGISTERED); + u->SetMode(NickServ, UMODE_REGISTERED); } } @@ -290,7 +290,7 @@ class CommandNSResend : public Command if (Config->NSRegistration.equals_ci("mail")) return; - const NickAlias *na = findnick(source.GetNick()); + const NickAlias *na = NickAlias::Find(source.GetNick()); if (na == NULL) source.Reply(NICK_NOT_REGISTERED); @@ -372,8 +372,8 @@ static bool SendRegmail(User *u, const NickAlias *na, const BotInfo *bi) else codebuf = *code; - Anope::string subject = translate(na->nc, Config->MailRegistrationSubject.c_str()); - Anope::string message = translate(na->nc, Config->MailRegistrationMessage.c_str()); + Anope::string subject = Language::Translate(na->nc, Config->MailRegistrationSubject.c_str()); + Anope::string message = Language::Translate(na->nc, Config->MailRegistrationMessage.c_str()); subject = subject.replace_all_cs("%n", na->nick); subject = subject.replace_all_cs("%N", Config->NetworkName); @@ -383,7 +383,7 @@ static bool SendRegmail(User *u, const NickAlias *na, const BotInfo *bi) message = message.replace_all_cs("%N", Config->NetworkName); message = message.replace_all_cs("%c", codebuf); - return Mail(u, nc, bi, subject, message); + return Mail::Send(u, nc, bi, subject, message); } MODULE_INIT(NSRegister) diff --git a/modules/commands/ns_release.cpp b/modules/commands/ns_release.cpp index cd669e707..a3004f462 100644 --- a/modules/commands/ns_release.cpp +++ b/modules/commands/ns_release.cpp @@ -17,7 +17,7 @@ class NSReleaseRequest : public IdentifyRequest { CommandSource source; Command *cmd; - dynamic_reference<NickAlias> na; + Reference<NickAlias> na; public: NSReleaseRequest(Module *m, CommandSource &src, Command *c, NickAlias *n, const Anope::string &pass) : IdentifyRequest(m, n->nc->display, pass), source(src), cmd(c), na(n) { } @@ -40,7 +40,7 @@ class NSReleaseRequest : public IdentifyRequest { Log(LOG_COMMAND, source, cmd) << "with invalid password for " << na->nick; if (!source.GetUser()) - bad_password(source.GetUser()); + source.GetUser()->BadPassword(); } } }; @@ -61,7 +61,7 @@ class CommandNSRelease : public Command Anope::string pass = params.size() > 1 ? params[1] : ""; NickAlias *na; - if (!(na = findnick(nick))) + if (!(na = NickAlias::Find(nick))) source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); else if (na->nc->HasFlag(NI_SUSPENDED)) source.Reply(NICK_X_SUSPENDED, na->nick.c_str()); @@ -74,7 +74,7 @@ class CommandNSRelease : public Command bool ok = override; if (source.GetAccount() == na->nc) ok = true; - else if (source.GetUser() && !na->nc->HasFlag(NI_SECURE) && is_on_access(source.GetUser(), na->nc)) + else if (source.GetUser() && !na->nc->HasFlag(NI_SECURE) && na->nc->IsOnAccess(source.GetUser())) ok = true; else if (source.GetUser() && !source.GetUser()->fingerprint.empty() && na->nc->FindCert(source.GetUser()->fingerprint)) ok = true; @@ -101,7 +101,7 @@ class CommandNSRelease : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override { /* Convert Config->NSReleaseTimeout seconds to string format */ - Anope::string relstr = duration(Config->NSReleaseTimeout); + Anope::string relstr = Anope::Duration(Config->NSReleaseTimeout); this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/ns_resetpass.cpp b/modules/commands/ns_resetpass.cpp index 8965b6a3e..39eead56e 100644 --- a/modules/commands/ns_resetpass.cpp +++ b/modules/commands/ns_resetpass.cpp @@ -31,7 +31,7 @@ class CommandNSResetPass : public Command if (Config->RestrictMail && source.HasCommand("nickserv/resetpass")) source.Reply(ACCESS_DENIED); - else if (!(na = findnick(params[0]))) + else if (!(na = NickAlias::Find(params[0]))) source.Reply(NICK_X_NOT_REGISTERED, params[0].c_str()); else { @@ -82,7 +82,7 @@ class NSResetPass : public Module { if (command->name == "nickserv/confirm" && params.size() > 1) { - NickAlias *na = findnick(params[0]); + NickAlias *na = NickAlias::Find(params[0]); ResetInfo *ri = na ? na->nc->GetExt<ResetInfo *>("ns_resetpass") : NULL; if (na && ri) @@ -135,8 +135,8 @@ static bool SendResetEmail(User *u, const NickAlias *na, const BotInfo *bi) for (idx = 0; idx < 20; ++idx) passcode += chars[1 + static_cast<int>((static_cast<float>(max - min)) * static_cast<uint16_t>(rand()) / 65536.0) + min]; - Anope::string subject = translate(na->nc, Config->MailResetSubject.c_str()); - Anope::string message = translate(na->nc, Config->MailResetMessage.c_str()); + Anope::string subject = Language::Translate(na->nc, Config->MailResetSubject.c_str()); + Anope::string message = Language::Translate(na->nc, Config->MailResetMessage.c_str()); subject = subject.replace_all_cs("%n", na->nick); subject = subject.replace_all_cs("%N", Config->NetworkName); @@ -152,7 +152,7 @@ static bool SendResetEmail(User *u, const NickAlias *na, const BotInfo *bi) NickCore *nc = na->nc; nc->Extend("ns_resetpass", ri); - return Mail(u, nc, bi, subject, message); + return Mail::Send(u, nc, bi, subject, message); } MODULE_INIT(NSResetPass) diff --git a/modules/commands/ns_saset.cpp b/modules/commands/ns_saset.cpp index 8d2ba08d9..ac3cb1d8f 100644 --- a/modules/commands/ns_saset.cpp +++ b/modules/commands/ns_saset.cpp @@ -40,7 +40,7 @@ class CommandNSSASet : public Command if (c_name.find_ci(this_name + " ") == 0) { - service_reference<Command> command("Command", info.name); + ServiceReference<Command> command("Command", info.name); if (command) { source.command = c_name; @@ -66,7 +66,7 @@ class CommandNSSASetPassword : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - const NickAlias *setter_na = findnick(params[0]); + const NickAlias *setter_na = NickAlias::Find(params[0]); if (setter_na == NULL) { source.Reply(NICK_X_NOT_REGISTERED, params[0].c_str()); @@ -92,9 +92,9 @@ class CommandNSSASetPassword : public Command return; } - enc_encrypt(params[1], nc->pass); + Anope::Encrypt(params[1], nc->pass); Anope::string tmp_pass; - if (enc_decrypt(nc->pass, tmp_pass) == 1) + if (Anope::Decrypt(nc->pass, tmp_pass) == 1) source.Reply(_("Password for \002%s\002 changed to \002%s\002."), nc->display.c_str(), tmp_pass.c_str()); else source.Reply(_("Password for \002%s\002 changed."), nc->display.c_str()); diff --git a/modules/commands/ns_saset_noexpire.cpp b/modules/commands/ns_saset_noexpire.cpp index 5ebfdce89..ea3e946ae 100644 --- a/modules/commands/ns_saset_noexpire.cpp +++ b/modules/commands/ns_saset_noexpire.cpp @@ -24,7 +24,7 @@ class CommandNSSASetNoexpire : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - NickAlias *na = findnick(params[0]); + NickAlias *na = NickAlias::Find(params[0]); if (na == NULL) { source.Reply(NICK_X_NOT_REGISTERED, params[0].c_str()); diff --git a/modules/commands/ns_sendpass.cpp b/modules/commands/ns_sendpass.cpp index 5d88fd5a4..e85690e24 100644 --- a/modules/commands/ns_sendpass.cpp +++ b/modules/commands/ns_sendpass.cpp @@ -32,12 +32,12 @@ class CommandNSSendPass : public Command if (Config->RestrictMail && !source.HasCommand("nickserv/sendpass")) source.Reply(ACCESS_DENIED); - else if (!(na = findnick(nick))) + else if (!(na = NickAlias::Find(nick))) source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); else { Anope::string tmp_pass; - if (enc_decrypt(na->nc->pass, tmp_pass) == 1) + if (Anope::Decrypt(na->nc->pass, tmp_pass) == 1) { if (SendPassMail(source.GetUser(), na, source.service, tmp_pass)) { @@ -79,7 +79,7 @@ class NSSendPass : public Module throw ModuleException("Not using mail."); Anope::string tmp_pass = "plain:tmp"; - if (enc_decrypt(tmp_pass, tmp_pass) == -1) + if (Anope::Decrypt(tmp_pass, tmp_pass) == -1) throw ModuleException("Incompatible with the encryption module being used"); } @@ -87,8 +87,8 @@ class NSSendPass : public Module static bool SendPassMail(User *u, const NickAlias *na, const BotInfo *bi, const Anope::string &pass) { - Anope::string subject = translate(na->nc, Config->MailSendpassSubject.c_str()); - Anope::string message = translate(na->nc, Config->MailSendpassMessage.c_str()); + Anope::string subject = Language::Translate(na->nc, Config->MailSendpassSubject.c_str()); + Anope::string message = Language::Translate(na->nc, Config->MailSendpassMessage.c_str()); subject = subject.replace_all_cs("%n", na->nick); subject = subject.replace_all_cs("%N", Config->NetworkName); @@ -98,7 +98,7 @@ static bool SendPassMail(User *u, const NickAlias *na, const BotInfo *bi, const message = message.replace_all_cs("%N", Config->NetworkName); message = message.replace_all_cs("%p", pass); - return Mail(u, na->nc, bi, subject, message); + return Mail::Send(u, na->nc, bi, subject, message); } MODULE_INIT(NSSendPass) diff --git a/modules/commands/ns_set.cpp b/modules/commands/ns_set.cpp index 0917d45bd..bc6a67b35 100644 --- a/modules/commands/ns_set.cpp +++ b/modules/commands/ns_set.cpp @@ -41,7 +41,7 @@ class CommandNSSet : public Command if (c_name.find_ci(this_name + " ") == 0) { - service_reference<Command> command("Command", info.name); + ServiceReference<Command> command("Command", info.name); if (command) { source.command = c_name; @@ -81,9 +81,9 @@ class CommandNSSetPassword : public Command return; } - enc_encrypt(param, source.nc->pass); + Anope::Encrypt(param, source.nc->pass); Anope::string tmp_pass; - if (enc_decrypt(source.nc->pass, tmp_pass) == 1) + if (Anope::Decrypt(source.nc->pass, tmp_pass) == 1) source.Reply(_("Password for \002%s\002 changed to \002%s\002."), source.nc->display.c_str(), tmp_pass.c_str()); else source.Reply(_("Password for \002%s\002 changed."), source.nc->display.c_str()); diff --git a/modules/commands/ns_set_autoop.cpp b/modules/commands/ns_set_autoop.cpp index 7e3864420..e6533875b 100644 --- a/modules/commands/ns_set_autoop.cpp +++ b/modules/commands/ns_set_autoop.cpp @@ -24,7 +24,7 @@ class CommandNSSetAutoOp : public Command void Run(CommandSource &source, const Anope::string &user, const Anope::string ¶m) { - const NickAlias *na = findnick(user); + const NickAlias *na = NickAlias::Find(user); if (na == NULL) { source.Reply(NICK_X_NOT_REGISTERED, user.c_str()); diff --git a/modules/commands/ns_set_chanstats.cpp b/modules/commands/ns_set_chanstats.cpp index 5bf23907b..7b8f371ff 100644 --- a/modules/commands/ns_set_chanstats.cpp +++ b/modules/commands/ns_set_chanstats.cpp @@ -23,7 +23,7 @@ class CommandNSSetChanstats : public Command } void Run(CommandSource &source, const Anope::string &user, const Anope::string ¶m) { - NickAlias *na = findnick(user); + NickAlias *na = NickAlias::Find(user); if (!na) { source.Reply(NICK_X_NOT_REGISTERED, user.c_str()); diff --git a/modules/commands/ns_set_display.cpp b/modules/commands/ns_set_display.cpp index 1980ba116..c532f4cf1 100644 --- a/modules/commands/ns_set_display.cpp +++ b/modules/commands/ns_set_display.cpp @@ -24,7 +24,7 @@ class CommandNSSetDisplay : public Command void Run(CommandSource &source, const Anope::string &user, const Anope::string ¶m) { - const NickAlias *user_na = findnick(user), *na = findnick(param); + const NickAlias *user_na = NickAlias::Find(user), *na = NickAlias::Find(param); if (user_na == NULL) { @@ -42,7 +42,7 @@ class CommandNSSetDisplay : public Command if (MOD_RESULT == EVENT_STOP) return; - change_core_display(user_na->nc, na->nick); + user_na->nc->SetDisplay(na); source.Reply(NICK_SET_DISPLAY_CHANGED, user_na->nc->display.c_str()); } diff --git a/modules/commands/ns_set_email.cpp b/modules/commands/ns_set_email.cpp index 6966c2a79..82b4a0cc8 100644 --- a/modules/commands/ns_set_email.cpp +++ b/modules/commands/ns_set_email.cpp @@ -40,7 +40,7 @@ static bool SendConfirmMail(User *u, const BotInfo *bi) message = message.replace_all_cs("%N", Config->NetworkName); message = message.replace_all_cs("%c", code); - return Mail(u, u->Account(), bi, subject, message); + return Mail::Send(u, u->Account(), bi, subject, message); } class CommandNSSetEmail : public Command @@ -54,7 +54,7 @@ class CommandNSSetEmail : public Command void Run(CommandSource &source, const Anope::string &user, const Anope::string ¶m) { - const NickAlias *na = findnick(user); + const NickAlias *na = NickAlias::Find(user); if (!na) { source.Reply(NICK_X_NOT_REGISTERED, user.c_str()); @@ -72,7 +72,7 @@ class CommandNSSetEmail : public Command source.Reply(_("You may not change the email of other services operators.")); return; } - else if (!param.empty() && !MailValidate(param)) + else if (!param.empty() && !Mail::Validate(param)) { source.Reply(MAIL_X_INVALID, param.c_str()); return; diff --git a/modules/commands/ns_set_greet.cpp b/modules/commands/ns_set_greet.cpp index 87ac7d1ee..b28edc2bb 100644 --- a/modules/commands/ns_set_greet.cpp +++ b/modules/commands/ns_set_greet.cpp @@ -24,7 +24,7 @@ class CommandNSSetGreet : public Command void Run(CommandSource &source, const Anope::string &user, const Anope::string ¶m) { - const NickAlias *na = findnick(user); + const NickAlias *na = NickAlias::Find(user); if (!na) { source.Reply(NICK_X_NOT_REGISTERED, user.c_str()); diff --git a/modules/commands/ns_set_hide.cpp b/modules/commands/ns_set_hide.cpp index 4770653f2..d7fe886ea 100644 --- a/modules/commands/ns_set_hide.cpp +++ b/modules/commands/ns_set_hide.cpp @@ -24,7 +24,7 @@ class CommandNSSetHide : public Command void Run(CommandSource &source, const Anope::string &user, const Anope::string ¶m, const Anope::string &arg) { - const NickAlias *na = findnick(user); + const NickAlias *na = NickAlias::Find(user); if (!na) { source.Reply(NICK_X_NOT_REGISTERED, user.c_str()); diff --git a/modules/commands/ns_set_kill.cpp b/modules/commands/ns_set_kill.cpp index ca0f804d3..0f62a4ba0 100644 --- a/modules/commands/ns_set_kill.cpp +++ b/modules/commands/ns_set_kill.cpp @@ -24,7 +24,7 @@ class CommandNSSetKill : public Command void Run(CommandSource &source, const Anope::string &user, const Anope::string ¶m) { - const NickAlias *na = findnick(user); + const NickAlias *na = NickAlias::Find(user); if (!na) { source.Reply(NICK_X_NOT_REGISTERED, user.c_str()); diff --git a/modules/commands/ns_set_language.cpp b/modules/commands/ns_set_language.cpp index 43162d6fd..d2830d4b8 100644 --- a/modules/commands/ns_set_language.cpp +++ b/modules/commands/ns_set_language.cpp @@ -24,7 +24,7 @@ class CommandNSSetLanguage : public Command void Run(CommandSource &source, const Anope::string &user, const Anope::string ¶m) { - const NickAlias *na = findnick(user); + const NickAlias *na = NickAlias::Find(user); if (!na) { source.Reply(NICK_X_NOT_REGISTERED, user.c_str()); @@ -37,11 +37,11 @@ class CommandNSSetLanguage : public Command if (MOD_RESULT == EVENT_STOP) return; - for (unsigned j = 0; j < languages.size(); ++j) + for (unsigned j = 0; j < Language::Languages.size(); ++j) { - if (param == "en" || languages[j] == param) + if (param == "en" || Language::Languages[j] == param) break; - else if (j + 1 == languages.size()) + else if (j + 1 == Language::Languages.size()) { this->OnSyntaxError(source, ""); return; @@ -69,12 +69,12 @@ class CommandNSSetLanguage : public Command "supported languages:")); source.Reply(" en (English)"); - for (unsigned j = 0; j < languages.size(); ++j) + for (unsigned j = 0; j < Language::Languages.size(); ++j) { - const Anope::string &langname = anope_gettext(languages[j].c_str(), _("English")); + const Anope::string &langname = Language::Translate(Language::Languages[j].c_str(), _("English")); if (langname == "English") continue; - source.Reply(" %s (%s)", languages[j].c_str(), langname.c_str()); + source.Reply(" %s (%s)", Language::Languages[j].c_str(), langname.c_str()); } return true; @@ -104,12 +104,12 @@ class CommandNSSASetLanguage : public CommandNSSetLanguage "\037language\037 should be chosen from the following list of\n" "supported languages:")); source.Reply(" en (English)"); - for (unsigned j = 0; j < languages.size(); ++j) + for (unsigned j = 0; j < Language::Languages.size(); ++j) { - const Anope::string &langname = anope_gettext(languages[j].c_str(), _("English")); + const Anope::string &langname = Language::Translate(Language::Languages[j].c_str(), _("English")); if (langname == "English") continue; - source.Reply(" %s (%s)", languages[j].c_str(), langname.c_str()); + source.Reply(" %s (%s)", Language::Languages[j].c_str(), langname.c_str()); } return true; } diff --git a/modules/commands/ns_set_message.cpp b/modules/commands/ns_set_message.cpp index fa0ad7ec3..f515b22c1 100644 --- a/modules/commands/ns_set_message.cpp +++ b/modules/commands/ns_set_message.cpp @@ -24,7 +24,7 @@ class CommandNSSetMessage : public Command void Run(CommandSource &source, const Anope::string &user, const Anope::string ¶m) { - const NickAlias *na = findnick(user); + const NickAlias *na = NickAlias::Find(user); if (!na) { source.Reply(NICK_X_NOT_REGISTERED, user.c_str()); diff --git a/modules/commands/ns_set_misc.cpp b/modules/commands/ns_set_misc.cpp index 9c805b3ea..1e088a425 100644 --- a/modules/commands/ns_set_misc.cpp +++ b/modules/commands/ns_set_misc.cpp @@ -15,7 +15,7 @@ struct NSMiscData : ExtensibleItem, Serializable { - serialize_obj<NickCore> nc; + Serialize::Reference<NickCore> nc; Anope::string name; Anope::string data; @@ -23,7 +23,7 @@ struct NSMiscData : ExtensibleItem, Serializable { } - Serialize::Data serialize() const anope_override + Serialize::Data Serialize() const anope_override { Serialize::Data sdata; @@ -34,9 +34,9 @@ struct NSMiscData : ExtensibleItem, Serializable return sdata; } - static Serializable* unserialize(Serializable *obj, Serialize::Data &data) + static Serializable* Unserialize(Serializable *obj, Serialize::Data &data) { - NickCore *nc = findcore(data["nc"].astr()); + NickCore *nc = NickCore::Find(data["nc"].astr()); if (nc == NULL) return NULL; @@ -76,7 +76,7 @@ class CommandNSSetMisc : public Command void Run(CommandSource &source, const Anope::string &user, const Anope::string ¶m) { - const NickAlias *na = findnick(user); + const NickAlias *na = NickAlias::Find(user); if (!na) { source.Reply(NICK_X_NOT_REGISTERED, user.c_str()); @@ -126,13 +126,13 @@ class CommandNSSASetMisc : public CommandNSSetMisc class NSSetMisc : public Module { - SerializeType nsmiscdata_type; + Serialize::Type nsmiscdata_type; CommandNSSetMisc commandnssetmisc; CommandNSSASetMisc commandnssasetmisc; public: NSSetMisc(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), - nsmiscdata_type("NSMiscData", NSMiscData::unserialize), commandnssetmisc(this), commandnssasetmisc(this) + nsmiscdata_type("NSMiscData", NSMiscData::Unserialize), commandnssetmisc(this), commandnssasetmisc(this) { this->SetAuthor("Anope"); diff --git a/modules/commands/ns_set_private.cpp b/modules/commands/ns_set_private.cpp index 358035567..8f953fcc0 100644 --- a/modules/commands/ns_set_private.cpp +++ b/modules/commands/ns_set_private.cpp @@ -24,7 +24,7 @@ class CommandNSSetPrivate : public Command void Run(CommandSource &source, const Anope::string &user, const Anope::string ¶m) { - const NickAlias *na = findnick(user); + const NickAlias *na = NickAlias::Find(user); if (!na) { source.Reply(NICK_X_NOT_REGISTERED, user.c_str()); diff --git a/modules/commands/ns_set_secure.cpp b/modules/commands/ns_set_secure.cpp index 52eea8e5b..b7dd79969 100644 --- a/modules/commands/ns_set_secure.cpp +++ b/modules/commands/ns_set_secure.cpp @@ -24,7 +24,7 @@ class CommandNSSetSecure : public Command void Run(CommandSource &source, const Anope::string &user, const Anope::string ¶m) { - const NickAlias *na = findnick(user); + const NickAlias *na = NickAlias::Find(user); if (!na) { source.Reply(NICK_X_NOT_REGISTERED, user.c_str()); diff --git a/modules/commands/ns_status.cpp b/modules/commands/ns_status.cpp index 7a5a68a5a..495ae96a1 100644 --- a/modules/commands/ns_status.cpp +++ b/modules/commands/ns_status.cpp @@ -26,13 +26,13 @@ class CommandNSStatus : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { const Anope::string &nick = !params.empty() ? params[0] : source.GetNick(); - const NickAlias *na = findnick(nick); + const NickAlias *na = NickAlias::Find(nick); spacesepstream sep(nick); Anope::string nickbuf; while (sep.GetToken(nickbuf)) { - User *u2 = finduser(nickbuf); + User *u2 = User::Find(nickbuf, true); if (!u2) /* Nick is not online */ source.Reply(_("STATUS %s %d %s"), nickbuf.c_str(), 0, ""); else if (u2->IsIdentified() && na && na->nc == u2->Account()) /* Nick is identified */ diff --git a/modules/commands/ns_suspend.cpp b/modules/commands/ns_suspend.cpp index 6b316379e..6ff355437 100644 --- a/modules/commands/ns_suspend.cpp +++ b/modules/commands/ns_suspend.cpp @@ -22,7 +22,7 @@ struct NickSuspend : ExtensibleItem, Serializable { } - Serialize::Data serialize() const anope_override + Serialize::Data Serialize() const anope_override { Serialize::Data sd; @@ -32,9 +32,9 @@ struct NickSuspend : ExtensibleItem, Serializable return sd; } - static Serializable* unserialize(Serializable *obj, Serialize::Data &sd) + static Serializable* Unserialize(Serializable *obj, Serialize::Data &sd) { - const NickAlias *na = findnick(sd["nick"].astr()); + const NickAlias *na = NickAlias::Find(sd["nick"].astr()); if (na == NULL) return NULL; @@ -71,7 +71,7 @@ class CommandNSSuspend : public Command Anope::string reason = params.size() > 2 ? params[2] : ""; time_t expiry_secs = Config->NSSuspendExpire; - if (readonly) + if (Anope::ReadOnly) { source.Reply(READ_ONLY_MODE); return; @@ -84,9 +84,9 @@ class CommandNSSuspend : public Command expiry.clear(); } else - expiry_secs = dotime(expiry); + expiry_secs = Anope::DoTime(expiry); - NickAlias *na = findnick(nick); + NickAlias *na = NickAlias::Find(nick); if (!na) { source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); @@ -107,7 +107,7 @@ class CommandNSSuspend : public Command nc->UnsetFlag(NI_KILL_QUICK); nc->UnsetFlag(NI_KILL_IMMED); - for (std::list<serialize_obj<NickAlias> >::iterator it = nc->aliases.begin(), it_end = nc->aliases.end(); it != it_end;) + for (std::list<Serialize::Reference<NickAlias> >::iterator it = nc->aliases.begin(), it_end = nc->aliases.end(); it != it_end;) { NickAlias *na2 = *it++; @@ -115,7 +115,7 @@ class CommandNSSuspend : public Command { na2->last_quit = reason; - User *u2 = finduser(na2->nick); + User *u2 = User::Find(na2->nick); if (u2) { u2->Logout(); @@ -133,7 +133,7 @@ class CommandNSSuspend : public Command nc->Extend("ns_suspend_expire", ns); } - Log(LOG_ADMIN, source, this) << "for " << nick << " (" << (!reason.empty() ? reason : "No reason") << "), expires in " << (expiry_secs ? do_strftime(Anope::CurTime + expiry_secs) : "never"); + Log(LOG_ADMIN, source, this) << "for " << nick << " (" << (!reason.empty() ? reason : "No reason") << "), expires in " << (expiry_secs ? Anope::strftime(Anope::CurTime + expiry_secs) : "never"); source.Reply(_("Nick %s is now suspended."), nick.c_str()); FOREACH_MOD(I_OnNickSuspended, OnNickSuspend(na)); @@ -166,13 +166,13 @@ class CommandNSUnSuspend : public Command { const Anope::string &nick = params[0]; - if (readonly) + if (Anope::ReadOnly) { source.Reply(READ_ONLY_MODE); return; } - NickAlias *na = findnick(nick); + NickAlias *na = NickAlias::Find(nick); if (!na) { source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); @@ -207,13 +207,13 @@ class CommandNSUnSuspend : public Command class NSSuspend : public Module { - SerializeType nicksuspend_type; + Serialize::Type nicksuspend_type; CommandNSSuspend commandnssuspend; CommandNSUnSuspend commandnsunsuspend; public: NSSuspend(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), - nicksuspend_type("NickSuspend", NickSuspend::unserialize), commandnssuspend(this), commandnsunsuspend(this) + nicksuspend_type("NickSuspend", NickSuspend::Unserialize), commandnssuspend(this), commandnsunsuspend(this) { this->SetAuthor("Anope"); @@ -241,7 +241,7 @@ class NSSuspend : public Module na->nc->UnsetFlag(NI_SUSPENDED); na->nc->Shrink("ns_suspend_expire"); - Log(LOG_NORMAL, "expire", findbot(Config->NickServ)) << "Expiring suspend for " << na->nick; + Log(LOG_NORMAL, "expire", NickServ) << "Expiring suspend for " << na->nick; } } }; diff --git a/modules/commands/ns_update.cpp b/modules/commands/ns_update.cpp index 5ca8da26d..8f4812b9e 100644 --- a/modules/commands/ns_update.cpp +++ b/modules/commands/ns_update.cpp @@ -28,7 +28,7 @@ class CommandNSUpdate : public Command if (!u) return; - NickAlias *na = findnick(u->nick); + NickAlias *na = NickAlias::Find(u->nick); if (na && na->nc == source.GetAccount()) { diff --git a/modules/commands/os_akill.cpp b/modules/commands/os_akill.cpp index f09d1f87a..89b1d96ae 100644 --- a/modules/commands/os_akill.cpp +++ b/modules/commands/os_akill.cpp @@ -13,38 +13,38 @@ #include "module.h" -static service_reference<XLineManager> akills("XLineManager", "xlinemanager/sgline"); +static ServiceReference<XLineManager> akills("XLineManager", "xlinemanager/sgline"); class AkillDelCallback : public NumberList { CommandSource &source; - unsigned Deleted; + unsigned deleted; public: - AkillDelCallback(CommandSource &_source, const Anope::string &numlist) : NumberList(numlist, true), source(_source), Deleted(0) + AkillDelCallback(CommandSource &_source, const Anope::string &numlist) : NumberList(numlist, true), source(_source), deleted(0) { } ~AkillDelCallback() { - if (!Deleted) + if (!deleted) source.Reply(_("No matching entries on the AKILL list.")); - else if (Deleted == 1) + else if (deleted == 1) source.Reply(_("Deleted 1 entry from the AKILL list.")); else - source.Reply(_("Deleted %d entries from the AKILL list."), Deleted); + source.Reply(_("Deleted %d entries from the AKILL list."), deleted); } - void HandleNumber(unsigned Number) anope_override + void HandleNumber(unsigned number) anope_override { - if (!Number) + if (!number) return; - XLine *x = akills->GetEntry(Number - 1); + XLine *x = akills->GetEntry(number - 1); if (!x) return; - ++Deleted; + ++deleted; DoDel(source, x); } @@ -76,7 +76,7 @@ class CommandOSAKill : public Command sep.GetToken(mask); } - time_t expires = !expiry.empty() ? dotime(expiry) : Config->AutokillExpiry; + time_t expires = !expiry.empty() ? Anope::DoTime(expiry) : Config->AutokillExpiry; /* If the expiry given does not contain a final letter, it's in days, * said the doc. Ah well. */ @@ -127,7 +127,7 @@ class CommandOSAKill : public Command return; } - service_reference<RegexProvider> provider("Regex", Config->RegexEngine); + ServiceReference<RegexProvider> provider("Regex", Config->RegexEngine); if (!provider) { source.Reply(_("Unable to find regex engine %s"), Config->RegexEngine.c_str()); @@ -146,7 +146,7 @@ class CommandOSAKill : public Command } } - User *targ = finduser(mask); + User *targ = User::Find(mask, true); if (targ) mask = "*@" + targ->host; @@ -160,7 +160,7 @@ class CommandOSAKill : public Command XLine *x = new XLine(mask, source.GetNick(), expires, reason); if (Config->AkillIds) - x->UID = XLineManager::GenerateUID(); + x->id = XLineManager::GenerateUID(); unsigned int affected = 0; for (user_map::const_iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it) @@ -172,7 +172,7 @@ class CommandOSAKill : public Command { source.Reply(USERHOST_MASK_TOO_WIDE, mask.c_str()); Log(LOG_ADMIN, source, this) << "tried to akill " << percent << "% of the network (" << affected << " users)"; - x->destroy(); + x->Destroy(); return; } @@ -180,7 +180,7 @@ class CommandOSAKill : public Command FOREACH_RESULT(I_OnAddXLine, OnAddXLine(source, x, akills)); if (MOD_RESULT == EVENT_STOP) { - x->destroy(); + x->Destroy(); return; } @@ -190,8 +190,8 @@ class CommandOSAKill : public Command source.Reply(_("\002%s\002 added to the AKILL list."), mask.c_str()); - Log(LOG_ADMIN, source, this) << "on " << mask << " (" << x->Reason << ") expires in " << (expires ? duration(expires - Anope::CurTime) : "never") << " [affects " << affected << " user(s) (" << percent << "%)]"; - if (readonly) + Log(LOG_ADMIN, source, this) << "on " << mask << " (" << x->reason << ") expires in " << (expires ? Anope::Duration(expires - Anope::CurTime) : "never") << " [affects " << affected << " user(s) (" << percent << "%)]"; + if (Anope::ReadOnly) source.Reply(READ_ONLY_MODE); } @@ -230,14 +230,14 @@ class CommandOSAKill : public Command { FOREACH_MOD(I_OnDelXLine, OnDelXLine(source, x, akills)); - source.Reply(_("\002%s\002 deleted from the AKILL list."), x->Mask.c_str()); + source.Reply(_("\002%s\002 deleted from the AKILL list."), x->mask.c_str()); AkillDelCallback::DoDel(source, x); } while ((x = akills->HasEntry(mask))); } - if (readonly) + if (Anope::ReadOnly) source.Reply(READ_ONLY_MODE); return; @@ -269,12 +269,12 @@ class CommandOSAKill : public Command ListFormatter::ListEntry entry; entry["Number"] = stringify(number); - entry["Mask"] = x->Mask; - entry["Creator"] = x->By; - entry["Created"] = do_strftime(x->Created, NULL, true); - entry["Expires"] = expire_left(NULL, x->Expires); - entry["Reason"] = x->Reason; - this->list.addEntry(entry); + entry["Mask"] = x->mask; + entry["Creator"] = x->by; + entry["Created"] = Anope::strftime(x->created, NULL, true); + entry["Expires"] = Anope::Expires(x->expires); + entry["Reason"] = x->reason; + this->list.AddEntry(entry); } } nl_list(list, mask); @@ -286,21 +286,21 @@ class CommandOSAKill : public Command { const XLine *x = akills->GetEntry(i); - if (mask.empty() || mask.equals_ci(x->Mask) || mask == x->UID || Anope::Match(x->Mask, mask, false, true)) + if (mask.empty() || mask.equals_ci(x->mask) || mask == x->id || Anope::Match(x->mask, mask, false, true)) { ListFormatter::ListEntry entry; entry["Number"] = stringify(i + 1); - entry["Mask"] = x->Mask; - entry["Creator"] = x->By; - entry["Created"] = do_strftime(x->Created, NULL, true); - entry["Expires"] = expire_left(source.nc, x->Expires); - entry["Reason"] = x->Reason; - list.addEntry(entry); + entry["Mask"] = x->mask; + entry["Creator"] = x->by; + entry["Created"] = Anope::strftime(x->created, NULL, true); + entry["Expires"] = Anope::Expires(x->expires, source.nc); + entry["Reason"] = x->reason; + list.AddEntry(entry); } } } - if (list.isEmpty()) + if (list.IsEmpty()) source.Reply(_("No matching entries on the AKILL list.")); else { @@ -325,7 +325,7 @@ class CommandOSAKill : public Command } ListFormatter list; - list.addColumn("Number").addColumn("Mask").addColumn("Reason"); + list.AddColumn("Number").AddColumn("Mask").AddColumn("Reason"); this->ProcessList(source, params, list); } @@ -339,7 +339,7 @@ class CommandOSAKill : public Command } ListFormatter list; - list.addColumn("Number").addColumn("Mask").addColumn("Creator").addColumn("Created").addColumn("Expires").addColumn("Reason"); + list.AddColumn("Number").AddColumn("Mask").AddColumn("Creator").AddColumn("Created").AddColumn("Expires").AddColumn("Reason"); this->ProcessList(source, params, list); } diff --git a/modules/commands/os_chankill.cpp b/modules/commands/os_chankill.cpp index 456525a46..c1d71831b 100644 --- a/modules/commands/os_chankill.cpp +++ b/modules/commands/os_chankill.cpp @@ -13,7 +13,7 @@ #include "module.h" -static service_reference<XLineManager> akills("XLineManager", "xlinemanager/sgline"); +static ServiceReference<XLineManager> akills("XLineManager", "xlinemanager/sgline"); class CommandOSChanKill : public Command { @@ -42,7 +42,7 @@ class CommandOSChanKill : public Command last_param = 2; } - expires = !expiry.empty() ? dotime(expiry) : Config->ChankillExpiry; + expires = !expiry.empty() ? Anope::DoTime(expiry) : Config->ChankillExpiry; if (!expiry.empty() && isdigit(expiry[expiry.length() - 1])) expires *= 86400; if (expires && expires < 60) @@ -70,7 +70,7 @@ class CommandOSChanKill : public Command else realreason = reason; - if ((c = findchan(channel))) + if ((c = Channel::Find(channel))) { for (CUserList::iterator it = c->users.begin(), it_end = c->users.end(); it != it_end; ) { diff --git a/modules/commands/os_config.cpp b/modules/commands/os_config.cpp index 11437a087..61cda44c0 100644 --- a/modules/commands/os_config.cpp +++ b/modules/commands/os_config.cpp @@ -117,7 +117,7 @@ class CommandOSConfig : public Command } case DT_TIME: { - time_t time = dotime(vi.GetValue()); + time_t time = Anope::DoTime(vi.GetValue()); ValueContainerTime *vci = anope_dynamic_static_cast<ValueContainerTime *>(v->val); vci->Set(&time, sizeof(time_t)); break; @@ -169,7 +169,7 @@ class CommandOSConfig : public Command continue; ListFormatter lflist; - lflist.addColumn("Name").addColumn("Value"); + lflist.AddColumn("Name").AddColumn("Value"); for (unsigned i = 0; i < list.size(); ++i) { const Anope::string &first = list[i].first, second = list[i].second; @@ -177,7 +177,7 @@ class CommandOSConfig : public Command ListFormatter::ListEntry entry; entry["Name"] = first; entry["Value"] = second; - lflist.addEntry(entry); + lflist.AddEntry(entry); } std::vector<Anope::string> replies; diff --git a/modules/commands/os_defcon.cpp b/modules/commands/os_defcon.cpp index ad08ba77c..1457a57dc 100644 --- a/modules/commands/os_defcon.cpp +++ b/modules/commands/os_defcon.cpp @@ -34,8 +34,8 @@ bool DefConModesSet = false; struct DefconConfig { std::vector<std::bitset<32> > DefCon; - Flags<ChannelModeName, CMODE_END * 2> DefConModesOn; - Flags<ChannelModeName, CMODE_END * 2> DefConModesOff; + Flags<ChannelModeName> DefConModesOn; + Flags<ChannelModeName> DefConModesOff; std::map<ChannelModeName, Anope::string> DefConModesOnParams; int defaultlevel, sessionlimit; @@ -117,17 +117,17 @@ class DefConTimeout : public CallBack { DConfig.defaultlevel = level; FOREACH_MOD(I_OnDefconLevel, OnDefconLevel(level)); - Log(findbot(Config->OperServ), "operserv/defcon") << "Defcon level timeout, returning to level " << level; + Log(OperServ, "operserv/defcon") << "Defcon level timeout, returning to level " << level; if (DConfig.globalondefcon) { if (!DConfig.offmessage.empty()) - global->SendGlobal(findbot(Config->Global), "", DConfig.offmessage); + GlobalService->SendGlobal(Global, "", DConfig.offmessage); else - global->SendGlobal(findbot(Config->Global), "", Anope::printf(translate(_("The Defcon Level is now at Level: \002%d\002")), DConfig.defaultlevel)); + GlobalService->SendGlobal(Global, "", Anope::printf(Language::Translate(_("The Defcon Level is now at Level: \002%d\002")), DConfig.defaultlevel)); if (!DConfig.message.empty()) - global->SendGlobal(findbot(Config->Global), "", DConfig.message); + GlobalService->SendGlobal(Global, "", DConfig.message); } runDefCon(); @@ -215,12 +215,12 @@ class CommandOSDefcon : public Command if (DConfig.globalondefcon) { if (DConfig.defaultlevel == 5 && !DConfig.offmessage.empty()) - global->SendGlobal(findbot(Config->Global), "", DConfig.offmessage); + GlobalService->SendGlobal(Global, "", DConfig.offmessage); else if (DConfig.defaultlevel != 5) { - global->SendGlobal(findbot(Config->Global), "", Anope::printf(_("The Defcon level is now at: \002%d\002"), DConfig.defaultlevel)); + GlobalService->SendGlobal(Global, "", Anope::printf(_("The Defcon level is now at: \002%d\002"), DConfig.defaultlevel)); if (!DConfig.message.empty()) - global->SendGlobal(findbot(Config->Global), "", DConfig.message); + GlobalService->SendGlobal(Global, "", DConfig.message); } } @@ -242,8 +242,8 @@ class CommandOSDefcon : public Command class OSDefcon : public Module { - service_reference<SessionService> session_service; - service_reference<XLineManager> akills; + ServiceReference<SessionService> session_service; + ServiceReference<XLineManager> akills; CommandOSDefcon commandosdefcon; void ParseModeString() @@ -280,17 +280,17 @@ class OSDefcon : public Module if ((cm = ModeManager::FindChannelModeByChar(mode))) { - if (cm->Type == MODE_STATUS || cm->Type == MODE_LIST || !cm->CanSet(NULL)) + if (cm->type == MODE_STATUS || cm->type == MODE_LIST || !cm->CanSet(NULL)) { Log(this) << "DefConChanModes mode character '" << mode << "' cannot be locked"; continue; } else if (add) { - DConfig.DefConModesOn.SetFlag(cm->Name); - DConfig.DefConModesOff.UnsetFlag(cm->Name); + DConfig.DefConModesOn.SetFlag(cm->name); + DConfig.DefConModesOff.UnsetFlag(cm->name); - if (cm->Type == MODE_PARAM) + if (cm->type == MODE_PARAM) { cmp = anope_dynamic_static_cast<ChannelModeParam *>(cm); @@ -303,21 +303,21 @@ class OSDefcon : public Module if (!cmp->IsValid(param)) continue; - DConfig.SetDefConParam(cmp->Name, param); + DConfig.SetDefConParam(cmp->name, param); } } - else if (DConfig.DefConModesOn.HasFlag(cm->Name)) + else if (DConfig.DefConModesOn.HasFlag(cm->name)) { - DConfig.DefConModesOn.UnsetFlag(cm->Name); + DConfig.DefConModesOn.UnsetFlag(cm->name); - if (cm->Type == MODE_PARAM) - DConfig.UnsetDefConParam(cm->Name); + if (cm->type == MODE_PARAM) + DConfig.UnsetDefConParam(cm->name); } } } /* We can't mlock +L if +l is not mlocked as well. */ - if ((cm = ModeManager::FindChannelModeByName(CMODE_REDIRECT)) && DConfig.DefConModesOn.HasFlag(cm->Name) && !DConfig.DefConModesOn.HasFlag(CMODE_LIMIT)) + if ((cm = ModeManager::FindChannelModeByName(CMODE_REDIRECT)) && DConfig.DefConModesOn.HasFlag(cm->name) && !DConfig.DefConModesOn.HasFlag(CMODE_LIMIT)) { DConfig.DefConModesOn.UnsetFlag(CMODE_REDIRECT); @@ -356,9 +356,9 @@ class OSDefcon : public Module dconfig.defcons[1] = config.ReadValue("defcon", "level1", 0); dconfig.sessionlimit = config.ReadInteger("defcon", "sessionlimit", 0, 0); dconfig.akillreason = config.ReadValue("defcon", "akillreason", 0); - dconfig.akillexpire = dotime(config.ReadValue("defcon", "akillexpire", 0)); + dconfig.akillexpire = Anope::DoTime(config.ReadValue("defcon", "akillexpire", 0)); dconfig.chanmodes = config.ReadValue("defcon", "chanmodes", 0); - dconfig.timeout = dotime(config.ReadValue("defcon", "timeout", 0)); + dconfig.timeout = Anope::DoTime(config.ReadValue("defcon", "timeout", 0)); dconfig.globalondefcon = config.ReadFlag("defcon", "globalondefcon", 0); dconfig.message = config.ReadValue("defcon", "message", 0); dconfig.offmessage = config.ReadValue("defcon", "offmessage", 0); @@ -414,9 +414,9 @@ class OSDefcon : public Module { if (DConfig.Check(DEFCON_AKILL_NEW_CLIENTS) && akills) { - Log(findbot(Config->OperServ), "operserv/defcon") << "DEFCON: adding akill for *@" << u->host; + Log(OperServ, "operserv/defcon") << "DEFCON: adding akill for *@" << u->host; XLine *x = new XLine("*@" + u->host, Config->OperServ, Anope::CurTime + DConfig.akillexpire, DConfig.akillreason, XLineManager::GenerateUID()); - x->By = Config->OperServ; + x->by = Config->OperServ; akills->AddXLine(x); } @@ -435,7 +435,7 @@ class OSDefcon : public Module if (DConfig.Check(DEFCON_FORCE_CHAN_MODES) && cm && DConfig.DefConModesOff.HasFlag(Name)) { - c->RemoveMode(findbot(Config->OperServ), Name, param); + c->RemoveMode(OperServ, Name, param); return EVENT_STOP; } @@ -452,9 +452,9 @@ class OSDefcon : public Module Anope::string param; if (DConfig.GetDefConParam(Name, param)) - c->SetMode(findbot(Config->OperServ), Name, param); + c->SetMode(OperServ, Name, param); else - c->SetMode(findbot(Config->OperServ), Name); + c->SetMode(OperServ, Name); return EVENT_STOP; @@ -501,16 +501,16 @@ class OSDefcon : public Module return EVENT_CONTINUE; } - void OnUserConnect(dynamic_reference<User> &u, bool &exempt) anope_override + void OnUserConnect(Reference<User> &u, bool &exempt) anope_override { if (exempt || !u || !u->server->IsSynced() || u->server->IsULined()) return; if (DConfig.Check(DEFCON_AKILL_NEW_CLIENTS) && akills) { - Log(findbot(Config->OperServ), "operserv/defcon") << "DEFCON: adding akill for *@" << u->host; + Log(OperServ, "operserv/defcon") << "DEFCON: adding akill for *@" << u->host; XLine x("*@" + u->host, Config->OperServ, Anope::CurTime + DConfig.akillexpire, DConfig.akillreason, XLineManager::GenerateUID()); - x.By = Config->OperServ; + x.by = Config->OperServ; akills->Send(NULL, &x); } if (DConfig.Check(DEFCON_NO_NEW_CLIENTS) || DConfig.Check(DEFCON_AKILL_NEW_CLIENTS)) @@ -525,7 +525,7 @@ class OSDefcon : public Module return; } - if (!DConfig.sessionlimit || !session_service) + if (DConfig.sessionlimit <= 0 || !session_service) return; Session *session; @@ -541,19 +541,19 @@ class OSDefcon : public Module if (DConfig.Check(DEFCON_REDUCE_SESSION) && !exception) { - if (session && session->count > DConfig.sessionlimit) + if (session && session->count > static_cast<unsigned>(DConfig.sessionlimit)) { if (!Config->SessionLimitExceeded.empty()) - ircdproto->SendMessage(findbot(Config->OperServ), u->nick, Config->SessionLimitExceeded.c_str(), u->host.c_str()); + IRCD->SendMessage(OperServ, u->nick, Config->SessionLimitExceeded.c_str(), u->host.c_str()); if (!Config->SessionLimitDetailsLoc.empty()) - ircdproto->SendMessage(findbot(Config->OperServ), u->nick, "%s", Config->SessionLimitDetailsLoc.c_str()); + IRCD->SendMessage(OperServ, u->nick, "%s", Config->SessionLimitDetailsLoc.c_str()); ++session->hits; if (akills && Config->MaxSessionKill && session->hits >= Config->MaxSessionKill) { XLine x("*@" + u->host, Config->OperServ, Anope::CurTime + Config->SessionAutoKillExpiry, "Defcon session limit exceeded", XLineManager::GenerateUID()); akills->Send(NULL, &x); - Log(findbot(Config->OperServ), "akill/defcon") << "[DEFCON] Added a temporary AKILL for \2*@" << u->host << "\2 due to excessive connections"; + Log(OperServ, "akill/defcon") << "[DEFCON] Added a temporary AKILL for \2*@" << u->host << "\2 due to excessive connections"; } else { @@ -566,14 +566,14 @@ class OSDefcon : public Module void OnChannelModeAdd(ChannelMode *cm) anope_override { - if (DConfig.chanmodes.find(cm->ModeChar) != Anope::string::npos) + if (DConfig.chanmodes.find(cm->mchar) != Anope::string::npos) this->ParseModeString(); } void OnChannelCreate(Channel *c) anope_override { if (DConfig.Check(DEFCON_FORCE_CHAN_MODES)) - c->SetModes(findbot(Config->OperServ), false, "%s", DConfig.chanmodes.c_str()); + c->SetModes(OperServ, false, "%s", DConfig.chanmodes.c_str()); } }; @@ -612,10 +612,10 @@ void runDefCon() { if (DConfig.chanmodes[0] == '+' || DConfig.chanmodes[0] == '-') { - Log(findbot(Config->OperServ), "operserv/defcon") << "DEFCON: setting " << DConfig.chanmodes << " on all channels"; + Log(OperServ, "operserv/defcon") << "DEFCON: setting " << DConfig.chanmodes << " on all channels"; DefConModesSet = true; for (channel_map::const_iterator it = ChannelList.begin(), it_end = ChannelList.end(); it != it_end; ++it) - it->second->SetModes(findbot(Config->OperServ), false, "%s", DConfig.chanmodes.c_str()); + it->second->SetModes(OperServ, false, "%s", DConfig.chanmodes.c_str()); } } } @@ -629,9 +629,9 @@ void runDefCon() Anope::string newmodes = defconReverseModes(DConfig.chanmodes); if (!newmodes.empty()) { - Log(findbot(Config->OperServ), "operserv/defcon") << "DEFCON: setting " << newmodes << " on all channels"; + Log(OperServ, "operserv/defcon") << "DEFCON: setting " << newmodes << " on all channels"; for (channel_map::const_iterator it = ChannelList.begin(), it_end = ChannelList.end(); it != it_end; ++it) - it->second->SetModes(findbot(Config->OperServ), false, "%s", newmodes.c_str()); + it->second->SetModes(OperServ, false, "%s", newmodes.c_str()); } } } diff --git a/modules/commands/os_dns.cpp b/modules/commands/os_dns.cpp index e304050b3..769a42f26 100644 --- a/modules/commands/os_dns.cpp +++ b/modules/commands/os_dns.cpp @@ -44,12 +44,12 @@ class DNSServer : public Serializable void Pool(bool p) { pooled = p; - if (DNSEngine) - DNSEngine->UpdateSerial(); + if (DNS::Engine) + DNS::Engine->UpdateSerial(); } - Serialize::Data serialize() const anope_override + Serialize::Data Serialize() const anope_override { Serialize::Data data; @@ -62,7 +62,7 @@ class DNSServer : public Serializable return data; } - static Serializable* unserialize(Serializable *obj, Serialize::Data &data) + static Serializable* Unserialize(Serializable *obj, Serialize::Data &data) { DNSServer *req; @@ -104,7 +104,7 @@ class CommandOSDNS : public Command } ListFormatter lf; - lf.addColumn("Server").addColumn("IP").addColumn("Limit").addColumn("State"); + lf.AddColumn("Server").AddColumn("IP").AddColumn("Limit").AddColumn("State"); for (unsigned i = 0; i < dns_servers.size(); ++i) { DNSServer *s = dns_servers[i]; @@ -129,7 +129,7 @@ class CommandOSDNS : public Command else entry["State"] = "Unpooled"; - lf.addEntry(entry); + lf.AddEntry(entry); } std::vector<Anope::string> replies; @@ -221,7 +221,7 @@ class CommandOSDNS : public Command Log(LOG_ADMIN, source, this) << "to add IP " << params[2] << " to " << s->GetName(); if (s->Pooled()) - DNSEngine->UpdateSerial(); + DNS::Engine->UpdateSerial(); } void DelIP(CommandSource &source, const std::vector<Anope::string> ¶ms) @@ -248,7 +248,7 @@ class CommandOSDNS : public Command } if (s->Pooled()) - DNSEngine->UpdateSerial(); + DNS::Engine->UpdateSerial(); return; } @@ -388,7 +388,7 @@ class CommandOSDNS : public Command class ModuleDNS : public Module { - SerializeType dns_type; + Serialize::Type dns_type; CommandOSDNS commandosdns; time_t ttl; @@ -400,7 +400,7 @@ class ModuleDNS : public Module public: ModuleDNS(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, SUPPORTED), - dns_type("DNSServer", DNSServer::unserialize), commandosdns(this) + dns_type("DNSServer", DNSServer::Unserialize), commandosdns(this) { this->SetAuthor("Anope"); @@ -414,10 +414,10 @@ class ModuleDNS : public Module { ConfigReader config; - this->ttl = dotime(config.ReadValue("os_dns", "ttl", 0)); + this->ttl = Anope::DoTime(config.ReadValue("os_dns", "ttl", 0)); this->user_drop_mark = config.ReadInteger("os_dns", "user_drop_mark", 0, false); - this->user_drop_time = dotime(config.ReadValue("os_dns", "user_drop_time", 0, false)); - this->user_drop_readd_time = dotime(config.ReadValue("os_dns", "user_drop_readd_time", 0, false)); + this->user_drop_time = Anope::DoTime(config.ReadValue("os_dns", "user_drop_time", 0, false)); + this->user_drop_readd_time = Anope::DoTime(config.ReadValue("os_dns", "user_drop_readd_time", 0, false)); this->remove_split_servers = config.ReadFlag("os_dns", "remove_split_servers", 0); this->readd_connected_servers = config.ReadFlag("os_dns", "readd_connected_servers", 0); } @@ -427,7 +427,7 @@ class ModuleDNS : public Module if (this->readd_connected_servers) { DNSServer *dns = DNSServer::Find(s->GetName()); - if (dns && !dns->Pooled() && !dns->GetIPs().empty() && dns->GetLimit() < s->Users) + if (dns && !dns->Pooled() && !dns->GetIPs().empty() && dns->GetLimit() < s->users) { dns->Pool(true); Log(this) << "Pooling server " << s->GetName(); @@ -446,15 +446,15 @@ class ModuleDNS : public Module } } - void OnUserConnect(dynamic_reference<User> &u, bool &exempt) anope_override + void OnUserConnect(Reference<User> &u, bool &exempt) anope_override { if (u && u->server) { DNSServer *s = DNSServer::Find(u->server->GetName()); /* Check for user limit reached */ - if (s && s->GetLimit() && s->Pooled() && u->server->Users >= s->GetLimit()) + if (s && s->GetLimit() && s->Pooled() && u->server->users >= s->GetLimit()) { - Log(this) << "Depooling full server " << s->GetName() << ": " << u->server->Users << " users"; + Log(this) << "Depooling full server " << s->GetName() << ": " << u->server->users << " users"; s->Pool(false); } } @@ -469,7 +469,7 @@ class ModuleDNS : public Module return; /* Check for dropping under userlimit */ - if (s->GetLimit() && !s->Pooled() && s->GetLimit() > u->server->Users) + if (s->GetLimit() && !s->Pooled() && s->GetLimit() > u->server->users) { Log(this) << "Pooling server " << s->GetName(); s->Pool(true); @@ -505,13 +505,13 @@ class ModuleDNS : public Module } } - void OnDnsRequest(DNSPacket &req, DNSPacket *packet) anope_override + void OnDnsRequest(DNS::Packet &req, DNS::Packet *packet) anope_override { if (req.questions.empty()) return; /* Currently we reply to any QR for A/AAAA */ - const Question& q = req.questions[0]; - if (q.type != DNS_QUERY_A && q.type != DNS_QUERY_AAAA && q.type != DNS_QUERY_AXFR) + const DNS::Question& q = req.questions[0]; + if (q.type != DNS::QUERY_A && q.type != DNS::QUERY_AAAA && q.type != DNS::QUERY_AXFR) return; for (unsigned i = 0; i < dns_servers.size(); ++i) @@ -522,11 +522,11 @@ class ModuleDNS : public Module for (unsigned j = 0; j < s->GetIPs().size(); ++j) { - QueryType q_type = s->GetIPs()[j].find(':') != Anope::string::npos ? DNS_QUERY_AAAA : DNS_QUERY_A; + DNS::QueryType q_type = s->GetIPs()[j].find(':') != Anope::string::npos ? DNS::QUERY_AAAA : DNS::QUERY_A; - if (q.type == DNS_QUERY_AXFR || q_type == q.type) + if (q.type == DNS::QUERY_AXFR || q_type == q.type) { - ResourceRecord rr(q.name, q_type); + DNS::ResourceRecord rr(q.name, q_type); rr.ttl = this->ttl; rr.rdata = s->GetIPs()[j]; packet->answers.push_back(rr); @@ -550,11 +550,11 @@ class ModuleDNS : public Module for (unsigned j = 0; j < s->GetIPs().size(); ++j) { - QueryType q_type = s->GetIPs()[j].find(':') != Anope::string::npos ? DNS_QUERY_AAAA : DNS_QUERY_A; + DNS::QueryType q_type = s->GetIPs()[j].find(':') != Anope::string::npos ? DNS::QUERY_AAAA : DNS::QUERY_A; - if (q.type == DNS_QUERY_AXFR || q_type == q.type) + if (q.type == DNS::QUERY_AXFR || q_type == q.type) { - ResourceRecord rr(q.name, q_type); + DNS::ResourceRecord rr(q.name, q_type); rr.ttl = this->ttl; rr.rdata = s->GetIPs()[j]; packet->answers.push_back(rr); diff --git a/modules/commands/os_forbid.cpp b/modules/commands/os_forbid.cpp index 31ca94265..08710b223 100644 --- a/modules/commands/os_forbid.cpp +++ b/modules/commands/os_forbid.cpp @@ -31,7 +31,7 @@ class MyForbidService : public ForbidService std::vector<ForbidData *>::iterator it = std::find(this->forbidData.begin(), this->forbidData.end(), d); if (it != this->forbidData.end()) this->forbidData.erase(it); - d->destroy(); + d->Destroy(); } ForbidData *FindForbid(const Anope::string &mask, ForbidType ftype) anope_override @@ -65,7 +65,7 @@ class MyForbidService : public ForbidService Log(LOG_NORMAL, "expire/forbid") << "Expiring forbid for " << d->mask << " type " << ftype; this->forbidData.erase(this->forbidData.begin() + i - 1); - d->destroy(); + d->Destroy(); } } @@ -75,7 +75,7 @@ class MyForbidService : public ForbidService class CommandOSForbid : public Command { - service_reference<ForbidService> fs; + ServiceReference<ForbidService> fs; public: CommandOSForbid(Module *creator) : Command(creator, "operserv/forbid", 1, 5), fs("ForbidService", "forbid") { @@ -122,12 +122,12 @@ class CommandOSForbid : public Command if (!expiry.empty()) { - expiryt = dotime(expiry); + expiryt = Anope::DoTime(expiry); if (expiryt) expiryt += Anope::CurTime; } - NickAlias *target = findnick(entry); + NickAlias *target = NickAlias::Find(entry); if (target != NULL && Config->NSSecureAdmins && target->nc->IsServicesOper()) { source.Reply(ACCESS_DENIED); @@ -152,7 +152,7 @@ class CommandOSForbid : public Command this->fs->AddForbid(d); Log(LOG_ADMIN, source, this) << "to add a forbid on " << entry << " of type " << subcommand; - source.Reply(_("Added a%s forbid on %s to expire on %s"), ftype == FT_CHAN ? "n" : "", entry.c_str(), d->expires ? do_strftime(d->expires).c_str() : "never"); + source.Reply(_("Added a%s forbid on %s to expire on %s"), ftype == FT_CHAN ? "n" : "", entry.c_str(), d->expires ? Anope::strftime(d->expires).c_str() : "never"); } else if (command.equals_ci("DEL") && params.size() > 2 && ftype != FT_NONE) { @@ -176,7 +176,7 @@ class CommandOSForbid : public Command else { ListFormatter list; - list.addColumn("Mask").addColumn("Type").addColumn("Reason"); + list.AddColumn("Mask").AddColumn("Type").AddColumn("Reason"); for (unsigned i = 0; i < forbids.size(); ++i) { @@ -196,9 +196,9 @@ class CommandOSForbid : public Command entry["Mask"] = d->mask; entry["Type"] = stype; entry["Creator"] = d->creator; - entry["Expires"] = d->expires ? do_strftime(d->expires).c_str() : "never"; + entry["Expires"] = d->expires ? Anope::strftime(d->expires).c_str() : "never"; entry["Reason"] = d->reason; - list.addEntry(entry); + list.AddEntry(entry); } source.Reply(_("Forbid list:")); @@ -234,13 +234,13 @@ class CommandOSForbid : public Command class OSForbid : public Module { - SerializeType forbiddata_type; + Serialize::Type forbiddata_type; MyForbidService forbidService; CommandOSForbid commandosforbid; public: OSForbid(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), - forbiddata_type("ForbidData", ForbidData::unserialize), forbidService(this), commandosforbid(this) + forbiddata_type("ForbidData", ForbidData::Unserialize), forbidService(this), commandosforbid(this) { this->SetAuthor("Anope"); @@ -248,7 +248,7 @@ class OSForbid : public Module ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation)); } - void OnUserConnect(dynamic_reference<User> &u, bool &exempt) anope_override + void OnUserConnect(Reference<User> &u, bool &exempt) anope_override { if (!u || exempt) return; @@ -264,13 +264,12 @@ class OSForbid : public Module ForbidData *d = this->forbidService.FindForbid(u->nick, FT_NICK); if (d != NULL) { - const BotInfo *bi = findbot(Config->OperServ); - if (bi) + if (OperServ) { if (d->reason.empty()) - u->SendMessage(bi, _("This nickname has been forbidden.")); + u->SendMessage(OperServ, _("This nickname has been forbidden.")); else - u->SendMessage(bi, _("This nickname has been forbidden: %s"), d->reason.c_str()); + u->SendMessage(OperServ, _("This nickname has been forbidden: %s"), d->reason.c_str()); } u->Collide(NULL); } @@ -278,17 +277,16 @@ class OSForbid : public Module void OnJoinChannel(User *u, Channel *c) anope_override { - if (u->HasMode(UMODE_OPER)) + if (u->HasMode(UMODE_OPER) || !OperServ) return; - BotInfo *bi = findbot(Config->OperServ); ForbidData *d = this->forbidService.FindForbid(c->name, FT_CHAN); - if (bi != NULL && d != NULL) + if (d != NULL) { - if (ircdproto->CanSQLineChannel) + if (IRCD->CanSQLineChannel) { - XLine x(c->name, bi->nick, Anope::CurTime + Config->CSInhabit, d->reason); - ircdproto->SendSQLine(NULL, &x); + XLine x(c->name, OperServ->nick, Anope::CurTime + Config->CSInhabit, d->reason); + IRCD->SendSQLine(NULL, &x); } else if (!c->HasFlag(CH_INHABIT)) { @@ -303,9 +301,9 @@ class OSForbid : public Module } if (d->reason.empty()) - c->Kick(bi, u, _("This channel has been forbidden.")); + c->Kick(OperServ, u, _("This channel has been forbidden.")); else - c->Kick(bi, u, _("This channel has been forbidden: %s"), d->reason.c_str()); + c->Kick(OperServ, u, _("This channel has been forbidden: %s"), d->reason.c_str()); } } diff --git a/modules/commands/os_forbid.h b/modules/commands/os_forbid.h index f79b63616..1fce928db 100644 --- a/modules/commands/os_forbid.h +++ b/modules/commands/os_forbid.h @@ -19,8 +19,8 @@ struct ForbidData : Serializable ForbidType type; ForbidData() : Serializable("ForbidData") { } - Serialize::Data serialize() const anope_override; - static Serializable* unserialize(Serializable *obj, Serialize::Data &data); + Serialize::Data Serialize() const anope_override; + static Serializable* Unserialize(Serializable *obj, Serialize::Data &data); }; class ForbidService : public Service @@ -37,9 +37,9 @@ class ForbidService : public Service virtual const std::vector<ForbidData *> &GetForbids() = 0; }; -static service_reference<ForbidService> forbid_service("ForbidService", "forbid"); +static ServiceReference<ForbidService> forbid_service("ForbidService", "forbid"); -Serialize::Data ForbidData::serialize() const +Serialize::Data ForbidData::Serialize() const { Serialize::Data data; @@ -53,7 +53,7 @@ Serialize::Data ForbidData::serialize() const return data; } -Serializable* ForbidData::unserialize(Serializable *obj, Serialize::Data &data) +Serializable* ForbidData::Unserialize(Serializable *obj, Serialize::Data &data) { if (!forbid_service) return NULL; diff --git a/modules/commands/os_ignore.cpp b/modules/commands/os_ignore.cpp index 2377c28be..f959e7ebc 100644 --- a/modules/commands/os_ignore.cpp +++ b/modules/commands/os_ignore.cpp @@ -25,7 +25,7 @@ class OSIgnoreService : public IgnoreService Anope::string realmask = mask; size_t user, host; - User *u = finduser(mask); + User *u = User::Find(mask, true); if (u) realmask = "*!*@" + u->host; /* Determine whether we get a nick or a mask. */ @@ -86,7 +86,7 @@ class OSIgnoreService : public IgnoreService IgnoreData *Find(const Anope::string &mask) anope_override { - User *u = finduser(mask); + User *u = User::Find(mask, true); std::list<IgnoreData>::iterator ign = this->ignores.begin(), ign_end = this->ignores.end(); if (u) @@ -162,7 +162,7 @@ class CommandOSIgnore : public Command } else { - time_t t = dotime(time); + time_t t = Anope::DoTime(time); if (t <= -1) { @@ -205,7 +205,7 @@ class CommandOSIgnore : public Command else { ListFormatter list; - list.addColumn("Mask").addColumn("Creator").addColumn("Reason").addColumn("Expires"); + list.AddColumn("Mask").AddColumn("Creator").AddColumn("Reason").AddColumn("Expires"); for (std::list<IgnoreData>::const_iterator ign = ignores.begin(), ign_end = ignores.end(); ign != ign_end; ++ign) { const IgnoreData &ignore = *ign; @@ -214,8 +214,8 @@ class CommandOSIgnore : public Command entry["Mask"] = ignore.mask; entry["Creator"] = ignore.creator; entry["Reason"] = ignore.reason; - entry["Expires"] = do_strftime(ignore.time); - list.addEntry(entry); + entry["Expires"] = Anope::strftime(ignore.time); + list.AddEntry(entry); } source.Reply(_("Services ignore list:")); @@ -309,17 +309,16 @@ class CommandOSIgnore : public Command class OSIgnore : public Module { - SerializeType ignoredata_type; + Serialize::Type ignoredata_type; OSIgnoreService osignoreservice; CommandOSIgnore commandosignore; public: OSIgnore(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), - ignoredata_type("IgnoreData", IgnoreData::unserialize), osignoreservice(this), commandosignore(this) + ignoredata_type("IgnoreData", IgnoreData::Unserialize), osignoreservice(this), commandosignore(this) { this->SetAuthor("Anope"); - Implementation i[] = { I_OnBotPrivmsg }; ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation)); } diff --git a/modules/commands/os_ignore.h b/modules/commands/os_ignore.h index 38042a72d..003d88b5b 100644 --- a/modules/commands/os_ignore.h +++ b/modules/commands/os_ignore.h @@ -18,8 +18,8 @@ struct IgnoreData : Serializable time_t time; /* When do we stop ignoring them? */ IgnoreData() : Serializable("IgnoreData") { } - Serialize::Data serialize() const anope_override; - static Serializable* unserialize(Serializable *obj, Serialize::Data &data); + Serialize::Data Serialize() const anope_override; + static Serializable* Unserialize(Serializable *obj, Serialize::Data &data); }; class IgnoreService : public Service @@ -41,9 +41,9 @@ class IgnoreService : public Service inline std::list<IgnoreData> &GetIgnores() { return this->ignores; } }; -static service_reference<IgnoreService> ignore_service("IgnoreService", "ignore"); +static ServiceReference<IgnoreService> ignore_service("IgnoreService", "ignore"); -Serialize::Data IgnoreData::serialize() const +Serialize::Data IgnoreData::Serialize() const { Serialize::Data data; @@ -55,7 +55,7 @@ Serialize::Data IgnoreData::serialize() const return data; } -Serializable* IgnoreData::unserialize(Serializable *obj, Serialize::Data &data) +Serializable* IgnoreData::Unserialize(Serializable *obj, Serialize::Data &data) { if (!ignore_service) return NULL; diff --git a/modules/commands/os_jupe.cpp b/modules/commands/os_jupe.cpp index cfe917c13..49095129c 100644 --- a/modules/commands/os_jupe.cpp +++ b/modules/commands/os_jupe.cpp @@ -28,7 +28,7 @@ class CommandOSJupe : public Command const Anope::string &reason = params.size() > 1 ? params[1] : ""; Server *server = Server::Find(jserver); - if (!IsValidHost(jserver) || jserver.find('.') == Anope::string::npos) + if (!IRCD->IsHostValid(jserver) || jserver.find('.') == Anope::string::npos) source.Reply(_("Please use a valid server name when juping")); else if (server && (server == Me || server == Me->GetLinks().front())) source.Reply(_("You can not jupe your services server or your uplink server.")); @@ -36,9 +36,9 @@ class CommandOSJupe : public Command { Anope::string rbuf = "Juped by " + source.GetNick() + (!reason.empty() ? ": " + reason : ""); if (server) - ircdproto->SendSquit(server, rbuf); - Server *juped_server = new Server(Me, jserver, 1, rbuf, ts6_sid_retrieve(), SERVER_JUPED); - ircdproto->SendServer(juped_server); + IRCD->SendSquit(server, rbuf); + Server *juped_server = new Server(Me, jserver, 1, rbuf, Servers::TS6_SID_Retrieve(), SERVER_JUPED); + IRCD->SendServer(juped_server); Log(LOG_ADMIN, source, this) << "on " << jserver << " (" << rbuf << ")"; } diff --git a/modules/commands/os_kick.cpp b/modules/commands/os_kick.cpp index 0a5165621..5f33a4bbc 100644 --- a/modules/commands/os_kick.cpp +++ b/modules/commands/os_kick.cpp @@ -30,7 +30,7 @@ class CommandOSKick : public Command Channel *c; User *u2; - if (!(c = findchan(chan))) + if (!(c = Channel::Find(chan))) { source.Reply(CHAN_X_NOT_IN_USE, chan.c_str()); return; @@ -40,7 +40,7 @@ class CommandOSKick : public Command source.Reply(_("Services is unable to change modes. Are your servers' U:lines configured correctly?")); return; } - else if (!(u2 = finduser(nick))) + else if (!(u2 = User::Find(nick, true))) { source.Reply(NICK_X_NOT_IN_USE, nick.c_str()); return; diff --git a/modules/commands/os_kill.cpp b/modules/commands/os_kill.cpp index e7f78b1b5..83cd81f58 100644 --- a/modules/commands/os_kill.cpp +++ b/modules/commands/os_kill.cpp @@ -27,7 +27,7 @@ class CommandOSKill : public Command const Anope::string &nick = params[0]; Anope::string reason = params.size() > 1 ? params[1] : ""; - User *u2 = finduser(nick); + User *u2 = User::Find(nick, true); if (u2 == NULL) source.Reply(NICK_X_NOT_IN_USE, nick.c_str()); else if (u2->IsProtected() || u2->server == Me) diff --git a/modules/commands/os_list.cpp b/modules/commands/os_list.cpp index 0272742c1..dfb0c00c8 100644 --- a/modules/commands/os_list.cpp +++ b/modules/commands/os_list.cpp @@ -36,9 +36,9 @@ class CommandOSChanList : public Command } ListFormatter list; - list.addColumn("Name").addColumn("Users").addColumn("Modes").addColumn("Topic"); + list.AddColumn("Name").AddColumn("Users").AddColumn("Modes").AddColumn("Topic"); - if (!pattern.empty() && (u2 = finduser(pattern))) + if (!pattern.empty() && (u2 = User::Find(pattern, true))) { source.Reply(_("\002%s\002 channel list:"), u2->nick.c_str()); @@ -56,7 +56,7 @@ class CommandOSChanList : public Command entry["Users"] = stringify(cc->chan->users.size()); entry["Modes"] = cc->chan->GetModes(true, true); entry["Topic"] = cc->chan->topic; - list.addEntry(entry); + list.AddEntry(entry); } } else @@ -79,7 +79,7 @@ class CommandOSChanList : public Command entry["Users"] = stringify(c->users.size()); entry["Modes"] = c->GetModes(true, true); entry["Topic"] = c->topic; - list.addEntry(entry); + list.AddEntry(entry); } } @@ -130,9 +130,9 @@ class CommandOSUserList : public Command Modes.push_back(UMODE_INVIS); ListFormatter list; - list.addColumn("Name").addColumn("Mask"); + list.AddColumn("Name").AddColumn("Mask"); - if (!pattern.empty() && (c = findchan(pattern))) + if (!pattern.empty() && (c = Channel::Find(pattern))) { source.Reply(_("\002%s\002 users list:"), pattern.c_str()); @@ -148,7 +148,7 @@ class CommandOSUserList : public Command ListFormatter::ListEntry entry; entry["Name"] = uc->user->nick; entry["Mask"] = uc->user->GetIdent() + "@" + uc->user->GetDisplayedHost(); - list.addEntry(entry); + list.AddEntry(entry); } } else @@ -178,7 +178,7 @@ class CommandOSUserList : public Command ListFormatter::ListEntry entry; entry["Name"] = u2->nick; entry["Mask"] = u2->GetIdent() + "@" + u2->GetDisplayedHost(); - list.addEntry(entry); + list.AddEntry(entry); } } diff --git a/modules/commands/os_login.cpp b/modules/commands/os_login.cpp index 7b223eb1f..735562819 100644 --- a/modules/commands/os_login.cpp +++ b/modules/commands/os_login.cpp @@ -41,7 +41,7 @@ class CommandOSLogin : public Command else if (o->password != password) { source.Reply(PASSWORD_INCORRECT); - bad_password(u); + u->BadPassword(); } else { diff --git a/modules/commands/os_logsearch.cpp b/modules/commands/os_logsearch.cpp index 12431798c..7ad806330 100644 --- a/modules/commands/os_logsearch.cpp +++ b/modules/commands/os_logsearch.cpp @@ -23,7 +23,7 @@ class CommandOSLogSearch : public Command strftime(timestamp, sizeof(timestamp), "%Y%m%d", tm); - return log_dir + "/" + file + "." + timestamp; + return Anope::LogDir + "/" + file + "." + timestamp; } public: diff --git a/modules/commands/os_mode.cpp b/modules/commands/os_mode.cpp index 419fc8442..676ef7ea5 100644 --- a/modules/commands/os_mode.cpp +++ b/modules/commands/os_mode.cpp @@ -27,7 +27,7 @@ class CommandOSMode : public Command const Anope::string &target = params[0]; const Anope::string &modes = params[1]; - Channel *c = findchan(target); + Channel *c = Channel::Find(target); if (!c) source.Reply(CHAN_X_NOT_IN_USE, target.c_str()); else if (c->bouncy_modes) @@ -62,23 +62,23 @@ class CommandOSMode : public Command continue; Anope::string param, param_log; - if (cm->Type != MODE_REGULAR) + if (cm->type != MODE_REGULAR) { if (!sep.GetToken(param)) continue; param_log = param; - if (cm->Type == MODE_STATUS) + if (cm->type == MODE_STATUS) { - User *targ = finduser(param); + User *targ = User::Find(param, true); if (targ == NULL || c->FindUser(targ) == NULL) continue; param = targ->GetUID(); } } - log_modes += cm->ModeChar; + log_modes += cm->mchar; if (!param.empty()) log_params += " " + param_log; @@ -117,7 +117,7 @@ class CommandOSUMode : public Command const Anope::string &target = params[0]; const Anope::string &modes = params[1]; - User *u2 = finduser(target); + User *u2 = User::Find(target, true); if (!u2) source.Reply(NICK_X_NOT_IN_USE, target.c_str()); else diff --git a/modules/commands/os_modinfo.cpp b/modules/commands/os_modinfo.cpp index 88748a106..15e2d73a2 100644 --- a/modules/commands/os_modinfo.cpp +++ b/modules/commands/os_modinfo.cpp @@ -29,12 +29,12 @@ class CommandOSModInfo : public Command Module *m = ModuleManager::FindModule(file); if (m) { - source.Reply(_("Module: \002%s\002 Version: \002%s\002 Author: \002%s\002 loaded: \002%s\002"), m->name.c_str(), !m->version.empty() ? m->version.c_str() : "?", !m->author.empty() ? m->author.c_str() : "?", do_strftime(m->created).c_str()); + source.Reply(_("Module: \002%s\002 Version: \002%s\002 Author: \002%s\002 loaded: \002%s\002"), m->name.c_str(), !m->version.empty() ? m->version.c_str() : "?", !m->author.empty() ? m->author.c_str() : "?", Anope::strftime(m->created).c_str()); std::vector<Anope::string> servicekeys = Service::GetServiceKeys("Command"); for (unsigned i = 0; i < servicekeys.size(); ++i) { - service_reference<Command> c("Command", servicekeys[i]); + ServiceReference<Command> c("Command", servicekeys[i]); if (!c || c->owner != m) continue; @@ -156,9 +156,11 @@ class CommandOSModList : public Command } } + Module *protocol = ModuleManager::FindFirstOf(PROTOCOL); + source.Reply(_("Current Module list:")); - for (std::list<Module *>::iterator it = Modules.begin(), it_end = Modules.end(); it != it_end; ++it) + for (std::list<Module *>::iterator it = ModuleManager::Modules.begin(), it_end = ModuleManager::Modules.end(); it != it_end; ++it) { Module *m = *it; @@ -179,6 +181,8 @@ class CommandOSModList : public Command } break; case PROTOCOL: + if (m != protocol) + break; if (showProto) { source.Reply(_("Module: \002%s\002 [%s] [%s]"), m->name.c_str(), m->version.c_str(), proto); diff --git a/modules/commands/os_module.cpp b/modules/commands/os_module.cpp index e7e0e2c16..75bc82af6 100644 --- a/modules/commands/os_module.cpp +++ b/modules/commands/os_module.cpp @@ -76,6 +76,13 @@ class CommandOSModReLoad : public Command return; } + Module *protocol = ModuleManager::FindFirstOf(PROTOCOL); + if (m->type == PROTOCOL && m != protocol) + { + source.Reply(_("You may not reload this module directly, instead reload %s."), protocol ? protocol->name.c_str() : "(unknown)"); + return; + } + /* Unrecoverable */ bool fatal = m->type == PROTOCOL; ModuleReturn status = ModuleManager::UnloadModule(m, source.GetUser()); @@ -96,8 +103,8 @@ class CommandOSModReLoad : public Command { if (fatal) { - quitmsg = "Unable to reload module " + mname; - quitting = true; + Anope::QuitReason = "Unable to reload module " + mname; + Anope::Quitting = true; } else source.Reply(_("Unable to load module \002%s\002"), mname.c_str()); diff --git a/modules/commands/os_news.cpp b/modules/commands/os_news.cpp index ba23c431d..eea480d13 100644 --- a/modules/commands/os_news.cpp +++ b/modules/commands/os_news.cpp @@ -72,7 +72,7 @@ class MyNewsService : public NewsService { for (unsigned i = 0; i < 3; ++i) for (unsigned j = 0; j < newsItems[i].size(); ++j) - newsItems[i][j]->destroy(); + newsItems[i][j]->Destroy(); } void AddNewsItem(NewsItem *n) @@ -86,7 +86,7 @@ class MyNewsService : public NewsService std::vector<NewsItem *>::iterator it = std::find(list.begin(), list.end(), n); if (it != list.end()) list.erase(it); - n->destroy(); + n->Destroy(); } std::vector<NewsItem *> &GetNewsList(NewsType t) @@ -106,7 +106,7 @@ static const char **findmsgs(NewsType type) class NewsBase : public Command { - service_reference<NewsService> ns; + ServiceReference<NewsService> ns; protected: void DoList(CommandSource &source, NewsType ntype, const char **msgs) @@ -117,16 +117,16 @@ class NewsBase : public Command else { ListFormatter lflist; - lflist.addColumn("Number").addColumn("Creator").addColumn("Created").addColumn("Text"); + lflist.AddColumn("Number").AddColumn("Creator").AddColumn("Created").AddColumn("Text"); for (unsigned i = 0, end = list.size(); i < end; ++i) { ListFormatter::ListEntry entry; entry["Number"] = stringify(i + 1); entry["Creator"] = list[i]->who; - entry["Created"] = do_strftime(list[i]->time); + entry["Created"] = Anope::strftime(list[i]->time); entry["Text"] = list[i]->text; - lflist.addEntry(entry); + lflist.AddEntry(entry); } source.Reply(msgs[MSG_LIST_HEADER]); @@ -151,7 +151,7 @@ class NewsBase : public Command this->OnSyntaxError(source, "ADD"); else { - if (readonly) + if (Anope::ReadOnly) source.Reply(READ_ONLY_MODE); NewsItem *news = new NewsItem(); @@ -181,7 +181,7 @@ class NewsBase : public Command source.Reply(msgs[MSG_LIST_NONE]); else { - if (readonly) + if (Anope::ReadOnly) source.Reply(READ_ONLY_MODE); if (!text.equals_ci("ALL")) { @@ -336,7 +336,7 @@ class CommandOSRandomNews : public NewsBase class OSNews : public Module { - SerializeType newsitem_type; + Serialize::Type newsitem_type; MyNewsService newsservice; CommandOSLogonNews commandoslogonnews; @@ -364,14 +364,14 @@ class OSNews : public Module if (Type == NEWS_RANDOM && i != cur_rand_news) continue; - const BotInfo *gl = findbot(Config->Global); + const BotInfo *gl = Global; if (!gl && !BotListByNick->empty()) gl = BotListByNick->begin()->second; - const BotInfo *os = findbot(Config->OperServ); + const BotInfo *os = OperServ; if (!os) os = gl; if (gl) - u->SendMessage(Type != NEWS_OPER ? gl : os, msg.c_str(), do_strftime(newsList[i]->time).c_str(), newsList[i]->text.c_str()); + u->SendMessage(Type != NEWS_OPER ? gl : os, msg.c_str(), Anope::strftime(newsList[i]->time).c_str(), newsList[i]->text.c_str()); ++displayed; @@ -391,7 +391,7 @@ class OSNews : public Module public: OSNews(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), - newsitem_type("NewsItem", NewsItem::unserialize), newsservice(this), commandoslogonnews(this), commandosopernews(this), commandosrandomnews(this) + newsitem_type("NewsItem", NewsItem::Unserialize), newsservice(this), commandoslogonnews(this), commandosopernews(this), commandosrandomnews(this) { this->SetAuthor("Anope"); @@ -405,7 +405,7 @@ class OSNews : public Module DisplayNews(u, NEWS_OPER); } - void OnUserConnect(dynamic_reference<User> &user, bool &) anope_override + void OnUserConnect(Reference<User> &user, bool &) anope_override { if (!user || !user->server->IsSynced()) return; diff --git a/modules/commands/os_news.h b/modules/commands/os_news.h index 426121fb7..44525b963 100644 --- a/modules/commands/os_news.h +++ b/modules/commands/os_news.h @@ -23,8 +23,8 @@ struct NewsItem : Serializable time_t time; NewsItem() : Serializable("NewsItem") { } - Serialize::Data serialize() const anope_override; - static Serializable* unserialize(Serializable *obj, Serialize::Data &data); + Serialize::Data Serialize() const anope_override; + static Serializable* Unserialize(Serializable *obj, Serialize::Data &data); }; class NewsService : public Service @@ -39,9 +39,9 @@ class NewsService : public Service virtual std::vector<NewsItem *> &GetNewsList(NewsType t) = 0; }; -static service_reference<NewsService> news_service("NewsService", "news"); +static ServiceReference<NewsService> news_service("NewsService", "news"); -Serialize::Data NewsItem::serialize() const +Serialize::Data NewsItem::Serialize() const { Serialize::Data data; @@ -53,7 +53,7 @@ Serialize::Data NewsItem::serialize() const return data; } -Serializable* NewsItem::unserialize(Serializable *obj, Serialize::Data &data) +Serializable* NewsItem::Unserialize(Serializable *obj, Serialize::Data &data) { if (!news_service) return NULL; diff --git a/modules/commands/os_noop.cpp b/modules/commands/os_noop.cpp index 826f1313a..fa9361f7b 100644 --- a/modules/commands/os_noop.cpp +++ b/modules/commands/os_noop.cpp @@ -36,7 +36,7 @@ class CommandOSNOOP : public Command else if (cmd.equals_ci("SET")) { /* Remove the O:lines */ - ircdproto->SendSVSNOOP(s, true); + IRCD->SendSVSNOOP(s, true); s->Extend("noop", new ExtensibleItemClass<Anope::string>(source.GetNick())); Log(LOG_ADMIN, source, this) << "SET on " << s->GetName(); @@ -56,7 +56,7 @@ class CommandOSNOOP : public Command else if (cmd.equals_ci("REVOKE")) { s->Shrink("noop"); - ircdproto->SendSVSNOOP(s, false); + IRCD->SendSVSNOOP(s, false); Log(LOG_ADMIN, source, this) << "REVOKE on " << s->GetName(); source.Reply(_("All O:lines of \002%s\002 have been reset."), s->GetName().c_str()); } diff --git a/modules/commands/os_oline.cpp b/modules/commands/os_oline.cpp index 3fe622c1c..7b8be5768 100644 --- a/modules/commands/os_oline.cpp +++ b/modules/commands/os_oline.cpp @@ -29,11 +29,11 @@ class CommandOSOLine : public Command User *u2 = NULL; /* let's check whether the user is online */ - if (!(u2 = finduser(nick))) + if (!(u2 = User::Find(nick, true))) source.Reply(NICK_X_NOT_IN_USE, nick.c_str()); else if (u2 && flag[0] == '+') { - ircdproto->SendSVSO(source.service, nick, flag); + IRCD->SendSVSO(source.service, nick, flag); u2->SetMode(source.service, UMODE_OPER); 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()); @@ -41,7 +41,7 @@ class CommandOSOLine : public Command } else if (u2 && flag[0] == '-') { - ircdproto->SendSVSO(source.service, nick, flag); + IRCD->SendSVSO(source.service, nick, flag); 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; } @@ -72,7 +72,7 @@ class OSOLine : public Module { this->SetAuthor("Anope"); - if (!ircdproto || !ircdproto->CanSVSO) + if (!IRCD || !IRCD->CanSVSO) throw ModuleException("Your IRCd does not support OMODE."); } diff --git a/modules/commands/os_oper.cpp b/modules/commands/os_oper.cpp index e2e7b4ab3..882455898 100644 --- a/modules/commands/os_oper.cpp +++ b/modules/commands/os_oper.cpp @@ -17,7 +17,7 @@ struct MyOper : Oper, Serializable { MyOper(const Anope::string &n, OperType *o) : Oper(n, o), Serializable("Oper") { } - Serialize::Data serialize() const anope_override + Serialize::Data Serialize() const anope_override { Serialize::Data data; @@ -27,12 +27,12 @@ struct MyOper : Oper, Serializable return data; } - static Serializable* unserialize(Serializable *obj, Serialize::Data &data) + static Serializable* Unserialize(Serializable *obj, Serialize::Data &data) { OperType *ot = OperType::Find(data["type"].astr()); if (ot == NULL) return NULL; - NickCore *nc = findcore(data["name"].astr()); + NickCore *nc = NickCore::Find(data["name"].astr()); if (nc == NULL) return NULL; @@ -68,7 +68,7 @@ class CommandOSOper : public Command const Anope::string &oper = params[1]; const Anope::string &otype = params[2]; - const NickAlias *na = findnick(oper); + const NickAlias *na = NickAlias::Find(oper); if (na == NULL) source.Reply(NICK_X_NOT_REGISTERED, oper.c_str()); else if (na->nc->o) @@ -91,7 +91,7 @@ class CommandOSOper : public Command { const Anope::string &oper = params[1]; - const NickAlias *na = findnick(oper); + const NickAlias *na = NickAlias::Find(oper); if (na == NULL) source.Reply(NICK_X_NOT_REGISTERED, oper.c_str()); else if (!na->nc || !na->nc->o) @@ -118,7 +118,7 @@ class CommandOSOper : public Command source.Reply(_("%-8s %s"), nc->o->name.c_str(), nc->o->ot->GetName().c_str()); if (nc->o->config) source.Reply(_(" This oper is configured in the configuration file.")); - for (std::list<User *>::const_iterator uit = nc->Users.begin(); uit != nc->Users.end(); ++uit) + for (std::list<User *>::const_iterator uit = nc->users.begin(); uit != nc->users.end(); ++uit) { User *u = *uit; source.Reply(_(" %s is online using this oper block."), u->nick.c_str()); @@ -202,12 +202,12 @@ class CommandOSOper : public Command class OSOper : public Module { - SerializeType myoper_type; + Serialize::Type myoper_type; CommandOSOper commandosoper; public: OSOper(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), - myoper_type("Oper", MyOper::unserialize), commandosoper(this) + myoper_type("Oper", MyOper::Unserialize), commandosoper(this) { this->SetAuthor("Anope"); } diff --git a/modules/commands/os_session.cpp b/modules/commands/os_session.cpp index 2311b2ed2..27157d511 100644 --- a/modules/commands/os_session.cpp +++ b/modules/commands/os_session.cpp @@ -101,9 +101,9 @@ class ExpireTimer : public Timer if (!e->expires || e->expires > Anope::CurTime) continue; - Log(findbot(Config->OperServ), "expire/exception") << "Session exception for " << e->mask << "has expired."; + Log(OperServ, "expire/exception") << "Session exception for " << e->mask << "has expired."; session_service->DelException(e); - e->destroy(); + e->Destroy(); } } }; @@ -112,30 +112,30 @@ class ExceptionDelCallback : public NumberList { protected: CommandSource &source; - unsigned Deleted; + unsigned deleted; public: - ExceptionDelCallback(CommandSource &_source, const Anope::string &numlist) : NumberList(numlist, true), source(_source), Deleted(0) + ExceptionDelCallback(CommandSource &_source, const Anope::string &numlist) : NumberList(numlist, true), source(_source), deleted(0) { } ~ExceptionDelCallback() { - if (!Deleted) + if (!deleted) source.Reply(_("No matching entries on session-limit exception list.")); - else if (Deleted == 1) + else if (deleted == 1) source.Reply(_("Deleted 1 entry from session-limit exception list.")); else - source.Reply(_("Deleted %d entries from session-limit exception list."), Deleted); + source.Reply(_("Deleted %d entries from session-limit exception list."), deleted); } - virtual void HandleNumber(unsigned Number) anope_override + virtual void HandleNumber(unsigned number) anope_override { - if (!Number || Number > session_service->GetExceptions().size()) + if (!number || number > session_service->GetExceptions().size()) return; - ++Deleted; + ++deleted; - DoDel(source, Number - 1); + DoDel(source, number - 1); } static void DoDel(CommandSource &source, unsigned index) @@ -144,7 +144,7 @@ class ExceptionDelCallback : public NumberList FOREACH_MOD(I_OnExceptionDel, OnExceptionDel(source, e)); session_service->DelException(e); - e->destroy(); + e->Destroy(); } }; @@ -167,7 +167,7 @@ class CommandOSSession : public Command else { ListFormatter list; - list.addColumn("Session").addColumn("Host"); + list.AddColumn("Session").AddColumn("Host"); for (SessionService::SessionMap::iterator it = session_service->GetSessions().begin(), it_end = session_service->GetSessions().end(); it != it_end; ++it) { @@ -178,7 +178,7 @@ class CommandOSSession : public Command ListFormatter::ListEntry entry; entry["Session"] = stringify(session->count); entry["Host"] = session->addr.mask(); - list.addEntry(entry); + list.AddEntry(entry); } } @@ -296,7 +296,7 @@ class CommandOSException : public Command return; } - time_t expires = !expiry.empty() ? dotime(expiry) : Config->ExceptionExpiry; + time_t expires = !expiry.empty() ? Anope::DoTime(expiry) : Config->ExceptionExpiry; if (expires < 0) { source.Reply(BAD_EXPIRY_TIME); @@ -352,12 +352,12 @@ class CommandOSException : public Command EventReturn MOD_RESULT; FOREACH_RESULT(I_OnExceptionAdd, OnExceptionAdd(exception)); if (MOD_RESULT == EVENT_STOP) - exception->destroy(); + exception->Destroy(); else { session_service->AddException(exception); source.Reply(_("Session limit for \002%s\002 set to \002%d\002."), mask.c_str(), limit); - if (readonly) + if (Anope::ReadOnly) source.Reply(READ_ONLY_MODE); } } @@ -394,7 +394,7 @@ class CommandOSException : public Command source.Reply(_("\002%s\002 not found on session-limit exception list."), mask.c_str()); } - if (readonly) + if (Anope::ReadOnly) source.Reply(READ_ONLY_MODE); return; @@ -428,7 +428,7 @@ class CommandOSException : public Command source.Reply(_("Exception for \002%s\002 (#%d) moved to position \002%d\002."), session_service->GetExceptions()[n1]->mask.c_str(), n1 + 1, n2 + 1); - if (readonly) + if (Anope::ReadOnly) source.Reply(READ_ONLY_MODE); } else @@ -468,10 +468,10 @@ class CommandOSException : public Command entry["Number"] = stringify(Number); entry["Mask"] = e->mask; entry["By"] = e->who; - entry["Created"] = do_strftime(e->time); + entry["Created"] = Anope::strftime(e->time); entry["Limit"] = stringify(e->limit); entry["Reason"] = e->reason; - this->list.addEntry(entry); + this->list.AddEntry(entry); } } nl_list(list, mask); @@ -488,15 +488,15 @@ class CommandOSException : public Command entry["Number"] = stringify(i + 1); entry["Mask"] = e->mask; entry["By"] = e->who; - entry["Created"] = do_strftime(e->time); + entry["Created"] = Anope::strftime(e->time); entry["Limit"] = stringify(e->limit); entry["Reason"] = e->reason; - list.addEntry(entry); + list.AddEntry(entry); } } } - if (list.isEmpty()) + if (list.IsEmpty()) source.Reply(_("No matching entries on session-limit exception list.")); else { @@ -513,7 +513,7 @@ class CommandOSException : public Command void DoList(CommandSource &source, const std::vector<Anope::string> ¶ms) { ListFormatter list; - list.addColumn("Number").addColumn("Limit").addColumn("Mask"); + list.AddColumn("Number").AddColumn("Limit").AddColumn("Mask"); this->ProcessList(source, params, list); } @@ -521,7 +521,7 @@ class CommandOSException : public Command void DoView(CommandSource &source, const std::vector<Anope::string> ¶ms) { ListFormatter list; - list.addColumn("Number").addColumn("Mask").addColumn("By").addColumn("Created").addColumn("Limit").addColumn("Reason"); + list.AddColumn("Number").AddColumn("Mask").AddColumn("By").AddColumn("Created").AddColumn("Limit").AddColumn("Reason"); this->ProcessList(source, params, list); } @@ -604,12 +604,12 @@ class CommandOSException : public Command class OSSession : public Module { - SerializeType exception_type; + Serialize::Type exception_type; MySessionService ss; ExpireTimer expiretimer; CommandOSSession commandossession; CommandOSException commandosexception; - service_reference<XLineManager> akills; + ServiceReference<XLineManager> akills; void AddSession(User *u, bool exempt) { @@ -649,13 +649,12 @@ class OSSession : public Module if (kill && !exempt) { - const BotInfo *bi = findbot(Config->OperServ); - if (bi) + if (OperServ) { if (!Config->SessionLimitExceeded.empty()) - u->SendMessage(bi, Config->SessionLimitExceeded.c_str(), u->host.c_str()); + u->SendMessage(OperServ, Config->SessionLimitExceeded.c_str(), u->host.c_str()); if (!Config->SessionLimitDetailsLoc.empty()) - u->SendMessage(bi, "%s", Config->SessionLimitDetailsLoc.c_str()); + u->SendMessage(OperServ, "%s", Config->SessionLimitDetailsLoc.c_str()); } ++session->hits; @@ -665,7 +664,7 @@ class OSSession : public Module XLine *x = new XLine(akillmask, Config->OperServ, Anope::CurTime + Config->SessionAutoKillExpiry, "Session limit exceeded", XLineManager::GenerateUID()); akills->AddXLine(x); akills->Send(NULL, x); - Log(bi, "akill/session") << "Added a temporary AKILL for \2" << akillmask << "\2 due to excessive connections"; + Log(OperServ, "akill/session") << "Added a temporary AKILL for \2" << akillmask << "\2 due to excessive connections"; } else { @@ -694,8 +693,7 @@ class OSSession : public Module } if (!session) { - if (debug) - Log(this) << "Tried to delete non-existant session: " << u->host; + Log(LOG_DEBUG) << "Tried to delete non-existant session: " << u->host; return; } @@ -711,7 +709,7 @@ class OSSession : public Module public: OSSession(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), - exception_type("Exception", Exception::unserialize), ss(this), commandossession(this), commandosexception(this), akills("XLineManager", "xlinemanager/sgline") + exception_type("Exception", Exception::Unserialize), ss(this), commandossession(this), commandosexception(this), akills("XLineManager", "xlinemanager/sgline") { this->SetAuthor("Anope"); @@ -720,7 +718,7 @@ class OSSession : public Module ModuleManager::SetPriority(this, PRIORITY_FIRST); } - void OnUserConnect(dynamic_reference<User> &user, bool &exempt) anope_override + void OnUserConnect(Reference<User> &user, bool &exempt) anope_override { if (user && Config->LimitSessions) this->AddSession(user, exempt); diff --git a/modules/commands/os_session.h b/modules/commands/os_session.h index 070975fd2..7304b21ae 100644 --- a/modules/commands/os_session.h +++ b/modules/commands/os_session.h @@ -20,8 +20,8 @@ struct Exception : Serializable time_t expires; /* Time when it expires. 0 == no expiry */ Exception() : Serializable("Exception") { } - Serialize::Data serialize() const anope_override; - static Serializable* unserialize(Serializable *obj, Serialize::Data &data); + Serialize::Data Serialize() const anope_override; + static Serializable* Unserialize(Serializable *obj, Serialize::Data &data); }; class SessionService : public Service @@ -51,9 +51,9 @@ class SessionService : public Service virtual SessionMap &GetSessions() = 0; }; -static service_reference<SessionService> session_service("SessionService", "session"); +static ServiceReference<SessionService> session_service("SessionService", "session"); -Serialize::Data Exception::serialize() const +Serialize::Data Exception::Serialize() const { Serialize::Data data; @@ -67,7 +67,7 @@ Serialize::Data Exception::serialize() const return data; } -Serializable* Exception::unserialize(Serializable *obj, Serialize::Data &data) +Serializable* Exception::Unserialize(Serializable *obj, Serialize::Data &data) { if (!session_service) return NULL; diff --git a/modules/commands/os_set.cpp b/modules/commands/os_set.cpp index a8a7e2e62..1592e7936 100644 --- a/modules/commands/os_set.cpp +++ b/modules/commands/os_set.cpp @@ -22,11 +22,11 @@ class CommandOSSet : public Command Anope::string index; - index = readonly ? _("%s is enabled") : _("%s is disabled"); + index = Anope::ReadOnly ? _("%s is enabled") : _("%s is disabled"); source.Reply(index.c_str(), "READONLY"); - index = debug ? _("%s is enabled") : _("%s is disabled"); + index = Anope::Debug ? _("%s is enabled") : _("%s is disabled"); source.Reply(index.c_str(), "DEBUG"); - index = noexpire ? _("%s is enabled") : _("%s is disabled"); + index = Anope::NoExpire ? _("%s is enabled") : _("%s is disabled"); source.Reply(index.c_str(), "NOEXPIRE"); return; @@ -44,13 +44,13 @@ class CommandOSSet : public Command if (setting.equals_ci("ON")) { - readonly = true; + Anope::ReadOnly = true; Log(LOG_ADMIN, source, this) << "READONLY ON"; source.Reply(_("Services are now in \002read-only\002 mode.")); } else if (setting.equals_ci("OFF")) { - readonly = false; + Anope::ReadOnly = false; Log(LOG_ADMIN, source, this) << "READONLY OFF"; source.Reply(_("Services are now in \002read-write\002 mode.")); } @@ -79,21 +79,21 @@ class CommandOSSet : public Command * Rob **/ if (!Config->SuperAdmin) - source.Reply(_("SuperAdmin setting not enabled in services.conf")); + source.Reply(_("Superadmin can not be set because it is not enabled in the configuration")); else if (setting.equals_ci("ON")) { - source.GetUser()->SuperAdmin = true; + source.GetUser()->super_admin = true; source.Reply(_("You are now a SuperAdmin")); Log(LOG_ADMIN, source, this) << "SUPERADMIN ON"; } else if (setting.equals_ci("OFF")) { - source.GetUser()->SuperAdmin = false; + source.GetUser()->super_admin = false; source.Reply(_("You are no longer a SuperAdmin")); Log(LOG_ADMIN, source, this) << "SUPERADMIN OFF"; } else - source.Reply(_("Setting for SuperAdmin must be \002on\002 or \002off\002 (must be enabled in services.conf)")); + source.Reply(_("Setting for SuperAdmin must be \002on\002 or \002off\002.")); return; } @@ -110,23 +110,23 @@ class CommandOSSet : public Command if (setting.equals_ci("ON")) { - debug = 1; + Anope::Debug = 1; Log(LOG_ADMIN, source, this) << "DEBUG ON"; source.Reply(_("Services are now in debug mode.")); } else if (setting.equals_ci("OFF") || setting == "0") { Log(LOG_ADMIN, source, this) << "DEBUG OFF"; - debug = 0; + Anope::Debug = 0; source.Reply(_("Services are now in non-debug mode.")); } else { try { - debug = convertTo<int>(setting); - Log(LOG_ADMIN, source, this) << "DEBUG " << debug; - source.Reply(_("Services are now in debug mode (level %d)."), debug); + Anope::Debug = convertTo<int>(setting); + Log(LOG_ADMIN, source, this) << "DEBUG " << Anope::Debug; + source.Reply(_("Services are now in debug mode (level %d)."), Anope::Debug); return; } catch (const ConvertException &) { } @@ -149,13 +149,13 @@ class CommandOSSet : public Command if (setting.equals_ci("ON")) { - noexpire = true; + Anope::NoExpire = true; Log(LOG_ADMIN, source, this) << "NOEXPIRE ON"; source.Reply(_("Services are now in \002no expire\002 mode.")); } else if (setting.equals_ci("OFF")) { - noexpire = false; + Anope::NoExpire = false; Log(LOG_ADMIN, source, this) << "NOEXPIRE OFF"; source.Reply(_("Services are now in \002expire\002 mode.")); } diff --git a/modules/commands/os_shutdown.cpp b/modules/commands/os_shutdown.cpp index 6edb3a64d..2f7827be3 100644 --- a/modules/commands/os_shutdown.cpp +++ b/modules/commands/os_shutdown.cpp @@ -24,8 +24,8 @@ class CommandOSQuit : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - quitmsg = source.command + " command received from " + source.GetNick(); - quitting = true; + Anope::QuitReason = source.command + " command received from " + source.GetNick(); + Anope::Quitting = true; return; } @@ -52,9 +52,9 @@ class CommandOSRestart : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - quitmsg = source.command + " command received from " + source.GetNick(); - quitting = restarting = true; - save_databases(); + Anope::QuitReason = source.command + " command received from " + source.GetNick(); + Anope::Quitting = Anope::Restarting = true; + Anope::SaveDatabases(); return; } @@ -78,9 +78,9 @@ class CommandOSShutdown : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - quitmsg = source.command + " command received from " + source.GetNick(); - quitting = true; - save_databases(); + Anope::QuitReason = source.command + " command received from " + source.GetNick(); + Anope::Quitting = true; + Anope::SaveDatabases(); return; } diff --git a/modules/commands/os_stats.cpp b/modules/commands/os_stats.cpp index 83f13a90a..bb029eed9 100644 --- a/modules/commands/os_stats.cpp +++ b/modules/commands/os_stats.cpp @@ -18,20 +18,20 @@ struct Stats : Serializable { Stats() : Serializable("Stats") { } - Serialize::Data serialize() const anope_override + Serialize::Data Serialize() const anope_override { Serialize::Data data; - data["maxusercnt"] << maxusercnt; - data["maxusertime"] << maxusertime; + data["maxusercnt"] << MaxUserCount; + data["maxusertime"] << MaxUserTime; return data; } - static Serializable* unserialize(Serializable *obj, Serialize::Data &data) + static Serializable* Unserialize(Serializable *obj, Serialize::Data &data) { - data["maxusercnt"] >> maxusercnt; - data["maxusertime"] >> maxusertime; + data["maxusercnt"] >> MaxUserCount; + data["maxusertime"] >> MaxUserTime; return NULL; } }; @@ -57,7 +57,7 @@ static int stats_count_servers(Server *s) class CommandOSStats : public Command { - service_reference<XLineManager> akills, snlines, sqlines; + ServiceReference<XLineManager> akills, snlines, sqlines; private: void DoStatsAkill(CommandSource &source) { @@ -82,7 +82,7 @@ class CommandOSStats : public Command else source.Reply(_("Default AKILL expiry time: \002No expiration\002")); } - if (ircdproto->CanSNLine && snlines) + if (IRCD->CanSNLine && snlines) { /* SNLINEs */ source.Reply(_("Current number of SNLINEs: \002%d\002"), snlines->GetCount()); @@ -102,7 +102,7 @@ class CommandOSStats : public Command else source.Reply(_("Default SNLINE expiry time: \002No expiration\002")); } - if (ircdproto->CanSQLine && sqlines) + if (IRCD->CanSQLine && sqlines) { /* SQLINEs */ source.Reply(_("Current number of SQLINEs: \002%d\002"), sqlines->GetCount()); @@ -127,17 +127,17 @@ class CommandOSStats : public Command void DoStatsReset(CommandSource &source) { - maxusercnt = usercnt; + MaxUserCount = UserListByNick.size(); source.Reply(_("Statistics reset.")); return; } void DoStatsUptime(CommandSource &source) { - time_t uptime = Anope::CurTime - start_time; - source.Reply(_("Current users: \002%d\002 (\002%d\002 ops)"), usercnt, opcnt); - source.Reply(_("Maximum users: \002%d\002 (%s)"), maxusercnt, do_strftime(maxusertime).c_str()); - source.Reply(_("Services up %s"), duration(uptime).c_str()); + time_t uptime = Anope::CurTime - Anope::StartTime; + source.Reply(_("Current users: \002%d\002 (\002%d\002 ops)"), UserListByNick.size(), OperCount); + source.Reply(_("Maximum users: \002%d\002 (%s)"), MaxUserCount, Anope::strftime(MaxUserTime).c_str()); + source.Reply(_("Services up %s"), Anope::Duration(uptime).c_str()); return; } @@ -145,7 +145,7 @@ class CommandOSStats : public Command void DoStatsUplink(CommandSource &source) { Anope::string buf; - for (std::set<Anope::string>::iterator it = Capab.begin(); it != Capab.end(); ++it) + for (std::set<Anope::string>::iterator it = Servers::Capab.begin(); it != Servers::Capab.end(); ++it) buf += " " + *it; if (!buf.empty()) buf.erase(buf.begin()); @@ -255,12 +255,12 @@ class CommandOSStats : public Command class OSStats : public Module { CommandOSStats commandosstats; - SerializeType stats_type; + Serialize::Type stats_type; Stats stats_saver; public: OSStats(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), - commandosstats(this), stats_type("Stats", Stats::unserialize) + commandosstats(this), stats_type("Stats", Stats::Unserialize) { this->SetAuthor("Anope"); diff --git a/modules/commands/os_svsnick.cpp b/modules/commands/os_svsnick.cpp index 4c6329acb..e08d5d3aa 100644 --- a/modules/commands/os_svsnick.cpp +++ b/modules/commands/os_svsnick.cpp @@ -36,28 +36,22 @@ class CommandOSSVSNick : public Command } /* Check for valid characters */ - if (newnick[0] == '-' || isdigit(newnick[0])) + if (!IRCD->IsNickValid(newnick)) { source.Reply(_("Nick \002%s\002 is an illegal nickname and cannot be used."), newnick.c_str()); return; } - for (unsigned i = 0, end = newnick.length(); i < end; ++i) - if (!isvalidnick(newnick[i])) - { - source.Reply(_("Nick \002%s\002 is an illegal nickname and cannot be used."), newnick.c_str()); - return; - } /* Check for a nick in use or a forbidden/suspended nick */ - if (!(u2 = finduser(nick))) + if (!(u2 = User::Find(nick, true))) source.Reply(NICK_X_NOT_IN_USE, nick.c_str()); - else if (!nick.equals_ci(newnick) && finduser(newnick)) + else if (!nick.equals_ci(newnick) && User::Find(newnick)) source.Reply(_("Nick \002%s\002 is currently in use."), newnick.c_str()); else { source.Reply(_("The nick \002%s\002 is now being changed to \002%s\002."), nick.c_str(), newnick.c_str()); Log(LOG_ADMIN, source, this) << "to change " << nick << " to " << newnick; - ircdproto->SendForceNickChange(u2, newnick, Anope::CurTime); + IRCD->SendForceNickChange(u2, newnick, Anope::CurTime); } return; } @@ -81,7 +75,7 @@ class OSSVSNick : public Module { this->SetAuthor("Anope"); - if (!ircdproto || !ircdproto->CanSVSNick) + if (!IRCD || !IRCD->CanSVSNick) throw ModuleException("Your IRCd does not support SVSNICK"); } diff --git a/modules/commands/os_sxline.cpp b/modules/commands/os_sxline.cpp index 9261bcddd..7f48a2645 100644 --- a/modules/commands/os_sxline.cpp +++ b/modules/commands/os_sxline.cpp @@ -18,33 +18,33 @@ class SXLineDelCallback : public NumberList XLineManager *xlm; Command *command; CommandSource &source; - unsigned Deleted; + unsigned deleted; public: - SXLineDelCallback(XLineManager *x, Command *c, CommandSource &_source, const Anope::string &numlist) : NumberList(numlist, true), xlm(x), command(c), source(_source), Deleted(0) + SXLineDelCallback(XLineManager *x, Command *c, CommandSource &_source, const Anope::string &numlist) : NumberList(numlist, true), xlm(x), command(c), source(_source), deleted(0) { } ~SXLineDelCallback() { - if (!Deleted) + if (!deleted) source.Reply(_("No matching entries on the %s list."), this->command->name.c_str()); - else if (Deleted == 1) + else if (deleted == 1) source.Reply(_("Deleted 1 entry from the %s list."), this->command->name.c_str()); else - source.Reply(_("Deleted %d entries from the %s list."), Deleted, this->command->name.c_str()); + source.Reply(_("Deleted %d entries from the %s list."), deleted, this->command->name.c_str()); } - void HandleNumber(unsigned Number) anope_override + void HandleNumber(unsigned number) anope_override { - if (!Number) + if (!number) return; - XLine *x = this->xlm->GetEntry(Number - 1); + XLine *x = this->xlm->GetEntry(number - 1); if (!x) return; - ++Deleted; + ++deleted; DoDel(this->xlm, source, x); } @@ -99,7 +99,7 @@ class CommandOSSXLineBase : public Command source.Reply(_("\002%s\002 deleted from the %s list."), mask.c_str(), source.command.c_str()); } - if (readonly) + if (Anope::ReadOnly) source.Reply(READ_ONLY_MODE); return; @@ -126,24 +126,24 @@ class CommandOSSXLineBase : public Command { } - void HandleNumber(unsigned Number) anope_override + void HandleNumber(unsigned number) anope_override { - if (!Number) + if (!number) return; - const XLine *x = this->xlm->GetEntry(Number - 1); + const XLine *x = this->xlm->GetEntry(number - 1); if (!x) return; ListFormatter::ListEntry entry; - entry["Number"] = stringify(Number); - entry["Mask"] = x->Mask; - entry["By"] = x->By; - entry["Created"] = do_strftime(x->Created, NULL, true); - entry["Expires"] = expire_left(NULL, x->Expires); - entry["Reason"] = x->Reason; - list.addEntry(entry); + entry["Number"] = stringify(number); + entry["Mask"] = x->mask; + entry["By"] = x->by; + entry["Created"] = Anope::strftime(x->created, NULL, true); + entry["Expires"] = Anope::Expires(x->expires); + entry["Reason"] = x->reason; + list.AddEntry(entry); } } sl_list(this->xlm(), list, mask); @@ -155,21 +155,21 @@ class CommandOSSXLineBase : public Command { const XLine *x = this->xlm()->GetEntry(i); - if (mask.empty() || mask.equals_ci(x->Mask) || mask == x->UID || Anope::Match(x->Mask, mask, false, true)) + if (mask.empty() || mask.equals_ci(x->mask) || mask == x->id || Anope::Match(x->mask, mask, false, true)) { ListFormatter::ListEntry entry; entry["Number"] = stringify(i + 1); - entry["Mask"] = x->Mask; - entry["By"] = x->By; - entry["Created"] = do_strftime(x->Created, NULL, true); - entry["Expires"] = expire_left(source.nc, x->Expires); - entry["Reason"] = x->Reason; - list.addEntry(entry); + entry["Mask"] = x->mask; + entry["By"] = x->by; + entry["Created"] = Anope::strftime(x->created, NULL, true); + entry["Expires"] = Anope::Expires(x->expires, source.nc); + entry["Reason"] = x->reason; + list.AddEntry(entry); } } } - if (list.isEmpty()) + if (list.IsEmpty()) source.Reply(_("No matching entries on the %s list."), source.command.c_str()); else { @@ -186,7 +186,7 @@ class CommandOSSXLineBase : public Command void OnList(CommandSource &source, const std::vector<Anope::string> ¶ms) { ListFormatter list; - list.addColumn("Number").addColumn("Mask").addColumn("Reason"); + list.AddColumn("Number").AddColumn("Mask").AddColumn("Reason"); this->ProcessList(source, params, list); } @@ -194,7 +194,7 @@ class CommandOSSXLineBase : public Command void OnView(CommandSource &source, const std::vector<Anope::string> ¶ms) { ListFormatter list; - list.addColumn("Number").addColumn("Mask").addColumn("By").addColumn("Created").addColumn("Expires").addColumn("Reason"); + list.AddColumn("Number").AddColumn("Mask").AddColumn("By").AddColumn("Created").AddColumn("Expires").AddColumn("Reason"); this->ProcessList(source, params, list); } @@ -250,7 +250,7 @@ class CommandOSSNLine : public CommandOSSXLineBase void OnAdd(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - if (!this->xlm() || !ircdproto->CanSNLine) + if (!this->xlm() || !IRCD->CanSNLine) { source.Reply(_("Your IRCd does not support SNLINE")); return; @@ -268,7 +268,7 @@ class CommandOSSNLine : public CommandOSSXLineBase last_param = 3; } - expires = !expiry.empty() ? dotime(expiry) : Config->SNLineExpiry; + expires = !expiry.empty() ? Anope::DoTime(expiry) : Config->SNLineExpiry; /* If the expiry given does not contain a final letter, it's in days, * said the doc. Ah well. */ @@ -318,7 +318,7 @@ class CommandOSSNLine : public CommandOSSXLineBase return; } - service_reference<RegexProvider> provider("Regex", Config->RegexEngine); + ServiceReference<RegexProvider> provider("Regex", Config->RegexEngine); if (!provider) { source.Reply(_("Unable to find regex engine %s"), Config->RegexEngine.c_str()); @@ -354,7 +354,7 @@ class CommandOSSNLine : public CommandOSSXLineBase XLine *x = new XLine(mask, source.GetNick(), expires, reason); if (Config->AkillIds) - x->UID = XLineManager::GenerateUID(); + x->id = XLineManager::GenerateUID(); unsigned int affected = 0; for (user_map::const_iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it) @@ -366,7 +366,7 @@ class CommandOSSNLine : public CommandOSSXLineBase { source.Reply(USERHOST_MASK_TOO_WIDE, mask.c_str()); Log(LOG_ADMIN, source, this) << "tried to " << source.command << " " << percent << "% of the network (" << affected << " users)"; - x->destroy(); + x->Destroy(); return; } @@ -374,7 +374,7 @@ class CommandOSSNLine : public CommandOSSXLineBase FOREACH_RESULT(I_OnAddXLine, OnAddXLine(source, x, this->xlm())); if (MOD_RESULT == EVENT_STOP) { - x->destroy(); + x->Destroy(); return; } @@ -391,18 +391,18 @@ class CommandOSSNLine : public CommandOSSXLineBase User *user = it->second; ++it; - if (!user->HasMode(UMODE_OPER) && user->server != Me && Anope::Match(user->realname, x->Mask, false, true)) + if (!user->HasMode(UMODE_OPER) && user->server != Me && Anope::Match(user->realname, x->mask, false, true)) user->Kill(Config->ServerName, rreason); } } source.Reply(_("\002%s\002 added to the %s list."), mask.c_str(), source.command.c_str()); - Log(LOG_ADMIN, source, this) << "on " << mask << " (" << reason << ") expires in " << (expires ? duration(expires - Anope::CurTime) : "never") << " [affects " << affected << " user(s) (" << percent << "%)]"; - if (readonly) + Log(LOG_ADMIN, source, this) << "on " << mask << " (" << reason << ") expires in " << (expires ? Anope::Duration(expires - Anope::CurTime) : "never") << " [affects " << affected << " user(s) (" << percent << "%)]"; + if (Anope::ReadOnly) source.Reply(READ_ONLY_MODE); } - service_reference<XLineManager> snlines; + ServiceReference<XLineManager> snlines; public: CommandOSSNLine(Module *creator) : CommandOSSXLineBase(creator, "operserv/snline"), snlines("XLineManager", "xlinemanager/snline") { @@ -471,7 +471,7 @@ class CommandOSSQLine : public CommandOSSXLineBase void OnAdd(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - if (!this->xlm() || !ircdproto->CanSQLine) + if (!this->xlm() || !IRCD->CanSQLine) { source.Reply(_("Your IRCd does not support SQLINE")); return; @@ -489,7 +489,7 @@ class CommandOSSQLine : public CommandOSSXLineBase last_param = 3; } - expires = !expiry.empty() ? dotime(expiry) : Config->SQLineExpiry; + expires = !expiry.empty() ? Anope::DoTime(expiry) : Config->SQLineExpiry; /* If the expiry given does not contain a final letter, it's in days, * said the doc. Ah well. */ @@ -528,7 +528,7 @@ class CommandOSSQLine : public CommandOSSXLineBase return; } - service_reference<RegexProvider> provider("Regex", Config->RegexEngine); + ServiceReference<RegexProvider> provider("Regex", Config->RegexEngine); if (!provider) { source.Reply(_("Unable to find regex engine %s"), Config->RegexEngine.c_str()); @@ -557,7 +557,7 @@ class CommandOSSQLine : public CommandOSSXLineBase XLine *x = new XLine(mask, source.GetNick(), expires, reason); if (Config->AkillIds) - x->UID = XLineManager::GenerateUID(); + x->id = XLineManager::GenerateUID(); unsigned int affected = 0; for (user_map::const_iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it) @@ -569,7 +569,7 @@ class CommandOSSQLine : public CommandOSSXLineBase { source.Reply(USERHOST_MASK_TOO_WIDE, mask.c_str()); Log(LOG_ADMIN, source, this) << "tried to SQLine " << percent << "% of the network (" << affected << " users)"; - x->destroy(); + x->Destroy(); return; } @@ -577,7 +577,7 @@ class CommandOSSQLine : public CommandOSSXLineBase FOREACH_RESULT(I_OnAddXLine, OnAddXLine(source, x, this->xlm())); if (MOD_RESULT == EVENT_STOP) { - x->destroy(); + x->Destroy(); return; } @@ -616,7 +616,7 @@ class CommandOSSQLine : public CommandOSSXLineBase User *user = it->second; ++it; - if (!user->HasMode(UMODE_OPER) && user->server != Me && Anope::Match(user->nick, x->Mask, false, true)) + if (!user->HasMode(UMODE_OPER) && user->server != Me && Anope::Match(user->nick, x->mask, false, true)) user->Kill(Config->ServerName, rreason); } } @@ -625,13 +625,13 @@ class CommandOSSQLine : public CommandOSSXLineBase } source.Reply(_("\002%s\002 added to the SQLINE list."), mask.c_str()); - Log(LOG_ADMIN, source, this) << "on " << mask << " (" << reason << ") expires in " << (expires ? duration(expires - Anope::CurTime) : "never") << " [affects " << affected << " user(s) (" << percent << "%)]"; + Log(LOG_ADMIN, source, this) << "on " << mask << " (" << reason << ") expires in " << (expires ? Anope::Duration(expires - Anope::CurTime) : "never") << " [affects " << affected << " user(s) (" << percent << "%)]"; - if (readonly) + if (Anope::ReadOnly) source.Reply(READ_ONLY_MODE); } - service_reference<XLineManager> sqlines; + ServiceReference<XLineManager> sqlines; public: CommandOSSQLine(Module *creator) : CommandOSSXLineBase(creator, "operserv/sqline"), sqlines("XLineManager", "xlinemanager/sqline") { diff --git a/modules/commands/os_update.cpp b/modules/commands/os_update.cpp index b9b43230f..7bea34aaf 100644 --- a/modules/commands/os_update.cpp +++ b/modules/commands/os_update.cpp @@ -25,7 +25,7 @@ class CommandOSUpdate : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { source.Reply(_("Updating databases.")); - save_databases(); + Anope::SaveDatabases(); return; } |