int Channel::SetTopic(User *u, std::string &ntopic, bool forceset)
{
- if (IS_LOCAL(u))
+ if (u && IS_LOCAL(u))
{
if(!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));
}
}
else
{
- if (IS_OPER(user))
+ if (user->HasPrivPermission("channels/high-join-limit"))
{
if (user->chans.size() >= Instance->Config->OperMaxChans)
{
/* Channel::PartUser
* remove a channel from a users record, and return the number of users left.
* Therefore, if this function returns 0 the caller should delete the Channel.
- *
- * XXX: bleh, string copy of reason, fixme! -- w00t
*/
long Channel::PartUser(User *user, std::string &reason)
{