summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-08-29 21:03:41 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-08-29 21:03:41 +0000
commit7646da6fc4a9c44f13d2960a97c8b1005d0378de (patch)
treef99c71b745fdddc9b7dcd0537f446e5bb528b218 /src/modules
parent6e39923ee904795ca6ddf7d7b5d377d3b1591642 (diff)
Don't try destroy on -P of a 0 user chan, as this causes problems during netmerge.. *sigh*
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10351 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_permchannels.cpp28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp
index a333ea0b0..6a5373009 100644
--- a/src/modules/m_permchannels.cpp
+++ b/src/modules/m_permchannels.cpp
@@ -23,7 +23,7 @@ class PermChannel : public ModeHandler
public:
PermChannel(InspIRCd* Instance) : ModeHandler(Instance, 'P', 0, 0, false, MODETYPE_CHANNEL, false) { }
- ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding, bool)
+ ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding, bool sm)
{
if (adding)
{
@@ -37,10 +37,30 @@ class PermChannel : public ModeHandler
{
if (channel->IsModeSet('P'))
{
- channel->SetMode('P',false);
+ if (channel->GetUserCounter() == 0 && !sm)
+ {
+ /*
+ * ugh, ugh, UGH!
+ *
+ * We can't delete this channel the way things work at the moment,
+ * because of the following scenario:
+ * s1:#c <-> s2:#c
+ *
+ * s1 has a user in #c, s2 does not. s2 has +P set. s2 has a losing TS.
+ *
+ * On netmerge, s2 loses, so s2 removes all modes (including +P) which
+ * would subsequently delete the channel here causing big fucking problems.
+ *
+ * I don't think there's really a way around this, so just deny -P on a 0 user chan.
+ * -- w00t
+ *
+ * delete channel;
+ */
+ return MODEACTION_DENY;
+ }
- if (channel->GetUserCounter() == 0)
- delete channel;
+ /* for servers, remove +P (to avoid desyncs) but don't bother trying to delete. */
+ channel->SetMode('P',false);
return MODEACTION_ALLOW;
}
}