summaryrefslogtreecommitdiff
path: root/modules/commands
diff options
context:
space:
mode:
Diffstat (limited to 'modules/commands')
-rw-r--r--modules/commands/bs_badwords.cpp8
-rw-r--r--modules/commands/bs_bot.cpp13
-rw-r--r--modules/commands/bs_botlist.cpp2
-rw-r--r--modules/commands/bs_info.cpp10
-rw-r--r--modules/commands/bs_kick.cpp4
-rw-r--r--modules/commands/cs_access.cpp24
-rw-r--r--modules/commands/cs_akick.cpp17
-rw-r--r--modules/commands/cs_clone.cpp11
-rw-r--r--modules/commands/cs_drop.cpp2
-rw-r--r--modules/commands/cs_enforce.cpp14
-rw-r--r--modules/commands/cs_entrymsg.cpp25
-rw-r--r--modules/commands/cs_fantasy_stats.cpp5
-rw-r--r--modules/commands/cs_flags.cpp8
-rw-r--r--modules/commands/cs_info.cpp6
-rw-r--r--modules/commands/cs_list.cpp4
-rw-r--r--modules/commands/cs_log.cpp67
-rw-r--r--modules/commands/cs_mode.cpp16
-rw-r--r--modules/commands/cs_modes.cpp30
-rw-r--r--modules/commands/cs_register.cpp11
-rw-r--r--modules/commands/cs_saset.cpp4
-rw-r--r--modules/commands/cs_seen.cpp22
-rw-r--r--modules/commands/cs_set.cpp4
-rw-r--r--modules/commands/cs_set_founder.cpp5
-rw-r--r--modules/commands/cs_set_misc.cpp30
-rw-r--r--modules/commands/cs_set_successor.cpp2
-rw-r--r--modules/commands/cs_suspend.cpp34
-rw-r--r--modules/commands/cs_updown.cpp4
-rw-r--r--modules/commands/cs_xop.cpp20
-rw-r--r--modules/commands/help.cpp10
-rw-r--r--modules/commands/hs_del.cpp4
-rw-r--r--modules/commands/hs_group.cpp9
-rw-r--r--modules/commands/hs_list.cpp4
-rw-r--r--modules/commands/hs_off.cpp2
-rw-r--r--modules/commands/hs_on.cpp2
-rw-r--r--modules/commands/hs_request.cpp33
-rw-r--r--modules/commands/hs_set.cpp9
-rw-r--r--modules/commands/ms_cancel.cpp17
-rw-r--r--modules/commands/ms_check.cpp14
-rw-r--r--modules/commands/ms_del.cpp33
-rw-r--r--modules/commands/ms_info.cpp43
-rw-r--r--modules/commands/ms_list.cpp21
-rw-r--r--modules/commands/ms_read.cpp31
-rw-r--r--modules/commands/ms_rsend.cpp4
-rw-r--r--modules/commands/ms_sendall.cpp6
-rw-r--r--modules/commands/ms_set.cpp35
-rw-r--r--modules/commands/ms_staff.cpp4
-rw-r--r--modules/commands/ns_access.cpp3
-rw-r--r--modules/commands/ns_ajoin.cpp35
-rw-r--r--modules/commands/ns_alist.cpp4
-rw-r--r--modules/commands/ns_cert.cpp16
-rw-r--r--modules/commands/ns_drop.cpp2
-rw-r--r--modules/commands/ns_getemail.cpp4
-rw-r--r--modules/commands/ns_getpass.cpp2
-rw-r--r--modules/commands/ns_ghost.cpp2
-rw-r--r--modules/commands/ns_group.cpp82
-rw-r--r--modules/commands/ns_info.cpp2
-rw-r--r--modules/commands/ns_list.cpp4
-rw-r--r--modules/commands/ns_register.cpp39
-rw-r--r--modules/commands/ns_resetpass.cpp18
-rw-r--r--modules/commands/ns_saset.cpp6
-rw-r--r--modules/commands/ns_sendpass.cpp6
-rw-r--r--modules/commands/ns_set.cpp4
-rw-r--r--modules/commands/ns_set_autoop.cpp2
-rw-r--r--modules/commands/ns_set_display.cpp4
-rw-r--r--modules/commands/ns_set_email.cpp17
-rw-r--r--modules/commands/ns_set_greet.cpp2
-rw-r--r--modules/commands/ns_set_hide.cpp2
-rw-r--r--modules/commands/ns_set_kill.cpp2
-rw-r--r--modules/commands/ns_set_language.cpp2
-rw-r--r--modules/commands/ns_set_message.cpp2
-rw-r--r--modules/commands/ns_set_misc.cpp32
-rw-r--r--modules/commands/ns_set_private.cpp2
-rw-r--r--modules/commands/ns_set_secure.cpp2
-rw-r--r--modules/commands/ns_status.cpp2
-rw-r--r--modules/commands/ns_suspend.cpp45
-rw-r--r--modules/commands/os_akill.cpp8
-rw-r--r--modules/commands/os_forbid.cpp8
-rw-r--r--modules/commands/os_forbid.h24
-rw-r--r--modules/commands/os_ignore.cpp6
-rw-r--r--modules/commands/os_ignore.h28
-rw-r--r--modules/commands/os_modinfo.cpp4
-rw-r--r--modules/commands/os_news.cpp12
-rw-r--r--modules/commands/os_news.h24
-rw-r--r--modules/commands/os_oper.cpp34
-rw-r--r--modules/commands/os_session.cpp8
-rw-r--r--modules/commands/os_session.h24
-rw-r--r--modules/commands/os_stats.cpp9
-rw-r--r--modules/commands/os_sxline.cpp12
88 files changed, 709 insertions, 520 deletions
diff --git a/modules/commands/bs_badwords.cpp b/modules/commands/bs_badwords.cpp
index bb7a073f1..eaf00d347 100644
--- a/modules/commands/bs_badwords.cpp
+++ b/modules/commands/bs_badwords.cpp
@@ -81,7 +81,7 @@ class CommandBSBadwords : public Command
if (!Number || Number > ci->GetBadWordCount())
return;
- BadWord *bw = ci->GetBadWord(Number - 1);
+ const BadWord *bw = ci->GetBadWord(Number - 1);
ListFormatter::ListEntry entry;
entry["Number"] = stringify(Number);
entry["Word"] = bw->word;
@@ -96,7 +96,7 @@ class CommandBSBadwords : public Command
{
for (unsigned i = 0, end = ci->GetBadWordCount(); i < end; ++i)
{
- BadWord *bw = ci->GetBadWord(i);
+ const BadWord *bw = ci->GetBadWord(i);
if (!word.empty() && !Anope::Match(bw->word, word))
continue;
@@ -154,7 +154,7 @@ class CommandBSBadwords : public Command
for (unsigned i = 0, end = ci->GetBadWordCount(); i < end; ++i)
{
- BadWord *bw = ci->GetBadWord(i);
+ const BadWord *bw = ci->GetBadWord(i);
if (!bw->word.empty() && ((Config->BSCaseSensitive && realword.equals_cs(bw->word)) || (!Config->BSCaseSensitive && realword.equals_ci(bw->word))))
{
@@ -183,7 +183,7 @@ class CommandBSBadwords : public Command
else
{
unsigned i, end;
- BadWord *badword;
+ const BadWord *badword;
for (i = 0, end = ci->GetBadWordCount(); i < end; ++i)
{
diff --git a/modules/commands/bs_bot.cpp b/modules/commands/bs_bot.cpp
index 526cd922c..b1f22909f 100644
--- a/modules/commands/bs_bot.cpp
+++ b/modules/commands/bs_bot.cpp
@@ -22,7 +22,6 @@ class CommandBSBot : public Command
const Anope::string &user = params[2];
const Anope::string &host = params[3];
const Anope::string &real = params[4];
- BotInfo *bi;
if (findbot(nick))
{
@@ -93,7 +92,7 @@ class CommandBSBot : public Command
return;
}
- bi = new BotInfo(nick, user, host, real);
+ BotInfo *bi = new BotInfo(nick, user, host, real);
Log(LOG_ADMIN, source.u, this) << "ADD " << bi->GetMask() << " " << bi->realname;
@@ -110,7 +109,6 @@ class CommandBSBot : public Command
const Anope::string &user = params.size() > 3 ? params[3] : "";
const Anope::string &host = params.size() > 4 ? params[4] : "";
const Anope::string &real = params.size() > 5 ? params[5] : "";
- BotInfo *bi;
if (oldnick.empty() || nick.empty())
{
@@ -118,7 +116,8 @@ class CommandBSBot : public Command
return;
}
- if (!(bi = findbot(oldnick)))
+ BotInfo *bi = findbot(oldnick);
+ if (!bi)
{
source.Reply(BOT_DOES_NOT_EXIST, oldnick.c_str());
return;
@@ -263,7 +262,6 @@ class CommandBSBot : public Command
void DoDel(CommandSource &source, const std::vector<Anope::string> &params)
{
const Anope::string &nick = params[1];
- BotInfo *bi;
if (nick.empty())
{
@@ -271,7 +269,8 @@ class CommandBSBot : public Command
return;
}
- if (!(bi = findbot(nick)))
+ BotInfo *bi = findbot(nick);
+ if (!bi)
{
source.Reply(BOT_DOES_NOT_EXIST, nick.c_str());
return;
@@ -288,7 +287,7 @@ class CommandBSBot : public Command
Log(LOG_ADMIN, source.u, this) << "DEL " << bi->nick;
source.Reply(_("Bot \002%s\002 has been deleted."), nick.c_str());
- delete bi;
+ bi->destroy();
return;
}
public:
diff --git a/modules/commands/bs_botlist.cpp b/modules/commands/bs_botlist.cpp
index ed50371fc..68fb7bdfa 100644
--- a/modules/commands/bs_botlist.cpp
+++ b/modules/commands/bs_botlist.cpp
@@ -30,7 +30,7 @@ class CommandBSBotList : public Command
list.addColumn("Nick").addColumn("Mask");
- for (Anope::insensitive_map<BotInfo *>::const_iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it)
+ for (Anope::insensitive_map<BotInfo *>::const_iterator it = BotListByNick->begin(), it_end = BotListByNick->end(); it != it_end; ++it)
{
BotInfo *bi = it->second;
diff --git a/modules/commands/bs_info.cpp b/modules/commands/bs_info.cpp
index ed36818b3..251bd84df 100644
--- a/modules/commands/bs_info.cpp
+++ b/modules/commands/bs_info.cpp
@@ -17,12 +17,12 @@
class CommandBSInfo : public Command
{
private:
- void send_bot_channels(std::vector<Anope::string> &buffers, BotInfo *bi)
+ void send_bot_channels(std::vector<Anope::string> &buffers, const BotInfo *bi)
{
Anope::string buf;
- for (registered_channel_map::const_iterator it = RegisteredChannelList.begin(), it_end = RegisteredChannelList.end(); it != it_end; ++it)
+ for (registered_channel_map::const_iterator it = RegisteredChannelList->begin(), it_end = RegisteredChannelList->end(); it != it_end; ++it)
{
- ChannelInfo *ci = it->second;
+ const ChannelInfo *ci = it->second;
if (ci->bi == bi)
{
@@ -38,7 +38,7 @@ class CommandBSInfo : public Command
buffers.push_back(buf);
}
- void CheckOptStr(Anope::string &buf, BotServFlag flag, const char *option, Flags<BotServFlag> &flags, NickCore *nc)
+ void CheckOptStr(Anope::string &buf, BotServFlag flag, const char *option, Flags<BotServFlag> &flags, const NickCore *nc)
{
if (flags.HasFlag(flag))
{
@@ -60,7 +60,7 @@ class CommandBSInfo : public Command
const Anope::string &query = params[0];
User *u = source.u;
- BotInfo *bi = findbot(query);
+ const BotInfo *bi = findbot(query);
ChannelInfo *ci;
InfoFormatter info(u);
diff --git a/modules/commands/bs_kick.cpp b/modules/commands/bs_kick.cpp
index 42b43e7a1..819c5af74 100644
--- a/modules/commands/bs_kick.cpp
+++ b/modules/commands/bs_kick.cpp
@@ -900,7 +900,7 @@ class BSKick : public Module
for (unsigned i = 0, end = ci->GetBadWordCount(); i < end; ++i)
{
- BadWord *bw = ci->GetBadWord(i);
+ const BadWord *bw = ci->GetBadWord(i);
if (bw->type == BW_ANY && ((Config->BSCaseSensitive && nbuf.find(bw->word) != Anope::string::npos) || (!Config->BSCaseSensitive && nbuf.find_ci(bw->word) != Anope::string::npos)))
mustkick = true;
@@ -1012,7 +1012,7 @@ class BSKick : public Module
Channel *chan = (*it)->chan;
++it;
- if (chan->ci != NULL && chan->ci->botflags.HasFlag(BS_KICK_AMSGS) && !chan->ci->AccessFor(u).HasPriv("NOKICK"))
+ if (chan->ci && chan->ci->botflags.HasFlag(BS_KICK_AMSGS) && !chan->ci->AccessFor(u).HasPriv("NOKICK"))
{
check_ban(chan->ci, u, TTB_AMSGS);
bot_kick(chan->ci, u, _("Don't use AMSGs!"));
diff --git a/modules/commands/cs_access.cpp b/modules/commands/cs_access.cpp
index aa32d29ef..a37446df2 100644
--- a/modules/commands/cs_access.cpp
+++ b/modules/commands/cs_access.cpp
@@ -15,7 +15,7 @@
static std::map<Anope::string, int16_t, ci::less> defaultLevels;
-static void reset_levels(ChannelInfo *ci)
+static inline void reset_levels(ChannelInfo *ci)
{
ci->ClearLevels();
for (std::map<Anope::string, int16_t, ci::less>::iterator it = defaultLevels.begin(), it_end = defaultLevels.end(); it != it_end; ++it)
@@ -36,7 +36,7 @@ class AccessChanAccess : public ChanAccess
return this->ci->GetLevel(name) != ACCESS_INVALID && this->level >= this->ci->GetLevel(name);
}
- Anope::string Serialize()
+ Anope::string Serialize() const
{
return stringify(this->level);
}
@@ -46,11 +46,11 @@ class AccessChanAccess : public ChanAccess
this->level = convertTo<int>(data);
}
- static int DetermineLevel(ChanAccess *access)
+ static int DetermineLevel(const ChanAccess *access)
{
if (access->provider->name == "access/access")
{
- AccessChanAccess *aaccess = debug_cast<AccessChanAccess *>(access);
+ const AccessChanAccess *aaccess = debug_cast<const AccessChanAccess *>(access);
return aaccess->level;
}
else
@@ -108,7 +108,7 @@ class CommandCSAccess : public Command
}
AccessGroup u_access = ci->AccessFor(u);
- ChanAccess *highest = u_access.Highest();
+ const ChanAccess *highest = u_access.Highest();
int u_level = (highest ? AccessChanAccess::DetermineLevel(highest) : 0);
if (level >= u_level && !u_access.Founder && !u->HasPriv("chanserv/access/modify"))
{
@@ -123,7 +123,7 @@ class CommandCSAccess : public Command
bool override = !ci->AccessFor(u).HasPriv("ACCESS_CHANGE") || (level >= u_level && !u_access.Founder);
- if (mask.find_first_of("!*@") == Anope::string::npos && findnick(mask) == NULL)
+ if (mask.find_first_of("!*@") == Anope::string::npos && !findnick(mask))
{
User *targ = finduser(mask);
if (targ != NULL)
@@ -137,7 +137,7 @@ class CommandCSAccess : public Command
for (unsigned i = ci->GetAccessCount(); i > 0; --i)
{
- ChanAccess *access = ci->GetAccess(i - 1);
+ const ChanAccess *access = ci->GetAccess(i - 1);
if (mask.equals_ci(access->mask))
{
/* Don't allow lowering from a level >= u_level */
@@ -230,7 +230,7 @@ class CommandCSAccess : public Command
ChanAccess *access = ci->GetAccess(Number - 1);
AccessGroup u_access = ci->AccessFor(user);
- ChanAccess *u_highest = u_access.Highest();
+ const ChanAccess *u_highest = u_access.Highest();
if ((u_highest ? AccessChanAccess::DetermineLevel(u_highest) : 0) <= AccessChanAccess::DetermineLevel(access) && !u_access.Founder && !this->override && !access->mask.equals_ci(user->Account()->display))
{
@@ -255,7 +255,7 @@ class CommandCSAccess : public Command
else
{
AccessGroup u_access = ci->AccessFor(u);
- ChanAccess *highest = u_access.Highest();
+ const ChanAccess *highest = u_access.Highest();
int u_level = (highest ? AccessChanAccess::DetermineLevel(highest) : 0);
for (unsigned i = ci->GetAccessCount(); i > 0; --i)
@@ -308,7 +308,7 @@ class CommandCSAccess : public Command
if (!number || number > ci->GetAccessCount())
return;
- ChanAccess *access = ci->GetAccess(number - 1);
+ const ChanAccess *access = ci->GetAccess(number - 1);
Anope::string timebuf;
if (ci->c)
@@ -339,7 +339,7 @@ class CommandCSAccess : public Command
{
for (unsigned i = 0, end = ci->GetAccessCount(); i < end; ++i)
{
- ChanAccess *access = ci->GetAccess(i);
+ const ChanAccess *access = ci->GetAccess(i);
if (!nick.empty() && !Anope::Match(access->mask, nick))
continue;
@@ -470,7 +470,7 @@ class CommandCSAccess : public Command
has_access = true;
else if (is_del)
{
- NickAlias *na = findnick(nick);
+ const NickAlias *na = findnick(nick);
if (na && na->nc == u->Account())
has_access = true;
}
diff --git a/modules/commands/cs_akick.cpp b/modules/commands/cs_akick.cpp
index beaa8ffd3..107f97584 100644
--- a/modules/commands/cs_akick.cpp
+++ b/modules/commands/cs_akick.cpp
@@ -54,9 +54,9 @@ class CommandCSAKick : public Command
Anope::string mask = params[2];
Anope::string reason = params.size() > 3 ? params[3] : "";
- NickAlias *na = findnick(mask);
+ const NickAlias *na = findnick(mask);
NickCore *nc = NULL;
- AutoKick *akick;
+ const AutoKick *akick;
if (!na)
{
@@ -113,7 +113,7 @@ class CommandCSAKick : public Command
/* Match against the lastusermask of all nickalias's with equal
* or higher access. - Viper */
- for (nickalias_map::const_iterator it = NickAliasList.begin(), it_end = NickAliasList.end(); it != it_end; ++it)
+ for (nickalias_map::const_iterator it = NickAliasList->begin(), it_end = NickAliasList->end(); it != it_end; ++it)
{
na = it->second;
@@ -166,7 +166,6 @@ class CommandCSAKick : public Command
User *u = source.u;
const Anope::string &mask = params[2];
- AutoKick *akick;
unsigned i, end;
if (!ci->GetAkickCount())
@@ -218,12 +217,12 @@ class CommandCSAKick : public Command
}
else
{
- NickAlias *na = findnick(mask);
- NickCore *nc = na ? na->nc : NULL;
+ const NickAlias *na = findnick(mask);
+ const NickCore *nc = na ? *na->nc : NULL;
for (i = 0, end = ci->GetAkickCount(); i < end; ++i)
{
- akick = ci->GetAkick(i);
+ const AutoKick *akick = ci->GetAkick(i);
if ((akick->HasFlag(AK_ISNICK) && akick->nc == nc) || (!akick->HasFlag(AK_ISNICK) && mask.equals_ci(akick->mask)))
break;
@@ -267,7 +266,7 @@ class CommandCSAKick : public Command
if (!number || number > ci->GetAkickCount())
return;
- AutoKick *akick = ci->GetAkick(number - 1);
+ const AutoKick *akick = ci->GetAkick(number - 1);
Anope::string timebuf, lastused;
if (akick->addtime)
@@ -296,7 +295,7 @@ class CommandCSAKick : public Command
{
for (unsigned i = 0, end = ci->GetAkickCount(); i < end; ++i)
{
- AutoKick *akick = ci->GetAkick(i);
+ const AutoKick *akick = ci->GetAkick(i);
if (!mask.empty())
{
diff --git a/modules/commands/cs_clone.cpp b/modules/commands/cs_clone.cpp
index 1676c70f6..be6907b81 100644
--- a/