]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_customprefix.cpp
Merge pull request #574 from SaberUK/master+build-comment-cleanup
[user/henk/code/inspircd.git] / src / modules / m_customprefix.cpp
index 9bf65b3e80a597179efe52921da7f8254d3925d1..bda11e8b31761ad932279780322d2d5f08c8baf0 100644 (file)
 
 #include "inspircd.h"
 
-/* $ModDesc: Allows custom prefix modes to be created. */
-
 class CustomPrefixMode : public ModeHandler
 {
  public:
        reference<ConfigTag> tag;
-       int rank;
        bool depriv;
+
        CustomPrefixMode(Module* parent, ConfigTag* Tag)
                : ModeHandler(parent, Tag->getString("name"), 0, PARAM_ALWAYS, MODETYPE_CHANNEL), tag(Tag)
        {
@@ -36,16 +34,11 @@ class CustomPrefixMode : public ModeHandler
                prefix = v.c_str()[0];
                v = tag->getString("letter");
                mode = v.c_str()[0];
-               rank = tag->getInt("rank");
-               levelrequired = tag->getInt("ranktoset", rank);
+               prefixrank = tag->getInt("rank");
+               levelrequired = tag->getInt("ranktoset", prefixrank);
                depriv = tag->getBool("depriv", true);
        }
 
-       unsigned int GetPrefixRank()
-       {
-               return rank;
-       }
-
        ModResult AccessCheck(User* src, Channel*, std::string& value, bool adding)
        {
                if (!adding && src->nick == value && depriv)
@@ -53,40 +46,6 @@ class CustomPrefixMode : public ModeHandler
                return MOD_RES_PASSTHRU;
        }
 
-       void RemoveMode(Channel* channel, irc::modestacker* stack)
-       {
-               const UserMembList* cl = channel->GetUsers();
-               std::vector<std::string> mode_junk;
-               mode_junk.push_back(channel->name);
-               irc::modestacker modestack(false);
-               std::vector<std::string> stackresult;
-
-               for (UserMembCIter i = cl->begin(); i != cl->end(); i++)
-               {
-                       if (i->second->hasMode(mode))
-                       {
-                               if (stack)
-                                       stack->Push(this->GetModeChar(), i->first->nick);
-                               else
-                                       modestack.Push(this->GetModeChar(), i->first->nick);
-                       }
-               }
-
-               if (stack)
-                       return;
-
-               while (modestack.GetStackedLine(stackresult))
-               {
-                       mode_junk.insert(mode_junk.end(), stackresult.begin(), stackresult.end());
-                       ServerInstance->SendMode(mode_junk, ServerInstance->FakeClient);
-                       mode_junk.erase(mode_junk.begin() + 1, mode_junk.end());
-               }
-       }
-
-       void RemoveMode(User* user, irc::modestacker* stack)
-       {
-       }
-
        ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding)
        {
                return MODEACTION_ALLOW;
@@ -97,11 +56,7 @@ class ModuleCustomPrefix : public Module
 {
        std::vector<CustomPrefixMode*> modes;
  public:
-       ModuleCustomPrefix()
-       {
-       }
-
-       void init()
+       void init() CXX11_OVERRIDE
        {
                ConfigTagList tags = ServerInstance->Config->ConfTags("customprefix");
                while (tags.first != tags.second)
@@ -110,7 +65,7 @@ class ModuleCustomPrefix : public Module
                        tags.first++;
                        CustomPrefixMode* mh = new CustomPrefixMode(this, tag);
                        modes.push_back(mh);
-                       if (mh->rank <= 0)
+                       if (mh->GetPrefixRank() == 0)
                                throw ModuleException("Rank must be specified for prefix at " + tag->getTagLocation());
                        if (!isalpha(mh->GetModeChar()))
                                throw ModuleException("Mode must be a letter for prefix at " + tag->getTagLocation());
@@ -131,7 +86,7 @@ class ModuleCustomPrefix : public Module
                        delete *i;
        }
 
-       Version GetVersion()
+       Version GetVersion() CXX11_OVERRIDE
        {
                return Version("Provides custom prefix channel modes", VF_VENDOR);
        }