summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-02 00:47:54 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-02 00:47:54 +0000
commit77ead8fe331060d19525cac5b880c41c47c12f11 (patch)
tree3334078e90230133f974547cc0f9ba305b27ffc9
parent94bb5343b1464cbec9f58ee9d90a3deae3ac5308 (diff)
Remove empty permanent channels when m_permchannels is unloaded
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11624 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/modules/m_permchannels.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp
index 08a48443e..67e941d54 100644
--- a/src/modules/m_permchannels.cpp
+++ b/src/modules/m_permchannels.cpp
@@ -93,6 +93,25 @@ public:
virtual ~ModulePermanentChannels()
{
ServerInstance->Modes->DelMode(&p);
+ /*
+ * DelMode can't remove the +P mode on empty channels, or it will break
+ * merging modes with remote servers. Remove the empty channels now as
+ * we know this is not the case.
+ */
+ chan_hash::iterator iter = ServerInstance->chanlist->begin();
+ while (iter != ServerInstance->chanlist->end())
+ {
+ Channel* c = iter->second;
+ if (c->GetUserCounter() == 0)
+ {
+ chan_hash::iterator at = iter;
+ iter++;
+ ServerInstance->chanlist->erase(at);
+ delete c;
+ }
+ else
+ iter++;
+ }
}
virtual void OnRehash(User *user)