]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_permchannels.cpp
Mark +P mode as oper-only now that it no longer requires an explicit permission string
[user/henk/code/inspircd.git] / src / modules / m_permchannels.cpp
index 4eed5374720515e8d2e134b421810cb660eb9bbb..a3d023ffe39fdd57f8eed96f474bc8c16a90d63e 100644 (file)
@@ -110,16 +110,10 @@ static bool WriteDatabase()
 class PermChannel : public ModeHandler
 {
  public:
-       PermChannel(Module* Creator) : ModeHandler(Creator, "permanent", 'P', PARAM_NONE, MODETYPE_CHANNEL) { }
+       PermChannel(Module* Creator) : ModeHandler(Creator, "permanent", 'P', PARAM_NONE, MODETYPE_CHANNEL) { oper = true; }
 
        ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding)
        {
-               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'))
@@ -217,15 +211,16 @@ public:
                 * Process config-defined list of permanent channels.
                 * -- w00t
                 */
-               ConfigReader MyConf;
 
-               permchannelsconf = MyConf.ReadValue("permchanneldb", "filename", "", 0, false);
+               permchannelsconf = ServerInstance->Config->ConfValue("permchanneldb")->getString("filename");
 
-               for (int i = 0; i < MyConf.Enumerate("permchannels"); i++)
+               ConfigTagList permchannels = ServerInstance->Config->ConfTags("permchannels");
+               for (ConfigIter i = permchannels.first; i != permchannels.second; ++i)
                {
-                       std::string channel = MyConf.ReadValue("permchannels", "channel", i);
-                       std::string topic = MyConf.ReadValue("permchannels", "topic", i);
-                       std::string modes = MyConf.ReadValue("permchannels", "modes", i);
+                       ConfigTag* tag = i->second;
+                       std::string channel = tag->getString("channel");
+                       std::string topic = tag->getString("topic");
+                       std::string modes = tag->getString("modes");
 
                        if (channel.empty())
                        {
@@ -295,7 +290,7 @@ public:
 
        virtual Version GetVersion()
        {
-               return Version("Provides support for channel mode +P to provide permanent channels",VF_COMMON|VF_VENDOR);
+               return Version("Provides support for channel mode +P to provide permanent channels",VF_VENDOR);
        }
 
        virtual ModResult OnChannelPreDelete(Channel *c)