From 31de5a7e8f3ed680df6293f96f6b52c1c3a345ef Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Tue, 12 Mar 2013 20:45:02 +0100 Subject: m_permchannels Load channels from the config only at module load time and only when there are no linked servers to avoid desync --- src/modules/m_permchannels.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp index 8958cdfcd..b12b9bbeb 100644 --- a/src/modules/m_permchannels.cpp +++ b/src/modules/m_permchannels.cpp @@ -172,6 +172,14 @@ public: ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); OnRehash(NULL); + + // Load only when there are no linked servers - we set the TS of the channels we + // create to the current time, this can lead to desync because spanningtree has + // no way of knowing what we do + ProtoServerList serverlist; + ServerInstance->PI->GetServerList(serverlist); + if (serverlist.size() < 2) + LoadDatabase(); } CullResult cull() @@ -201,14 +209,16 @@ public: } virtual void OnRehash(User *user) + { + permchannelsconf = ServerInstance->Config->ConfValue("permchanneldb")->getString("filename"); + } + + void LoadDatabase() { /* * Process config-defined list of permanent channels. * -- w00t */ - - permchannelsconf = ServerInstance->Config->ConfValue("permchanneldb")->getString("filename"); - ConfigTagList permchannels = ServerInstance->Config->ConfTags("permchannels"); for (ConfigIter i = permchannels.first; i != permchannels.second; ++i) { @@ -219,7 +229,7 @@ public: if (channel.empty()) { - ServerInstance->Logs->Log("blah", DEBUG, "Malformed permchannels tag with empty channel name."); + ServerInstance->Logs->Log("m_permchannels", DEBUG, "Malformed permchannels tag with empty channel name."); continue; } @@ -240,7 +250,7 @@ public: */ c->topicset = 42; } - ServerInstance->Logs->Log("blah", DEBUG, "Added %s with topic %s", channel.c_str(), topic.c_str()); + ServerInstance->Logs->Log("m_permchannels", DEBUG, "Added %s with topic %s", channel.c_str(), topic.c_str()); if (modes.empty()) continue; -- cgit v1.2.3