diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bots.cpp | 7 | ||||
-rw-r--r-- | src/channels.cpp | 27 | ||||
-rw-r--r-- | src/logger.cpp | 7 | ||||
-rw-r--r-- | src/modes.cpp | 12 | ||||
-rw-r--r-- | src/servers.cpp | 3 |
5 files changed, 42 insertions, 14 deletions
diff --git a/src/bots.cpp b/src/bots.cpp index 35b390ed4..eaa0d045d 100644 --- a/src/bots.cpp +++ b/src/bots.cpp @@ -139,12 +139,13 @@ void ServiceBot::UnAssign(User *u, ChanServ::Channel *ci) if (MOD_RESULT == EVENT_STOP) return; - if (ci->c && ci->c->FindUser(ci->GetBot())) + Channel *c = ci->GetChannel(); + if (c && c->FindUser(ci->GetBot())) { if (u) - ci->GetBot()->Part(ci->c, "UNASSIGN from " + u->nick); + ci->GetBot()->Part(c, "UNASSIGN from " + u->nick); else - ci->GetBot()->Part(ci->c); + ci->GetBot()->Part(c); } ci->SetBot(nullptr); 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.")); diff --git a/src/logger.cpp b/src/logger.cpp index ec2cf2f67..adb880065 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -237,8 +237,11 @@ void LogInfo::ProcessMessage(const Logger *l, const Anope::string &message) User *bi = l->GetBot(); if (!bi) bi = this->bot; - if (!bi && c->ci) - bi = c->ci->WhoSends(); + if (!bi) + { + ChanServ::Channel *ci = c->GetChannel(); + bi = ci->WhoSends(); + } if (bi) IRCD->SendPrivmsg(bi, c->name, buffer); } diff --git a/src/modes.cpp b/src/modes.cpp index 274cb2713..ce46aad8a 100644 --- a/src/modes.cpp +++ b/src/modes.cpp @@ -595,9 +595,17 @@ void ModeManager::StackerAdd(User *bi, Channel *c, ChannelMode *cm, bool Set, co StackerInfo *s = GetInfo(ChannelStackerObjects, c); s->AddMode(cm, Set, Param); if (bi) + { s->bi = bi; - else if (c->ci) - s->bi = c->ci->WhoSends(); + } + else + { + ChanServ::Channel *ci = c->GetChannel(); + if (ci) + { + s->bi = ci->WhoSends(); + } + } if (!modePipe) modePipe = new ModePipe(); diff --git a/src/servers.cpp b/src/servers.cpp index 2c89c92ea..35f066f4a 100644 --- a/src/servers.cpp +++ b/src/servers.cpp @@ -147,8 +147,9 @@ void Server::Burst() ModeManager::StackerAdd(nullptr, c, cm, true, it2->second); } + ChanServ::Channel *ci = c->GetChannel(); if (!c->topic.empty() && !c->topic_setter.empty()) - IRCD->Send<messages::Topic>(c->ci ? c->ci->WhoSends() : chanserv, c, c->topic, c->topic_ts, c->topic_setter); + IRCD->Send<messages::Topic>(ci ? ci->WhoSends() : chanserv, c, c->topic, c->topic_ts, c->topic_setter); c->syncing = true; } |