X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_permchannels.cpp;h=a7be6df0886c90eba45991170f78d4c00969edcf;hb=318d50bc868fb64a7d5e1edeff3ec23e38925638;hp=22513abeafdb8c20fc27da671425e4925f43d1ca;hpb=8f5efbc7aa33b792e02d01e3288f553e6e98ccaa;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp index 22513abea..a7be6df08 100644 --- a/src/modules/m_permchannels.cpp +++ b/src/modules/m_permchannels.cpp @@ -34,7 +34,7 @@ class PermChannel : public ModeHandler oper = true; } - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string& parameter, bool adding) + ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string& parameter, bool adding) CXX11_OVERRIDE { if (adding == channel->IsModeSet(this)) return MODEACTION_DENY; @@ -206,17 +206,17 @@ public: time_t TS = tag->getInt("ts", ServerInstance->Time(), 1); c = new Channel(channel, TS); - unsigned int topicset = tag->getInt("topicts"); - c->topic = tag->getString("topic"); + time_t topicset = tag->getInt("topicts", 0); + std::string topic = tag->getString("topic"); - if ((topicset != 0) || (!c->topic.empty())) + if ((topicset != 0) || (!topic.empty())) { if (topicset == 0) topicset = ServerInstance->Time(); - c->topicset = topicset; - c->setby = tag->getString("topicsetby"); - if (c->setby.empty()) - c->setby = ServerInstance->Config->ServerName; + std::string topicsetby = tag->getString("topicsetby"); + if (topicsetby.empty()) + topicsetby = ServerInstance->Config->ServerName; + c->SetTopic(ServerInstance->FakeClient, topic, topicset, &topicsetby); } ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Added %s with topic %s", channel.c_str(), c->topic.c_str()); @@ -236,7 +236,7 @@ public: ModeHandler* mode = ServerInstance->Modes->FindMode(*n, MODETYPE_CHANNEL); if (mode) { - if (mode->GetNumParams(true)) + if (mode->NeedsParam(true)) list.GetToken(par); else par.clear(); @@ -244,6 +244,10 @@ public: mode->OnModeChange(ServerInstance->FakeClient, ServerInstance->FakeClient, c, par, true); } } + + // We always apply the permchannels mode to permanent channels. + par.clear(); + p.OnModeChange(ServerInstance->FakeClient, ServerInstance->FakeClient, c, par, true); } } } @@ -269,7 +273,7 @@ public: dirty = false; } - void Prioritize() + void Prioritize() CXX11_OVERRIDE { // XXX: Load the DB here because the order in which modules are init()ed at boot is // alphabetical, this means we must wait until all modules have done their init()