diff options
author | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-08-25 13:20:38 +0000 |
---|---|---|
committer | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-08-25 13:20:38 +0000 |
commit | 8d7e3fab28008e6353c7520c711aefc4a10e282d (patch) | |
tree | c4735b6c69873fbfd74bd64b65ebfdb25461e0ea | |
parent | 575f8d0fbc659a94231356962d5bfbdb93be4e66 (diff) |
Allow Channel::SetTopic with a NULL user record, which sets a blank topic.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10270 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/channels.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index ac7c461d6..2884b2d3b 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -74,7 +74,7 @@ std::string Channel::GetModeParameter(char mode) int Channel::SetTopic(User *u, std::string &ntopic, bool forceset) { - if (IS_LOCAL(u)) + if (u && IS_LOCAL(u)) { if(!forceset) { @@ -102,11 +102,20 @@ int Channel::SetTopic(User *u, std::string &ntopic, bool forceset) } this->topic.assign(ntopic, 0, ServerInstance->Config->Limits.MaxTopic); - this->setby.assign(ServerInstance->Config->FullHostInTopic ? u->GetFullHost() : u->nick, 0, 128); + if (u) + { + this->setby.assign(ServerInstance->Config->FullHostInTopic ? u->GetFullHost() : u->nick, 0, 128); + this->WriteChannel(u, "TOPIC %s :%s", this->name.c_str(), this->topic.c_str()); + } + else + { + this->setby.assign(ServerInstance->Config->ServerName); + this->WriteChannelWithServ(ServerInstance->Config->ServerName, "TOPIC %s :%s", this->name.c_str(), this->topic.c_str()); + } + this->topicset = ServerInstance->Time(); - this->WriteChannel(u, "TOPIC %s :%s", this->name.c_str(), this->topic.c_str()); - if (IS_LOCAL(u)) + if (u && IS_LOCAL(u)) { FOREACH_MOD(I_OnPostLocalTopicChange,OnPostLocalTopicChange(u, this, this->topic)); } |