diff options
author | Adam <Adam@anope.org> | 2017-10-07 21:10:47 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2017-10-07 21:10:47 -0400 |
commit | 2312f1fbd06ac01bb55e1d99070cde05a09a5a17 (patch) | |
tree | 69239628ed39e342650574f93d441f58d6d82b7b /src/channels.cpp | |
parent | 286bffa2cd6a3f564334c5a4669ea3aadfb27a0a (diff) |
No longer expose c->ci and ci->c
Diffstat (limited to 'src/channels.cpp')
-rw-r--r-- | src/channels.cpp | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index 48e27f323..cc642103b 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -59,12 +59,14 @@ Channel::~Channel() if (Me && Me->IsSynced()) logger.Category("destroy").Log("Channel {0} was destroyed", this->GetName()); - if (this->ci) - this->ci->c = NULL; - ChannelList.erase(this->name); } +ChanServ::Channel *Channel::GetChannel() +{ + return ChanServ::Find(this->name); +} + const Anope::string &Channel::GetName() const { return name; @@ -791,7 +793,8 @@ void Channel::ChangeTopic(const Anope::string &user, const Anope::string &newtop this->topic_setter = user; this->topic_ts = ts; - IRCD->Send<messages::Topic>(this->ci ? this->ci->WhoSends() : Config->GetClient("ChanServ"), this, newtopic, ts, user); + ChanServ::Channel *ci = this->GetChannel(); + IRCD->Send<messages::Topic>(ci ? ci->WhoSends() : Config->GetClient("ChanServ"), this, newtopic, ts, user); /* Now that the topic is set update the time set. This is *after* we set it so the protocol modules are able to tell the old last set time */ this->topic_time = Anope::CurTime; @@ -804,7 +807,8 @@ void Channel::SetCorrectModes(User *user, bool give_modes) if (user == NULL) return; - if (!this->ci) + ChanServ::Channel *ci = this->GetChannel(); + if (!ci) return; Anope::Logger.Debug("Setting correct user modes for {0} on {1} ({2}giving modes)", user->nick, this->name, give_modes ? "" : "not "); @@ -890,7 +894,18 @@ bool Channel::CheckKick(User *user) return false; if (mask.empty()) - mask = this->ci->GetIdealBan(user); + { + ChanServ::Channel *ci = this->GetChannel(); + if (ci) + { + mask = ci->GetIdealBan(user); + } + } + if (mask.empty()) + { + return false; + } + if (reason.empty()) reason = Language::Translate(user->Account(), _("You are not permitted to be on this channel.")); |