summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2017-03-19 18:36:03 -0400
committerAdam <Adam@anope.org>2017-03-19 18:36:03 -0400
commit2a886acbedb6b6386dbff3e591b0d4035d516b2a (patch)
tree765218b2fc476e9b1517d7f1e4aa78f57de87752 /src
parentf237405a52f6b8efb606c5181ffe3bd75a6a6a8a (diff)
Get rid of relying on if(this) in WhoSends()
Diffstat (limited to 'src')
-rw-r--r--src/channels.cpp5
-rw-r--r--src/logger.cpp2
-rw-r--r--src/modes.cpp6
-rw-r--r--src/servers.cpp6
4 files changed, 8 insertions, 11 deletions
diff --git a/src/channels.cpp b/src/channels.cpp
index 2b9ea438d..bf5b22183 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -767,9 +767,6 @@ bool Channel::Kick(User *source, User *u, const Anope::string &reason)
if (u->IsProtected())
return false;
- if (source == NULL)
- source = this->ci->WhoSends();
-
if (!this->KickInternal(source, u->nick, reason))
return false;
IRCD->SendKick(source, this, u, reason);
@@ -794,7 +791,7 @@ 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->WhoSends(), this, newtopic, ts, user);
+ IRCD->Send<messages::Topic>(this->ci ? this->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;
diff --git a/src/logger.cpp b/src/logger.cpp
index 22e27d375..2e00ae049 100644
--- a/src/logger.cpp
+++ b/src/logger.cpp
@@ -235,7 +235,7 @@ void LogInfo::ProcessMessage(const Logger *l, const Anope::string &message)
User *bi = l->GetBot();
if (!bi)
bi = this->bot;
- if (!bi)
+ if (!bi && c->ci)
bi = c->ci->WhoSends();
if (bi)
IRCD->SendPrivmsg(bi, c->name, buffer);
diff --git a/src/modes.cpp b/src/modes.cpp
index f845f7408..0223a9c93 100644
--- a/src/modes.cpp
+++ b/src/modes.cpp
@@ -57,9 +57,7 @@ struct StackerInfo
/* Modes to be deleted */
std::list<std::pair<Mode *, Anope::string> > DelModes;
/* Bot this is sent from */
- User *bi;
-
- StackerInfo() : bi(NULL) { }
+ User *bi = nullptr;
/** Add a mode to this object
* @param mode The mode
@@ -598,7 +596,7 @@ void ModeManager::StackerAdd(User *bi, Channel *c, ChannelMode *cm, bool Set, co
s->AddMode(cm, Set, Param);
if (bi)
s->bi = bi;
- else
+ else if (c->ci)
s->bi = c->ci->WhoSends();
if (!modePipe)
diff --git a/src/servers.cpp b/src/servers.cpp
index 7747f4a69..d1fa2bf26 100644
--- a/src/servers.cpp
+++ b/src/servers.cpp
@@ -127,6 +127,8 @@ void Server::Burst()
bi->introduced = true;
}
+ ServiceBot *chanserv = Config->GetClient("ChanServ");
+
for (channel_map::const_iterator it = ChannelList.begin(), it_end = ChannelList.end(); it != it_end; ++it)
{
Channel *c = it->second;
@@ -142,11 +144,11 @@ void Server::Burst()
ChannelMode *cm = ModeManager::FindChannelModeByName(it2->first);
if (!cm || cm->type != MODE_LIST)
continue;
- ModeManager::StackerAdd(c->ci->WhoSends(), c, cm, true, it2->second);
+ ModeManager::StackerAdd(nullptr, c, cm, true, it2->second);
}
if (!c->topic.empty() && !c->topic_setter.empty())
- IRCD->Send<messages::Topic>(c->ci->WhoSends(), c, c->topic, c->topic_ts, c->topic_setter);
+ IRCD->Send<messages::Topic>(c->ci ? c->ci->WhoSends() : chanserv, c, c->topic, c->topic_ts, c->topic_setter);
c->syncing = true;
}