summaryrefslogtreecommitdiff
path: root/modules/commands
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2014-05-28 12:07:29 -0400
committerAdam <Adam@anope.org>2014-05-28 12:07:54 -0400
commitf29e1cf383529a1a29f02b0669d973f5ee0b7a66 (patch)
tree3c33db276dc9328235bbd572641521ed44458176 /modules/commands
parent1253c70e0682fa1490c99c3d2869049a0e3fa2e0 (diff)
Move most of the core pseudoclient logic to modules
Diffstat (limited to 'modules/commands')
-rw-r--r--modules/commands/bs_assign.cpp18
-rw-r--r--modules/commands/bs_badwords.cpp28
-rw-r--r--modules/commands/bs_bot.cpp10
-rw-r--r--modules/commands/bs_control.cpp4
-rw-r--r--modules/commands/bs_info.cpp17
-rw-r--r--modules/commands/bs_kick.cpp68
-rw-r--r--modules/commands/bs_set.cpp6
-rw-r--r--modules/commands/cs_access.cpp155
-rw-r--r--modules/commands/cs_akick.cpp202
-rw-r--r--modules/commands/cs_ban.cpp8
-rw-r--r--modules/commands/cs_clone.cpp24
-rw-r--r--modules/commands/cs_drop.cpp2
-rw-r--r--modules/commands/cs_enforce.cpp20
-rw-r--r--modules/commands/cs_entrymsg.cpp18
-rw-r--r--modules/commands/cs_flags.cpp46
-rw-r--r--modules/commands/cs_getkey.cpp2
-rw-r--r--modules/commands/cs_info.cpp4
-rw-r--r--modules/commands/cs_invite.cpp2
-rw-r--r--modules/commands/cs_kick.cpp8
-rw-r--r--modules/commands/cs_list.cpp17
-rw-r--r--modules/commands/cs_log.cpp12
-rw-r--r--modules/commands/cs_mode.cpp48
-rw-r--r--modules/commands/cs_register.cpp8
-rw-r--r--modules/commands/cs_seen.cpp15
-rw-r--r--modules/commands/cs_set.cpp60
-rw-r--r--modules/commands/cs_set_misc.cpp8
-rw-r--r--modules/commands/cs_status.cpp11
-rw-r--r--modules/commands/cs_suspend.cpp14
-rw-r--r--modules/commands/cs_sync.cpp4
-rw-r--r--modules/commands/cs_topic.cpp16
-rw-r--r--modules/commands/cs_unban.cpp6
-rw-r--r--modules/commands/cs_updown.cpp4
-rw-r--r--modules/commands/cs_xop.cpp66
-rw-r--r--modules/commands/greet.cpp14
-rw-r--r--modules/commands/help.cpp6
-rw-r--r--modules/commands/hs_del.cpp6
-rw-r--r--modules/commands/hs_group.cpp12
-rw-r--r--modules/commands/hs_list.cpp4
-rw-r--r--modules/commands/hs_off.cpp2
-rw-r--r--modules/commands/hs_on.cpp2
-rw-r--r--modules/commands/hs_request.cpp20
-rw-r--r--modules/commands/hs_set.cpp10
-rw-r--r--modules/commands/ms_cancel.cpp36
-rw-r--r--modules/commands/ms_check.cpp33
-rw-r--r--modules/commands/ms_del.cpp18
-rw-r--r--modules/commands/ms_ignore.cpp10
-rw-r--r--modules/commands/ms_info.cpp20
-rw-r--r--modules/commands/ms_list.cpp18
-rw-r--r--modules/commands/ms_read.cpp28
-rw-r--r--modules/commands/ms_rsend.cpp12
-rw-r--r--modules/commands/ms_sendall.cpp4
-rw-r--r--modules/commands/ms_set.cpp26
-rw-r--r--modules/commands/ms_staff.cpp4
-rw-r--r--modules/commands/ns_access.cpp12
-rw-r--r--modules/commands/ns_ajoin.cpp26
-rw-r--r--modules/commands/ns_alist.cpp14
-rw-r--r--modules/commands/ns_cert.cpp34
-rw-r--r--modules/commands/ns_drop.cpp2
-rw-r--r--modules/commands/ns_getemail.cpp6
-rw-r--r--modules/commands/ns_getpass.cpp4
-rw-r--r--modules/commands/ns_group.cpp55
-rw-r--r--modules/commands/ns_identify.cpp22
-rw-r--r--modules/commands/ns_info.cpp6
-rw-r--r--modules/commands/ns_list.cpp20
-rw-r--r--modules/commands/ns_recover.cpp39
-rw-r--r--modules/commands/ns_register.cpp24
-rw-r--r--modules/commands/ns_resetpass.cpp12
-rw-r--r--modules/commands/ns_set.cpp56
-rw-r--r--modules/commands/ns_set_misc.cpp12
-rw-r--r--modules/commands/ns_status.cpp2
-rw-r--r--modules/commands/ns_suspend.cpp16
-rw-r--r--modules/commands/ns_update.cpp2
-rw-r--r--modules/commands/os_akill.cpp2
-rw-r--r--modules/commands/os_config.cpp2
-rw-r--r--modules/commands/os_defcon.cpp10
-rw-r--r--modules/commands/os_dns.cpp14
-rw-r--r--modules/commands/os_forbid.cpp10
-rw-r--r--modules/commands/os_ignore.cpp6
-rw-r--r--modules/commands/os_info.cpp16
-rw-r--r--modules/commands/os_logsearch.cpp2
-rw-r--r--modules/commands/os_mode.cpp2
-rw-r--r--modules/commands/os_module.cpp2
-rw-r--r--modules/commands/os_news.cpp2
-rw-r--r--modules/commands/os_oline.cpp2
-rw-r--r--modules/commands/os_oper.cpp16
-rw-r--r--modules/commands/os_session.cpp6
-rw-r--r--modules/commands/os_set.cpp2
-rw-r--r--modules/commands/os_stats.cpp6
88 files changed, 886 insertions, 794 deletions
diff --git a/modules/commands/bs_assign.cpp b/modules/commands/bs_assign.cpp
index 90fb7ed56..fe7938fc8 100644
--- a/modules/commands/bs_assign.cpp
+++ b/modules/commands/bs_assign.cpp
@@ -32,7 +32,7 @@ class CommandBSAssign : public Command
return;
}
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
@@ -46,7 +46,7 @@ class CommandBSAssign : public Command
return;
}
- AccessGroup access = source.AccessFor(ci);
+ ChanServ::AccessGroup access = source.AccessFor(ci);
if (ci->HasExt("BS_NOBOT") || (!access.HasPriv("ASSIGN") && !source.HasPriv("botserv/administration")))
{
source.Reply(ACCESS_DENIED);
@@ -100,14 +100,14 @@ class CommandBSUnassign : public Command
return;
}
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
- AccessGroup access = source.AccessFor(ci);
+ ChanServ::AccessGroup access = source.AccessFor(ci);
if (!source.HasPriv("botserv/administration") && !access.HasPriv("ASSIGN"))
{
source.Reply(ACCESS_DENIED);
@@ -157,7 +157,7 @@ class CommandBSSetNoBot : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
const Anope::string &value = params[1];
if (Anope::ReadOnly)
@@ -174,7 +174,7 @@ class CommandBSSetNoBot : public Command
if (value.equals_ci("ON"))
{
- Log(LOG_ADMIN, source, this, ci) << "to enable nobot";
+ Log(LOG_ADMIN, source, this, ci) << "to enable nobot";
ci->Extend<bool>("BS_NOBOT");
if (ci->bi)
@@ -183,7 +183,7 @@ class CommandBSSetNoBot : public Command
}
else if (value.equals_ci("OFF"))
{
- Log(LOG_ADMIN, source, this, ci) << "to disable nobot";
+ Log(LOG_ADMIN, source, this, ci) << "to disable nobot";
ci->Shrink<bool>("BS_NOBOT");
source.Reply(_("No-bot mode is now \002off\002 on channel %s."), ci->name.c_str());
@@ -230,7 +230,7 @@ class BSAssign : public Module
if (Anope::ReadOnly || !c->ci || targ->server != Me || !(bi = dynamic_cast<BotInfo *>(targ)))
return;
- AccessGroup access = c->ci->AccessFor(source);
+ ChanServ::AccessGroup access = c->ci->AccessFor(source);
if (nobot.HasExt(c->ci) || (!access.HasPriv("ASSIGN") && !source->HasPriv("botserv/administration")))
{
targ->SendMessage(bi, ACCESS_DENIED);
@@ -253,7 +253,7 @@ class BSAssign : public Module
targ->SendMessage(bi, _("Bot \002%s\002 has been assigned to %s."), bi->nick.c_str(), c->name.c_str());
}
- void OnBotInfo(CommandSource &source, BotInfo *bi, ChannelInfo *ci, InfoFormatter &info) override
+ void OnBotInfo(CommandSource &source, BotInfo *bi, ChanServ::Channel *ci, InfoFormatter &info) override
{
if (nobot.HasExt(ci))
info.AddOption(_("No bot"));
diff --git a/modules/commands/bs_badwords.cpp b/modules/commands/bs_badwords.cpp
index 082dae0bd..b410aced2 100644
--- a/modules/commands/bs_badwords.cpp
+++ b/modules/commands/bs_badwords.cpp
@@ -31,11 +31,11 @@ struct BadWordImpl : BadWord, Serializable
struct BadWordsImpl : BadWords
{
- Serialize::Reference<ChannelInfo> ci;
+ Serialize::Reference<ChanServ::Channel> ci;
typedef std::vector<BadWordImpl *> list;
Serialize::Checker<list> badwords;
- BadWordsImpl(Extensible *obj) : ci(anope_dynamic_static_cast<ChannelInfo *>(obj)), badwords("BadWord") { }
+ BadWordsImpl(Extensible *obj) : ci(anope_dynamic_static_cast<ChanServ::Channel *>(obj)), badwords("BadWord") { }
~BadWordsImpl();
@@ -72,7 +72,7 @@ struct BadWordsImpl : BadWords
{
if (this->badwords->empty() || index >= this->badwords->size())
return;
-
+
(*bwevents)(&Event::BadWordEvents::OnBadWordDel, ci, (*this->badwords)[index]);
delete this->badwords->at(index);
@@ -103,7 +103,7 @@ BadWordsImpl::~BadWordsImpl()
BadWordImpl::~BadWordImpl()
{
- ChannelInfo *ci = ChannelInfo::Find(chan);
+ ChanServ::Channel *ci = ChanServ::Find(chan);
if (ci)
{
BadWordsImpl *badwords = ci->GetExt<BadWordsImpl>("badwords");
@@ -123,13 +123,13 @@ Serializable* BadWordImpl::Unserialize(Serializable *obj, Serialize::Data &data)
data["ci"] >> sci;
data["word"] >> sword;
- ChannelInfo *ci = ChannelInfo::Find(sci);
+ ChanServ::Channel *ci = ChanServ::Find(sci);
if (!ci)
return NULL;
unsigned int n;
data["type"] >> n;
-
+
BadWordImpl *bw;
if (obj)
bw = anope_dynamic_static_cast<BadWordImpl *>(obj);
@@ -141,20 +141,20 @@ Serializable* BadWordImpl::Unserialize(Serializable *obj, Serialize::Data &data)
BadWordsImpl *bws = ci->Require<BadWordsImpl>("badwords");
bws->badwords->push_back(bw);
-
+
return bw;
}
class BadwordsDelCallback : public NumberList
{
CommandSource &source;
- ChannelInfo *ci;
+ ChanServ::Channel *ci;
BadWords *bw;
Command *c;
unsigned deleted;
bool override;
public:
- BadwordsDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, const Anope::string &list) : NumberList(list, true), source(_source), ci(_ci), c(_c), deleted(0), override(false)
+ BadwordsDelCallback(CommandSource &_source, ChanServ::Channel *_ci, Command *_c, const Anope::string &list) : NumberList(list, true), source(_source), ci(_ci), c(_c), deleted(0), override(false)
{
if (!source.AccessFor(ci).HasPriv("BADWORDS") && source.HasPriv("botserv/administration"))
this->override = true;
@@ -185,7 +185,7 @@ class BadwordsDelCallback : public NumberList
class CommandBSBadwords : public Command
{
private:
- void DoList(CommandSource &source, ChannelInfo *ci, const Anope::string &word)
+ void DoList(CommandSource &source, ChanServ::Channel *ci, const Anope::string &word)
{
bool override = !source.AccessFor(ci).HasPriv("BADWORDS");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "LIST";
@@ -259,7 +259,7 @@ class CommandBSBadwords : public Command
}
}
- void DoAdd(CommandSource &source, ChannelInfo *ci, const Anope::string &word)
+ void DoAdd(CommandSource &source, ChanServ::Channel *ci, const Anope::string &word)
{
size_t pos = word.rfind(' ');
BadWordType bwtype = BW_ANY;
@@ -308,7 +308,7 @@ class CommandBSBadwords : public Command
source.Reply(_("\002%s\002 added to %s bad words list."), realword.c_str(), ci->name.c_str());
}
- void DoDelete(CommandSource &source, ChannelInfo *ci, const Anope::string &word)
+ void DoDelete(CommandSource &source, ChanServ::Channel *ci, const Anope::string &word)
{
BadWords *badwords = ci->GetExt<BadWords>("badwords");
@@ -354,7 +354,7 @@ class CommandBSBadwords : public Command
badwords->Check();
}
- void DoClear(CommandSource &source, ChannelInfo *ci)
+ void DoClear(CommandSource &source, ChanServ::Channel *ci)
{
bool override = !source.AccessFor(ci).HasPriv("BADWORDS");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "CLEAR";
@@ -387,7 +387,7 @@ class CommandBSBadwords : public Command
return;
}
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
diff --git a/modules/commands/bs_bot.cpp b/modules/commands/bs_bot.cpp
index 9aa572f00..977d4b72f 100644
--- a/modules/commands/bs_bot.cpp
+++ b/modules/commands/bs_bot.cpp
@@ -73,7 +73,7 @@ class CommandBSBot : public Command
* if so. You need to drop the nick manually before you can use
* it as a bot nick from now on -GD
*/
- if (NickAlias::Find(nick))
+ if (NickServ::FindNick(nick))
{
source.Reply(NICK_ALREADY_REGISTERED, nick.c_str());
return;
@@ -176,7 +176,7 @@ class CommandBSBot : public Command
* if so. You need to drop the nick manually before you can use
* it as a bot nick from now on -GD
*/
- if (NickAlias::Find(nick))
+ if (NickServ::FindNick(nick))
{
source.Reply(NICK_ALREADY_REGISTERED, nick.c_str());
return;
@@ -210,10 +210,10 @@ class CommandBSBot : public Command
{
IRCD->SendClientIntroduction(bi);
unsigned minusers = Config->GetBlock("botserv")->Get<unsigned>("minusers");
- const std::set<ChannelInfo *> &channels = bi->GetChannels();
- for (std::set<ChannelInfo *>::const_iterator it = channels.begin(), it_end = channels.end(); it != it_end; ++it)
+ const std::set<ChanServ::Channel *> &channels = bi->GetChannels();
+ for (std::set<ChanServ::Channel *>::const_iterator it = channels.begin(), it_end = channels.end(); it != it_end; ++it)
{
- const ChannelInfo *ci = *it;
+ const ChanServ::Channel *ci = *it;
if (ci->c && ci->c->users.size() >= minusers)
bi->Join(ci->c);
diff --git a/modules/commands/bs_control.cpp b/modules/commands/bs_control.cpp
index 38745c191..0311a9df2 100644
--- a/modules/commands/bs_control.cpp
+++ b/modules/commands/bs_control.cpp
@@ -24,7 +24,7 @@ class CommandBSSay : public Command
{
const Anope::string &text = params[1];
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
@@ -84,7 +84,7 @@ class CommandBSAct : public Command
{
Anope::string message = params[1];
- ChannelInfo *ci = ChannelInfo::Find(params[0]);
+ ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
diff --git a/modules/commands/bs_info.cpp b/modules/commands/bs_info.cpp
index 49775a053..88ac15a48 100644
--- a/modules/commands/bs_info.cpp
+++ b/modules/commands/bs_info.cpp
@@ -20,18 +20,13 @@ class CommandBSInfo : public Command
void send_bot_channels(std::vector<Anope::string> &buffers, const BotInfo *bi)
{
Anope::string buf;
- for (registered_channel_map::const_iterator it = RegisteredChannelList->begin(), it_end = RegisteredChannelList->end(); it != it_end; ++it)
+ for (ChanServ::Channel *ci : bi->GetChannels())
{
- const ChannelInfo *ci = it->second;
-
- if (ci->bi == bi)
+ buf += " " + ci->name + " ";
+ if (buf.length() > 300)
{
- buf += " " + ci->name + " ";
- if (buf.length() > 300)
- {
- buffers.push_back(buf);
- buf.clear();
- }
+ buffers.push_back(buf);
+ buf.clear();
}
}
if (!buf.empty())
@@ -51,7 +46,7 @@ class CommandBSInfo : public Command
const Anope::string &query = params[0];
BotInfo *bi = BotInfo::Find(query, true);
- ChannelInfo *ci = ChannelInfo::Find(query);
+ ChanServ::Channel *ci = ChanServ::Find(query);
InfoFormatter info(source.nc);
if (bi)
diff --git a/modules/commands/bs_kick.cpp b/modules/commands/bs_kick.cpp
index 3a4d78c93..7ffd9d353 100644
--- a/modules/commands/bs_kick.cpp
+++ b/modules/commands/bs_kick.cpp
@@ -28,15 +28,15 @@ struct KickerDataImpl : KickerData
capsmin = capspercent = 0;
floodlines = floodsecs = 0;
repeattimes = 0;
-
+
dontkickops = dontkickvoices = false;
}
- void Check(ChannelInfo *ci) override
+ void Check(ChanServ::Channel *ci) override
{
if (amsgs || badwords || bolds || caps || colors || flood || italics || repeat || reverses || underlines)
return;
-
+
ci->Shrink<KickerData>("kickerdata");
}
@@ -46,10 +46,10 @@ struct KickerDataImpl : KickerData
void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const override
{
- if (s->GetSerializableType()->GetName() != "ChannelInfo")
+ if (s->GetSerializableType()->GetName() != "ChanServ::Channel")
return;
- const ChannelInfo *ci = anope_dynamic_static_cast<const ChannelInfo *>(e);
+ const ChanServ::Channel *ci = anope_dynamic_static_cast<const ChanServ::Channel *>(e);
KickerData *kd = this->Get(ci);
if (kd == NULL)
return;
@@ -76,10 +76,10 @@ struct KickerDataImpl : KickerData
void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) override
{
- if (s->