]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_permchannels.cpp
Strip SUPPORT_IP6LINKS #define
[user/henk/code/inspircd.git] / src / modules / m_permchannels.cpp
index 3b3df4d262010d66622ab105e47eea5ad00b7536..ff269934e6fd111b434ca8d7caaa9fc14d006531 100644 (file)
@@ -2,8 +2,8 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
  *            the file COPYING for details.
@@ -25,6 +25,12 @@ class PermChannel : public ModeHandler
 
        ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding, bool sm)
        {
+               if (!source->HasPrivPermission("channels/set-permanent"))
+               {
+                       source->WriteNumeric(ERR_NOPRIVILEGES, "%s :Permission Denied - You do not have the required operator privileges", source->nick.c_str());
+                       return MODEACTION_DENY;
+               }
+
                if (adding)
                {
                        if (!channel->IsModeSet('P'))
@@ -85,7 +91,7 @@ public:
                Implementation eventlist[] = { I_OnChannelPreDelete };
                ServerInstance->Modules->Attach(eventlist, this, 1);
 
-               OnRehash(NULL, "");
+               OnRehash(NULL);
        }
 
        virtual ~ModulePermanentChannels()
@@ -94,7 +100,7 @@ public:
                delete p;
        }
 
-       virtual void OnRehash(User *user, const std::string &parameter)
+       virtual void OnRehash(User *user)
        {
                /*
                 * Process config-defined list of permanent channels.
@@ -119,7 +125,17 @@ public:
                        {
                                c = new Channel(ServerInstance, channel, ServerInstance->Time());
                                if (!topic.empty())
+                               {
                                        c->SetTopic(NULL, topic, true);
+
+                                       /*
+                                        * Due to the way protocol works in 1.2, we need to hack the topic TS in such a way that this
+                                        * topic will always win over others.
+                                        *
+                                        * This is scheduled for (proper) fixing in a later release, and can be removed at a later date.
+                                        */
+                                       c->topicset = 42;
+                               }
                                ServerInstance->Logs->Log("blah", DEBUG, "Added %s with topic %s", channel.c_str(), topic.c_str());
 
                                if (modes.empty())