]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_permchannels.cpp
Send HALFOP= line in CAPAB CAPABILITIES for 1201 compat (anope relies on this)
[user/henk/code/inspircd.git] / src / modules / m_permchannels.cpp
index e81ac3a7cb5f6f2fd404fbd1e97e6a3ac82d210b..d4d80843971910c921fca1fdbb9b76be837b6b52 100644 (file)
@@ -42,6 +42,7 @@ static bool WriteDatabase()
                return false;
        }
 
+       fputs("# Permchannels DB\n# This file is autogenerated; any changes will be overwritten!\n<config format=\"compat\">\n", f);
        // Now, let's write.
        for (chan_hash::const_iterator i = ServerInstance->chanlist->begin(); i != ServerInstance->chanlist->end(); i++)
        {
@@ -126,30 +127,11 @@ class PermChannel : public ModeHandler
                {
                        if (channel->IsModeSet('P'))
                        {
-                               if (channel->GetUserCounter() == 0 && !IS_SERVER(source))
+                               channel->SetMode(this,false);
+                               if (channel->GetUserCounter() == 0)
                                {
-                                       /*
-                                        * 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;
+                                       channel->DelUser(ServerInstance->FakeClient);
                                }
-
-                               /* for servers, remove +P (to avoid desyncs) but don't bother trying to delete. */
-                               channel->SetMode('P',false);
                                return MODEACTION_ALLOW;
                        }
                }
@@ -170,7 +152,7 @@ public:
 
        void init()
        {
-               ServerInstance->Modes->AddService(p);
+               ServerInstance->Modules->AddService(p);
                Implementation eventlist[] = { I_OnChannelPreDelete, I_OnPostTopicChange, I_OnRawMode, I_OnRehash, I_OnBackgroundTimer };
                ServerInstance->Modules->Attach(eventlist, this, 5);