From d33a0f75a5c0c584fbb7cc0076da36d494f39494 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 22 Nov 2012 00:50:33 -0500 Subject: Pretty large coding style cleanup, in source doc cleanup, and allow protocol mods to depend on each other --- modules/commands/bs_assign.cpp | 10 +-- modules/commands/bs_badwords.cpp | 24 +++---- modules/commands/bs_bot.cpp | 97 ++++++++-------------------- modules/commands/bs_botlist.cpp | 4 +- modules/commands/bs_control.cpp | 8 +-- modules/commands/bs_info.cpp | 12 ++-- modules/commands/bs_kick.cpp | 14 ++-- modules/commands/bs_set.cpp | 2 +- modules/commands/bs_set_dontkickops.cpp | 4 +- modules/commands/bs_set_dontkickvoices.cpp | 4 +- modules/commands/bs_set_fantasy.cpp | 4 +- modules/commands/bs_set_greet.cpp | 4 +- modules/commands/bs_set_nobot.cpp | 2 +- modules/commands/bs_set_private.cpp | 2 +- modules/commands/cs_access.cpp | 70 ++++++++++---------- modules/commands/cs_akick.cpp | 48 +++++++------- modules/commands/cs_appendtopic.cpp | 2 +- modules/commands/cs_ban.cpp | 11 ++-- modules/commands/cs_clearusers.cpp | 2 +- modules/commands/cs_clone.cpp | 12 ++-- modules/commands/cs_drop.cpp | 6 +- modules/commands/cs_enforce.cpp | 16 ++--- modules/commands/cs_entrymsg.cpp | 32 ++++----- modules/commands/cs_fantasy_stats.cpp | 6 +- modules/commands/cs_fantasy_top.cpp | 4 +- modules/commands/cs_flags.cpp | 30 ++++----- modules/commands/cs_getkey.cpp | 2 +- modules/commands/cs_info.cpp | 10 +-- modules/commands/cs_invite.cpp | 6 +- modules/commands/cs_kick.cpp | 6 +- modules/commands/cs_list.cpp | 9 +-- modules/commands/cs_log.cpp | 22 +++---- modules/commands/cs_mode.cpp | 44 ++++++------- modules/commands/cs_modes.cpp | 4 +- modules/commands/cs_register.cpp | 10 +-- modules/commands/cs_saset.cpp | 2 +- modules/commands/cs_saset_noexpire.cpp | 2 +- modules/commands/cs_seen.cpp | 44 ++++++------- modules/commands/cs_set.cpp | 2 +- modules/commands/cs_set_autoop.cpp | 2 +- modules/commands/cs_set_bantype.cpp | 2 +- modules/commands/cs_set_chanstats.cpp | 2 +- modules/commands/cs_set_description.cpp | 2 +- modules/commands/cs_set_founder.cpp | 4 +- modules/commands/cs_set_keeptopic.cpp | 2 +- modules/commands/cs_set_misc.cpp | 14 ++-- modules/commands/cs_set_peace.cpp | 2 +- modules/commands/cs_set_persist.cpp | 21 +++--- modules/commands/cs_set_private.cpp | 2 +- modules/commands/cs_set_restricted.cpp | 2 +- modules/commands/cs_set_secure.cpp | 2 +- modules/commands/cs_set_securefounder.cpp | 2 +- modules/commands/cs_set_secureops.cpp | 2 +- modules/commands/cs_set_signkick.cpp | 2 +- modules/commands/cs_set_successor.cpp | 4 +- modules/commands/cs_set_topiclock.cpp | 2 +- modules/commands/cs_status.cpp | 12 ++-- modules/commands/cs_suspend.cpp | 26 ++++---- modules/commands/cs_sync.cpp | 4 +- modules/commands/cs_tban.cpp | 17 +++-- modules/commands/cs_topic.cpp | 2 +- modules/commands/cs_unban.cpp | 6 +- modules/commands/cs_updown.cpp | 10 +-- modules/commands/cs_xop.cpp | 66 +++++++++---------- modules/commands/gl_global.cpp | 4 +- modules/commands/help.cpp | 7 +- modules/commands/hs_del.cpp | 6 +- modules/commands/hs_group.cpp | 4 +- modules/commands/hs_list.cpp | 10 +-- modules/commands/hs_off.cpp | 4 +- modules/commands/hs_on.cpp | 8 +-- modules/commands/hs_request.cpp | 44 ++++++------- modules/commands/hs_set.cpp | 18 +++--- modules/commands/ms_cancel.cpp | 10 +-- modules/commands/ms_check.cpp | 6 +- modules/commands/ms_del.cpp | 18 +++--- modules/commands/ms_ignore.cpp | 12 ++-- modules/commands/ms_info.cpp | 4 +- modules/commands/ms_list.cpp | 20 +++--- modules/commands/ms_read.cpp | 20 +++--- modules/commands/ms_rsend.cpp | 10 +-- modules/commands/ms_send.cpp | 6 +- modules/commands/ms_sendall.cpp | 8 +-- modules/commands/ms_set.cpp | 6 +- modules/commands/ms_staff.cpp | 8 +-- modules/commands/ns_access.cpp | 2 +- modules/commands/ns_ajoin.cpp | 47 +++++++------- modules/commands/ns_alist.cpp | 10 +-- modules/commands/ns_cert.cpp | 19 +++--- modules/commands/ns_drop.cpp | 8 +-- modules/commands/ns_getpass.cpp | 6 +- modules/commands/ns_ghost.cpp | 18 +++--- modules/commands/ns_group.cpp | 40 ++++++------ modules/commands/ns_identify.cpp | 6 +- modules/commands/ns_info.cpp | 36 +++++------ modules/commands/ns_list.cpp | 9 +-- modules/commands/ns_logout.cpp | 12 ++-- modules/commands/ns_recover.cpp | 20 +++--- modules/commands/ns_register.cpp | 36 +++++------ modules/commands/ns_release.cpp | 10 +-- modules/commands/ns_resetpass.cpp | 10 +-- modules/commands/ns_saset.cpp | 8 +-- modules/commands/ns_saset_noexpire.cpp | 2 +- modules/commands/ns_sendpass.cpp | 12 ++-- modules/commands/ns_set.cpp | 6 +- modules/commands/ns_set_autoop.cpp | 2 +- modules/commands/ns_set_chanstats.cpp | 2 +- modules/commands/ns_set_display.cpp | 4 +- modules/commands/ns_set_email.cpp | 6 +- modules/commands/ns_set_greet.cpp | 2 +- modules/commands/ns_set_hide.cpp | 2 +- modules/commands/ns_set_kill.cpp | 2 +- modules/commands/ns_set_language.cpp | 20 +++--- modules/commands/ns_set_message.cpp | 2 +- modules/commands/ns_set_misc.cpp | 14 ++-- modules/commands/ns_set_private.cpp | 2 +- modules/commands/ns_set_secure.cpp | 2 +- modules/commands/ns_status.cpp | 4 +- modules/commands/ns_suspend.cpp | 28 ++++---- modules/commands/ns_update.cpp | 2 +- modules/commands/os_akill.cpp | 72 ++++++++++----------- modules/commands/os_chankill.cpp | 6 +- modules/commands/os_config.cpp | 6 +- modules/commands/os_defcon.cpp | 84 ++++++++++++------------ modules/commands/os_dns.cpp | 54 ++++++++-------- modules/commands/os_forbid.cpp | 46 +++++++------ modules/commands/os_forbid.h | 10 +-- modules/commands/os_ignore.cpp | 17 +++-- modules/commands/os_ignore.h | 10 +-- modules/commands/os_jupe.cpp | 8 +-- modules/commands/os_kick.cpp | 4 +- modules/commands/os_kill.cpp | 2 +- modules/commands/os_list.cpp | 16 ++--- modules/commands/os_login.cpp | 2 +- modules/commands/os_logsearch.cpp | 2 +- modules/commands/os_mode.cpp | 12 ++-- modules/commands/os_modinfo.cpp | 10 ++- modules/commands/os_module.cpp | 11 +++- modules/commands/os_news.cpp | 28 ++++---- modules/commands/os_news.h | 10 +-- modules/commands/os_noop.cpp | 4 +- modules/commands/os_oline.cpp | 8 +-- modules/commands/os_oper.cpp | 16 ++--- modules/commands/os_session.cpp | 72 ++++++++++----------- modules/commands/os_session.h | 10 +-- modules/commands/os_set.cpp | 32 ++++----- modules/commands/os_shutdown.cpp | 16 ++--- modules/commands/os_stats.cpp | 34 +++++----- modules/commands/os_svsnick.cpp | 16 ++--- modules/commands/os_sxline.cpp | 100 ++++++++++++++--------------- modules/commands/os_update.cpp | 2 +- 151 files changed, 1060 insertions(+), 1109 deletions(-) (limited to 'modules/commands') 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 ¶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", info.name); + ServiceReference 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 ¶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 ¶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 ¶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 ¶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 ¶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 ¶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(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 provider("AccessProvider", "access/access"); + ServiceReference provider("AccessProvider", "access/access"); if (!provider) return; AccessChanAccess *access = anope_dynamic_static_cast(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 &privs = PrivilegeManager::GetPrivileges(); @@ -671,7 +671,7 @@ class CommandCSLevels : public Command else entry["Level"] = stringify(j); - list.addEntry(entry); + list.AddEntry(entry); } std::vector 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 &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 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 ci; + Serialize::Reference 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 >, ExtensibleItem +struct EntryMessageList : Serialize::Checker >, ExtensibleItem { - EntryMessageList() : serialize_checker >("EntryMsg") { } + EntryMessageList() : Serialize::Checker >("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 replies; @@ -159,7 +159,7 @@ class CommandEntryMessage : public Command unsigned i = convertTo(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 ¶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 sql; + ServiceReference 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", engine); + this->sql = ServiceReference("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 sql; + ServiceReference 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", engine); + this->sql = ServiceReference("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 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 provider("AccessProvider", "access/flags"); + ServiceReference provider("AccessProvider", "access/flags"); if (!provider) return; FlagsChanAccess *access = anope_dynamic_static_cast(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