summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2017-10-07 21:10:47 -0400
committerAdam <Adam@anope.org>2017-10-07 21:10:47 -0400
commit2312f1fbd06ac01bb55e1d99070cde05a09a5a17 (patch)
tree69239628ed39e342650574f93d441f58d6d82b7b
parent286bffa2cd6a3f564334c5a4669ea3aadfb27a0a (diff)
No longer expose c->ci and ci->c
-rw-r--r--include/channels.h6
-rw-r--r--include/modules/chanserv/channel.h4
-rw-r--r--modules/botserv/assign.cpp22
-rw-r--r--modules/botserv/control.cpp6
-rw-r--r--modules/botserv/kick.cpp15
-rw-r--r--modules/botserv/main/botserv.cpp31
-rw-r--r--modules/chanserv/access.cpp8
-rw-r--r--modules/chanserv/akick.cpp13
-rw-r--r--modules/chanserv/ban.cpp4
-rw-r--r--modules/chanserv/clone.cpp16
-rw-r--r--modules/chanserv/drop.cpp2
-rw-r--r--modules/chanserv/enforce.cpp48
-rw-r--r--modules/chanserv/entrymsg.cpp7
-rw-r--r--modules/chanserv/getkey.cpp2
-rw-r--r--modules/chanserv/invite.cpp2
-rw-r--r--modules/chanserv/list.cpp2
-rw-r--r--modules/chanserv/main/channel.cpp16
-rw-r--r--modules/chanserv/main/chanserv.cpp86
-rw-r--r--modules/chanserv/mode.cpp73
-rw-r--r--modules/chanserv/register.cpp3
-rw-r--r--modules/chanserv/set.cpp102
-rw-r--r--modules/chanserv/statusupdate.cpp9
-rw-r--r--modules/chanserv/suspend.cpp9
-rw-r--r--modules/chanserv/sync.cpp7
-rw-r--r--modules/chanserv/topic.cpp41
-rw-r--r--modules/chanserv/unban.cpp12
-rw-r--r--modules/chanserv/updown.cpp22
-rw-r--r--modules/database/old.cpp4
-rw-r--r--modules/fantasy.cpp16
-rw-r--r--modules/greet.cpp9
-rw-r--r--modules/helpchan.cpp4
-rw-r--r--modules/memoserv/main/memoserv.cpp14
-rw-r--r--modules/nickserv/ajoin.cpp7
-rw-r--r--modules/nickserv/set.cpp2
-rw-r--r--modules/protocol/charybdis.cpp17
-rw-r--r--modules/protocol/inspircd20.cpp82
-rw-r--r--modules/protocol/unreal.cpp27
-rw-r--r--src/bots.cpp7
-rw-r--r--src/channels.cpp27
-rw-r--r--src/logger.cpp7
-rw-r--r--src/modes.cpp12
-rw-r--r--src/servers.cpp3
42 files changed, 446 insertions, 360 deletions
diff --git a/include/channels.h b/include/channels.h
index 63e0559c3..d04a63bcf 100644
--- a/include/channels.h
+++ b/include/channels.h
@@ -53,8 +53,6 @@ class CoreExport Channel : public Base, public Extensible
public:
/* Channel name */
Anope::string name;
- /* Set if this channel is registered. ci->c == this. Contains information relevant to the registered channel */
- Serialize::Reference<ChanServ::Channel> ci;
/* When the channel was created */
time_t creation_time;
/* If the channel has just been created in a netjoin */
@@ -98,6 +96,10 @@ class CoreExport Channel : public Base, public Extensible
*/
~Channel();
+ /** Get the chanserv channel for this channel
+ */
+ ChanServ::Channel *GetChannel();
+
/** Gets the channels name
* @return the channel name
*/
diff --git a/include/modules/chanserv/channel.h b/include/modules/chanserv/channel.h
index a3b06b350..aab95de67 100644
--- a/include/modules/chanserv/channel.h
+++ b/include/modules/chanserv/channel.h
@@ -25,12 +25,12 @@ namespace ChanServ
class CoreExport Channel : public Serialize::Object
{
public:
- ::Channel *c = nullptr; /* Pointer to channel, if the channel exists */
-
static constexpr const char *const NAME = "channel";
using Serialize::Object::Object;
+ ::Channel *GetChannel() { return ::Channel::Find(GetName()); }
+
virtual Anope::string GetName() anope_abstract;
virtual void SetName(const Anope::string &) anope_abstract;
diff --git a/modules/botserv/assign.cpp b/modules/botserv/assign.cpp
index 26a448216..469f1f051 100644
--- a/modules/botserv/assign.cpp
+++ b/modules/botserv/assign.cpp
@@ -248,20 +248,22 @@ class BSAssign : public Module
void OnInvite(User *source, Channel *c, User *targ) override
{
- ServiceBot *bi;
- if (Anope::ReadOnly || !c->ci || targ->server != Me || !(bi = ServiceBot::Find(targ->nick, true)))
+ ServiceBot *bi = ServiceBot::Find(targ->nick, true);
+ ChanServ::Channel *ci = c->GetChannel();
+
+ if (Anope::ReadOnly || !ci || targ->server != Me || !bi)
return;
- ChanServ::AccessGroup access = c->ci->AccessFor(source);
+ ChanServ::AccessGroup access = ci->AccessFor(source);
if (!access.HasPriv("ASSIGN") && !source->HasPriv("botserv/administration"))
{
- targ->SendMessage(bi, _("Access denied. You do not have privilege \002ASSIGN\002 on \002{0}\002."), c->ci->GetName());
+ targ->SendMessage(bi, _("Access denied. You do not have privilege \002ASSIGN\002 on \002{0}\002."), ci->GetName());
return;
}
- if (nobot.HasExt(c->ci))
+ if (nobot.HasExt(ci))
{
- targ->SendMessage(bi, _("Access denied. \002{0}\002 may not have a bot assigned to it because a Services Operator has disallowed it."), c->ci->GetName());
+ targ->SendMessage(bi, _("Access denied. \002{0}\002 may not have a bot assigned to it because a Services Operator has disallowed it."), ci->GetName());
return;
}
@@ -271,14 +273,14 @@ class BSAssign : public Module
return;
}
- if (c->ci->GetBot() == bi)
+ if (ci->GetBot() == bi)
{
- targ->SendMessage(bi, _("Bot \002{0}\002 is already assigned to \002{1}\002."), bi->nick, c->ci->GetName());
+ targ->SendMessage(bi, _("Bot \002{0}\002 is already assigned to \002{1}\002."), bi->nick, ci->GetName());
return;
}
- bi->Assign(source, c->ci);
- targ->SendMessage(bi, _("Bot \002{0}\002 has been assigned to \002{1}\002."), bi->nick, c->ci->GetName());
+ bi->Assign(source, ci);
+ targ->SendMessage(bi, _("Bot \002{0}\002 has been assigned to \002{1}\002."), bi->nick, ci->GetName());
}
void OnServiceBot(CommandSource &source, ServiceBot *bi, ChanServ::Channel *ci, InfoFormatter &info) override
diff --git a/modules/botserv/control.cpp b/modules/botserv/control.cpp
index 584e8eded..758f795f2 100644
--- a/modules/botserv/control.cpp
+++ b/modules/botserv/control.cpp
@@ -59,7 +59,8 @@ class CommandBSSay : public Command
return;
}
- if (!ci->c || !ci->c->FindUser(ci->GetBot()))
+ Channel *c = ci->GetChannel();
+ if (!c || !c->FindUser(ci->GetBot()))
{
source.Reply(_("Bot \002{0}\002 is not on channel \002{1}\002."), ci->GetBot()->nick, ci->GetName());
return;
@@ -130,7 +131,8 @@ class CommandBSAct : public Command
return;
}
- if (!ci->c || !ci->c->FindUser(ci->GetBot()))
+ Channel *c = ci->GetChannel();
+ if (!c || !c->FindUser(ci->GetBot()))
{
source.Reply(_("Bot \002{0}\002 is not on channel \002{1}\002."), ci->GetBot()->nick, ci->GetName());
return;
diff --git a/modules/botserv/kick.cpp b/modules/botserv/kick.cpp
index b90a6e48e..2fbaf4c1b 100644
--- a/modules/botserv/kick.cpp
+++ b/modules/botserv/kick.cpp
@@ -1323,7 +1323,8 @@ class BSKick : public Module
if (u->IsProtected())
return;
- BanData::Data &bd = this->GetBanData(u, ci->c);
+ Channel *c = ci->GetChannel();
+ BanData::Data &bd = this->GetBanData(u, c);
++bd.ttb[ttbtype];
if (ttb && bd.ttb[ttbtype] >= ttb)
@@ -1332,15 +1333,15 @@ class BSKick : public Module
Anope::string mask = ci->GetIdealBan(u);
- ci->c->SetMode(NULL, "BAN", mask);
+ c->SetMode(NULL, "BAN", mask);
EventManager::Get()->Dispatch(&Event::BotBan::OnBotBan, u, ci, mask);
}
- if (!ci->c->FindUser(u))
+ if (!c->FindUser(u))
return;
Anope::string buf = Anope::Format(message, std::forward<Args>(args)...);
- ci->c->Kick(ci->GetBot(), u, buf);
+ c->Kick(ci->GetBot(), u, buf);
}
public:
@@ -1518,10 +1519,10 @@ class BSKick : public Module
* But FIRST we check whether the user is protected in any
* way.
*/
- ChanServ::Channel *ci = c->ci;
+ ChanServ::Channel *ci = c->GetChannel();
if (ci == NULL)
return;
- KickerData *kd = c->ci->GetRef<KickerData *>();
+ KickerData *kd = ci->GetRef<KickerData *>();
if (kd == NULL)
return;
@@ -1734,7 +1735,7 @@ class BSKick : public Module
Channel *chan = it->second->chan;
++it;
- if (chan->ci && kd->GetAmsgs() && !chan->ci->AccessFor(u).HasPriv("NOKICK"))
+ if (chan->GetChannel() && kd->GetAmsgs() && !chan->GetChannel()->AccessFor(u).HasPriv("NOKICK"))
{
TakeAction(ci, u, kd->GetTTBAmsgs(), TTB_AMSGS, _("Don't use AMSGs!"));
return;
diff --git a/modules/botserv/main/botserv.cpp b/modules/botserv/main/botserv.cpp
index 8fb71f498..59a3e0ee1 100644
--- a/modules/botserv/main/botserv.cpp
+++ b/modules/botserv/main/botserv.cpp
@@ -52,21 +52,22 @@ class BotServCore : public Module, public BotServ::BotServService
void OnSetCorrectModes(User *user, Channel *chan, ChanServ::AccessGroup &access, bool &give_modes, bool &take_modes) override
{
/* Do not allow removing bot modes on our service bots */
- if (chan->ci && chan->ci->GetBot() == user)
+ ChanServ::Channel *ci = chan->GetChannel();
+ if (ci && ci->GetBot() == user)
{
const Anope::string &botmodes = Config->GetModule(this)->Get<Anope::string>("botmodes");
for (unsigned i = 0; i < botmodes.length(); ++i)
- chan->SetMode(chan->ci->GetBot(), ModeManager::FindChannelModeByChar(botmodes[i]), chan->ci->GetBot()->GetUID());
+ chan->SetMode(ci->GetBot(), ModeManager::FindChannelModeByChar(botmodes[i]), ci->GetBot()->GetUID());
}
}
void OnBotAssign(User *sender, ChanServ::Channel *ci, ServiceBot *bi) override
{
- printf("on bot assign !\n");
- if (ci->c && ci->c->users.size() >= Config->GetModule(this)->Get<unsigned>("minusers"))
+ Channel *c = ci->GetChannel();
+ if (c && c->users.size() >= Config->GetModule(this)->Get<unsigned>("minusers"))
{
ChannelStatus status(Config->GetModule(this)->Get<Anope::string>("botmodes"));
- bi->Join(ci->c, &status);
+ bi->Join(c, &status);
}
}
@@ -108,7 +109,8 @@ class BotServCore : public Module, public BotServ::BotServService
ModeManager::ProcessModes();
}
- if (user->server != Me && c->ci && c->ci->GetBot())
+ ChanServ::Channel *ci = c->GetChannel();
+ if (user->server != Me && ci && ci->GetBot())
{
/**
* We let the bot join even if it was an ignored user, as if we don't,
@@ -117,18 +119,20 @@ class BotServCore : public Module, public BotServ::BotServService
* legit users - Rob
**/
/* This is before the user has joined the channel, so check usercount + 1 */
- if (c->users.size() + 1 >= Config->GetModule(this)->Get<unsigned>("minusers") && !c->FindUser(c->ci->GetBot()))
+ if (c->users.size() + 1 >= Config->GetModule(this)->Get<unsigned>("minusers") && !c->FindUser(ci->GetBot()))
{
ChannelStatus status(Config->GetModule(this)->Get<Anope::string>("botmodes"));
- c->ci->GetBot()->Join(c, &status);
+ ci->GetBot()->Join(c, &status);
}
}
}
void OnLeaveChannel(User *u, Channel *c) override
{
+ ChanServ::Channel *ci = c->GetChannel();
+
/* Channel is persistent, it shouldn't be deleted and the service bot should stay */
- if (c->ci && c->ci->IsPersist())
+ if (ci && ci->IsPersist())
return;
/* Channel is syncing from a netburst, don't destroy it as more users are probably wanting to join immediately
@@ -141,9 +145,9 @@ class BotServCore : public Module, public BotServ::BotServService
if (inhabit && inhabit->HasExt(c))
return;
- if (c->ci)
+ if (ci)
{
- ServiceBot *bot = c->ci->GetBot();
+ ServiceBot *bot = ci->GetBot();
/* This is called prior to removing the user from the channnel, so c->users.size() - 1 should be safe */
if (bot && u != bot && c->users.size() - 1 <= Config->GetModule(this)->Get<unsigned>("minusers") && c->FindUser(bot))
@@ -203,9 +207,10 @@ class BotServCore : public Module, public BotServ::BotServService
EventReturn OnChannelModeSet(Channel *c, const MessageSource &source, ChannelMode *mode, const Anope::string &param) override
{
- if (source.GetUser() && !source.GetBot() && Config->GetModule(this)->Get<bool>("smartjoin") && mode->name == "BAN" && c->ci && c->ci->GetBot() && c->FindUser(c->ci->GetBot()))
+ ChanServ::Channel *ci = c->GetChannel();
+ if (source.GetUser() && !source.GetBot() && Config->GetModule(this)->Get<bool>("smartjoin") && mode->name == "BAN" && ci && ci->GetBot() && c->FindUser(ci->GetBot()))
{
- ServiceBot *bi = c->ci->GetBot();
+ ServiceBot *bi = ci->GetBot();
Entry ban("BAN", param);
if (ban.Matches(bi))
diff --git a/modules/chanserv/access.cpp b/modules/chanserv/access.cpp
index c68af6e6f..32a6422cb 100644
--- a/modules/chanserv/access.cpp
+++ b/modules/chanserv/access.cpp
@@ -344,8 +344,8 @@ class CommandCSAccess : public Command
ChanServ::ChanAccess *access = ci->GetAccess(number - 1);
Anope::string timebuf;
- if (ci->c)
- for (Channel::ChanUserList::const_iterator cit = ci->c->users.begin(), cit_end = ci->c->users.end(); cit != cit_end; ++cit)
+ if (Channel *c = ci->GetChannel())
+ for (Channel::ChanUserList::const_iterator cit = c->users.begin(), cit_end = c->users.end(); cit != cit_end; ++cit)
{
if (access->Matches(cit->second->user, cit->second->user->Account()))
timebuf = "Now";
@@ -378,8 +378,8 @@ class CommandCSAccess : public Command
continue;
Anope::string timebuf;
- if (ci->c)
- for (Channel::ChanUserList::const_iterator cit = ci->c->users.begin(), cit_end = ci->c->users.end(); cit != cit_end; ++cit)
+ if (Channel *c = ci->GetChannel())
+ for (Channel::ChanUserList::const_iterator cit = c->users.begin(), cit_end = c->users.end(); cit != cit_end; ++cit)
{
if (access->Matches(cit->second->user, cit->second->user->Account()))
timebuf = "Now";
diff --git a/modules/chanserv/akick.cpp b/modules/chanserv/akick.cpp
index d49a63ca5..9014ad9d6 100644
--- a/modules/chanserv/akick.cpp
+++ b/modules/chanserv/akick.cpp
@@ -209,9 +209,9 @@ class CommandCSAKick : public Command
}
/* Check excepts BEFORE we get this far */
- if (ci->c)
+ if (Channel *c = ci->GetChannel())
{
- std::vector<Anope::string> modes = ci->c->GetModeList("EXCEPT");
+ std::vector<Anope::string> modes = c->GetModeList("EXCEPT");
for (unsigned int i = 0; i < modes.size(); ++i)
{
if (Anope::Match(modes[i], mask))
@@ -510,7 +510,7 @@ class CommandCSAKick : public Command
void DoEnforce(CommandSource &source, ChanServ::Channel *ci)
{
- Channel *c = ci->c;
+ Channel *c = ci->GetChannel();
int count = 0;
if (!c)
@@ -696,12 +696,13 @@ class CSAKick : public Module
EventReturn OnCheckKick(User *u, Channel *c, Anope::string &mask, Anope::string &reason) override
{
- if (!c->ci || c->MatchesList(u, "EXCEPT"))
+ ChanServ::Channel *ci = c->GetChannel();
+ if (!ci || c->MatchesList(u, "EXCEPT"))
return EVENT_CONTINUE;
- for (unsigned j = 0, end = c->ci->GetAkickCount(); j < end; ++j)
+ for (unsigned j = 0, end = ci->GetAkickCount(); j < end; ++j)
{
- AutoKick *ak = c->ci->GetAkick(j);
+ AutoKick *ak = ci->GetAkick(j);
bool kick = false;
if (ak->GetAccount())
diff --git a/modules/chanserv/ban.cpp b/modules/chanserv/ban.cpp
index cd6b70b1f..4e8c0ded7 100644
--- a/modules/chanserv/ban.cpp
+++ b/modules/chanserv/ban.cpp
@@ -61,7 +61,7 @@ class CommandCSBan : public Command
return;
}
- Channel *c = ci->c;
+ Channel *c = ci->GetChannel();
if (c == NULL)
{
source.Reply(_("Channel \002{0}\002 doesn't exist."), ci->GetName());
@@ -213,7 +213,7 @@ class CommandCSBan : public Command
continue;
if (u != uc->user && ci->IsPeace() && u2_access >= u_access)
continue;
- else if (ci->c->MatchesList(uc->user, "EXCEPT"))
+ else if (c->MatchesList(uc->user, "EXCEPT"))
continue;
else if (uc->user->IsProtected())
continue;
diff --git a/modules/chanserv/clone.cpp b/modules/chanserv/clone.cpp
index c0ed04a64..341d80944 100644
--- a/modules/chanserv/clone.cpp
+++ b/modules/chanserv/clone.cpp
@@ -101,27 +101,25 @@ public:
target_ci->SetTimeRegistered(Anope::CurTime);
ChanServ::registered_channel_map& map = ChanServ::service->GetChannels();
map[target_ci->GetName()] = target_ci;
- target_ci->c = Channel::Find(target_ci->GetName());
+ Channel *target_channel = Channel::Find(target_ci->GetName());
if (ci->GetBot())
ci->GetBot()->Assign(u, target_ci);
else
target_ci->SetBot(nullptr);
- if (target_ci->c)
+ if (target_channel)
{
- target_ci->c->ci = target_ci;
+ target_channel->CheckModes();
- target_ci->c->CheckModes();
-
- target_ci->c->SetCorrectModes(u, true);
+ target_channel->SetCorrectModes(u, true);
}
- if (target_ci->c && !target_ci->c->topic.empty())
+ if (target_channel && !target_channel->topic.empty())
{
target_ci->SetLastTopic(target_ci->GetLastTopic());
- target_ci->SetLastTopicSetter(target_ci->c->topic_setter);
- target_ci->SetLastTopicTime(target_ci->c->topic_time);
+ target_ci->SetLastTopicSetter(target_channel->topic_setter);
+ target_ci->SetLastTopicTime(target_channel->topic_time);
}
else
{
diff --git a/modules/chanserv/drop.cpp b/modules/chanserv/drop.cpp
index cd8718801..d85e5390d 100644
--- a/modules/chanserv/drop.cpp
+++ b/modules/chanserv/drop.cpp
@@ -65,7 +65,7 @@ class CommandCSDrop : public Command
logger.Command(source, ci, _("{source} used {command} on {channel} (founder was: {0})"),
ci->GetFounder() ? ci->GetFounder()->GetDisplay() : "none");
- Reference<Channel> c = ci->c;
+ Reference<Channel> c = ci->GetChannel();
ci->Delete();
source.Reply(_("Channel \002{0}\002 has been dropped."), chan);
diff --git a/modules/chanserv/enforce.cpp b/modules/chanserv/enforce.cpp
index 85649f662..c9ca14acf 100644
--- a/modules/chanserv/enforce.cpp
+++ b/modules/chanserv/enforce.cpp
@@ -34,11 +34,12 @@ class CommandCSEnforce : public Command
bool hadsecureops = ci->IsSecureOps();
ci->SetSecureOps(true);
- for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it)
+ Channel *c = ci->GetChannel();
+ for (Channel::ChanUserList::iterator it = c->users.begin(), it_end = c->users.end(); it != it_end; ++it)
{
ChanUserContainer *uc = it->second;
- ci->c->SetCorrectModes(uc->user, false);
+ c->SetCorrectModes(uc->user, false);
}
if (!hadsecureops)
@@ -51,8 +52,9 @@ class CommandCSEnforce : public Command
{
logger.Command(source, ci, _("{source} used {command} on {channel} to enforce restricted"));
+ Channel *c = ci->GetChannel();
std::vector<User *> users;
- for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it)
+ for (Channel::ChanUserList::iterator it = c->users.begin(), it_end = c->users.end(); it != it_end; ++it)
{
ChanUserContainer *uc = it->second;
User *user = uc->user;
@@ -70,8 +72,8 @@ class CommandCSEnforce : public Command
Anope::string mask = ci->GetIdealBan(user);
Anope::string reason = Language::Translate(user, _("RESTRICTED enforced by ")) + source.GetNick();
- ci->c->SetMode(NULL, "BAN", mask);
- ci->c->Kick(NULL, user, reason);
+ c->SetMode(NULL, "BAN", mask);
+ c->Kick(NULL, user, reason);
}
source.Reply(_("\002Restricted\002 enforced on \002{0}\002."), ci->GetName());
@@ -81,8 +83,9 @@ class CommandCSEnforce : public Command
{
logger.Command(source, ci, _("{source} used {command} on {channel} to enforce registered only"));
+ Channel *c = ci->GetChannel();
std::vector<User *> users;
- for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it)
+ for (Channel::ChanUserList::iterator it = c->users.begin(), it_end = c->users.end(); it != it_end; ++it)
{
ChanUserContainer *uc = it->second;
User *user = uc->user;
@@ -100,9 +103,9 @@ class CommandCSEnforce : public Command
Anope::string mask = ci->GetIdealBan(user);
Anope::string reason = Language::Translate(user, _("REGONLY enforced by ")) + source.GetNick();
- if (!ci->c->HasMode("REGISTEREDONLY"))
- ci->c->SetMode(NULL, "BAN", mask);
- ci->c->Kick(NULL, user, reason);
+ if (!c->HasMode("REGISTEREDONLY"))
+ c->SetMode(NULL, "BAN", mask);
+ c->Kick(NULL, user, reason);
}
source.Reply(_("\002Registered only\002 enforced on \002{0}\002."), ci->GetName());
@@ -112,8 +115,9 @@ class CommandCSEnforce : public Command
{
logger.Command(source, ci, _("{source} used {command} on {channel} to enforce SSL only"));
+ Channel *c = ci->GetChannel();
std::vector<User *> users;
- for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it)
+ for (Channel::ChanUserList::iterator it = c->users.begin(), it_end = c->users.end(); it != it_end; ++it)
{
ChanUserContainer *uc = it->second;
User *user = uc->user;
@@ -131,9 +135,9 @@ class CommandCSEnforce : public Command
Anope::string mask = ci->GetIdealBan(user);
Anope::string reason = Language::Translate(user, _("SSLONLY enforced by ")) + source.GetNick();
- if (!ci->c->HasMode("SSL"))
- ci->c->SetMode(NULL, "BAN", mask);
- ci->c->Kick(NULL, user, reason);
+ if (!c->HasMode("SSL"))
+ c->SetMode(NULL, "BAN", mask);
+ c->Kick(NULL, user, reason);
}
source.Reply(_("\002SSL only\002 enforced on %s."), ci->GetName().c_str());
@@ -143,8 +147,9 @@ class CommandCSEnforce : public Command
{
logger.Command(source, ci, _("{source} used {command} on {channel} to enforce bans"));
+ Channel *c = ci->GetChannel();
std::vector<User *> users;
- for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it)
+ for (Channel::ChanUserList::iterator it = c->users.begin(), it_end = c->users.end(); it != it_end; ++it)
{
ChanUserContainer *uc = it->second;
User *user = uc->user;
@@ -152,7 +157,7 @@ class CommandCSEnforce : public Command
if (user->IsProtected())
continue;
- if (ci->c->MatchesList(user, "BAN") && !ci->c->MatchesList(user, "EXCEPT"))
+ if (c->MatchesList(user, "BAN") && !c->MatchesList(user, "EXCEPT"))
users.push_back(user);
}
@@ -161,7 +166,7 @@ class CommandCSEnforce : public Command
User *user = users[i];
Anope::string reason = Language::Translate(user, _("BANS enforced by ")) + source.GetNick();
- ci->c->Kick(NULL, user, reason);
+ c->Kick(NULL, user, reason);
}
source.Reply(_("\002Bans\002 enforced on %s."), ci->GetName().c_str());
@@ -171,8 +176,9 @@ class CommandCSEnforce : public Command
{
logger.Command(source, ci, _("{source} used {command} on {channel} to enforce limit"));
+ Channel *c = ci->GetChannel();
Anope::string l_str;
- if (!ci->c->GetParam("LIMIT", l_str))
+ if (!c->GetParam("LIMIT", l_str))
{
source.Reply(_("There is no limit is set on \002{0}\002."), ci->GetName());
return;
@@ -193,7 +199,7 @@ class CommandCSEnforce : public Command
std::vector<User *> users;
/* The newer users are at the end of the list, so kick users starting from the end */
- for (Channel::ChanUserList::reverse_iterator it = ci->c->users.rbegin(), it_end = ci->c->users.rend(); it != it_end; ++it)
+ for (Channel::ChanUserList::reverse_iterator it = c->users.rbegin(), it_end = c->users.rend(); it != it_end; ++it)
{
ChanUserContainer *uc = it->second;
User *user = uc->user;
@@ -204,7 +210,7 @@ class CommandCSEnforce : public Command
if (!ci->AccessFor(user).empty())
continue;
- if (ci->c->users.size() - users.size() <= static_cast<unsigned>(l))
+ if (c->users.size() - users.size() <= static_cast<unsigned>(l))
continue;
users.push_back(user);
@@ -215,7 +221,7 @@ class CommandCSEnforce : public Command
User *user = users[i];
Anope::string reason = Language::Translate(user, _("LIMIT enforced by ")) + source.GetNick();
- ci->c->Kick(NULL, user, reason);
+ c->Kick(NULL, user, reason);
}
source.Reply(_("LIMIT enforced on \002{0}\002, \002{1]\002 users removed."), ci->GetName(), users.size());
@@ -240,7 +246,7 @@ class CommandCSEnforce : public Command
return;
}
- if (!ci->c)
+ if (!ci->GetChannel())
{
source.Reply(_("Channel \002{0}\002 doesn't exist."), ci->GetName());
return;
diff --git a/modules/chanserv/entrymsg.cpp b/modules/chanserv/entrymsg.cpp
index ec3f833fd..efcea8e9d 100644
--- a/modules/chanserv/entrymsg.cpp
+++ b/modules/chanserv/entrymsg.cpp
@@ -285,9 +285,10 @@ class CSEntryMessage : public Module
void OnJoinChannel(User *u, Channel *c) override
{
- if (u && c && c->ci && u->server->IsSynced())
- for (EntryMsg *msg : c->ci->GetRefs<EntryMsg *>())
- u->SendMessage(c->ci->WhoSends(), "[{0}] {1}", c->ci->GetName(), msg->GetMessage());
+ ChanServ::Channel *ci = c->GetChannel();
+ if (ci && u->server->IsSynced())
+ for (EntryMsg *msg : ci->GetRefs<EntryMsg *>())
+ u->SendMessage(ci->WhoSends(), "[{0}] {1}", ci->GetName(), msg->GetMessage());
}
};
diff --git a/modules/chanserv/getkey.cpp b/modules/chanserv/getkey.cpp
index a1a3dd587..1f280ee52 100644
--- a/modules/chanserv/getkey.cpp
+++ b/modules/chanserv/getkey.cpp
@@ -46,7 +46,7 @@ class CommandCSGetKey : public Command
}
Anope::string key;
- if (!ci->c || !ci->c->GetParam("KEY", key))
+ if (!ci->GetChannel() || !ci->GetChannel()->GetParam("KEY", key))
{
source.Reply(_("Channel \002{0}\002 does not have a key."), ci->GetName());
return;
diff --git a/modules/chanserv/invite.cpp b/modules/chanserv/invite.cpp
index 2f236b6c6..df8bee8f9 100644
--- a/modules/chanserv/invite.cpp
+++ b/modules/chanserv/invite.cpp
@@ -41,7 +41,7 @@ class CommandCSInvite : public Command
return;
}
- ChanServ::Channel *ci = c->ci;
+ ChanServ::Channel *ci = c->GetChannel();
if (!ci)
{
source.Reply(_("Channel \002{0}\002 isn't registered."), c->name);
diff --git a/modules/chanserv/list.cpp b/modules/chanserv/list.cpp
index 6f9f06e60..1f89b0274 100644
--- a/modules/chanserv/list.cpp
+++ b/