]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_customprefix.cpp
Sync helpop chmodes s and p with docs
[user/henk/code/inspircd.git] / src / modules / m_customprefix.cpp
index 61c50ec0cf11b4bfe6e9c6c78842ab8246c8ca68..53b0376b241a353eeb8f5eaeb72df41ef18064a4 100644 (file)
@@ -1,6 +1,9 @@
 /*
  * InspIRCd -- Internet Relay Chat Daemon
  *
+ *   Copyright (C) 2013-2014 Attila Molnar <attilamolnar@hush.com>
+ *   Copyright (C) 2013, 2017-2018 Sadie Powell <sadie@witchery.services>
+ *   Copyright (C) 2012, 2019 Robby <robby@chatbelgie.be>
  *   Copyright (C) 2010 Daniel De Graaf <danieldg@inspircd.org>
  *
  * This file is part of InspIRCd.  InspIRCd is free software: you can
@@ -28,9 +31,9 @@ class CustomPrefixMode : public PrefixMode
                : PrefixMode(parent, Name, Letter, 0, Prefix)
                , tag(Tag)
        {
-               long rank = tag->getInt("rank", 0, 0, UINT_MAX);
-               long setrank = tag->getInt("ranktoset", prefixrank, rank, UINT_MAX);
-               long unsetrank = tag->getInt("ranktounset", setrank, setrank, UINT_MAX);
+               unsigned long rank = tag->getUInt("rank", 0, 0, UINT_MAX);
+               unsigned long setrank = tag->getUInt("ranktoset", prefixrank, rank, UINT_MAX);
+               unsigned long unsetrank = tag->getUInt("ranktounset", setrank, setrank, UINT_MAX);
                bool depriv = tag->getBool("depriv", true);
                this->Update(rank, setrank, unsetrank, depriv);
 
@@ -58,15 +61,15 @@ class ModuleCustomPrefix : public Module
                        {
                                ModeHandler* mh = ServerInstance->Modes->FindMode(name, MODETYPE_CHANNEL);
                                if (!mh)
-                                       throw ModuleException("<customprefix:change> specified for a non-existent mode at " + tag->getTagLocation());
+                                       throw ModuleException("<customprefix:change> specified for a nonexistent mode at " + tag->getTagLocation());
 
                                PrefixMode* pm = mh->IsPrefixMode();
                                if (!pm)
                                        throw ModuleException("<customprefix:change> specified for a non-prefix mode at " + tag->getTagLocation());
 
-                               long rank = tag->getInt("rank", pm->GetPrefixRank(), 0, UINT_MAX);
-                               long setrank = tag->getInt("ranktoset", pm->GetLevelRequired(true), rank, UINT_MAX);
-                               long unsetrank = tag->getInt("ranktounset", pm->GetLevelRequired(false), setrank, UINT_MAX);
+                               unsigned long rank = tag->getUInt("rank", pm->GetPrefixRank(), 0, UINT_MAX);
+                               unsigned long setrank = tag->getUInt("ranktoset", pm->GetLevelRequired(true), rank, UINT_MAX);
+                               unsigned long unsetrank = tag->getUInt("ranktounset", pm->GetLevelRequired(false), setrank, UINT_MAX);
                                bool depriv = tag->getBool("depriv", pm->CanSelfRemove());
                                pm->Update(rank, setrank, unsetrank, depriv);
 
@@ -86,6 +89,7 @@ class ModuleCustomPrefix : public Module
                        try
                        {
                                CustomPrefixMode* mh = new CustomPrefixMode(this, name, letter[0], prefix[0], tag);
+                               modes.push_back(mh);
                                ServerInstance->Modules->AddService(*mh);
                        }
                        catch (ModuleException& e)
@@ -102,7 +106,7 @@ class ModuleCustomPrefix : public Module
 
        Version GetVersion() CXX11_OVERRIDE
        {
-               return Version("Provides custom prefix channel modes", VF_VENDOR);
+               return Version("Allows the server administrator to configure custom channel prefix modes.", VF_VENDOR);
        }
 };