]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_customprefix.cpp
Merge insp20
[user/henk/code/inspircd.git] / src / modules / m_customprefix.cpp
index d627bbb96327311aa3cafb02f48ebe32aec737e4..65c2cbd31ef572570215aab7df4cdc20ae587ae0 100644 (file)
 
 #include "inspircd.h"
 
-/* $ModDesc: Allows custom prefix modes to be created. */
-
-class CustomPrefixMode : public ModeHandler
+class CustomPrefixMode : public PrefixMode
 {
  public:
        reference<ConfigTag> tag;
        bool depriv;
 
        CustomPrefixMode(Module* parent, ConfigTag* Tag)
-               : ModeHandler(parent, Tag->getString("name"), 0, PARAM_ALWAYS, MODETYPE_CHANNEL), tag(Tag)
+               : PrefixMode(parent, Tag->getString("name"), 0)
+               , tag(Tag)
        {
-               list = true;
-               m_paramtype = TR_NICK;
                std::string v = tag->getString("prefix");
                prefix = v.c_str()[0];
                v = tag->getString("letter");
@@ -47,11 +44,6 @@ class CustomPrefixMode : public ModeHandler
                        return MOD_RES_ALLOW;
                return MOD_RES_PASSTHRU;
        }
-
-       ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding)
-       {
-               return MODEACTION_ALLOW;
-       }
 };
 
 class ModuleCustomPrefix : public Module
@@ -77,15 +69,14 @@ class ModuleCustomPrefix : public Module
                        }
                        catch (ModuleException& e)
                        {
-                               throw ModuleException(e.err + " (while creating mode from " + tag->getTagLocation() + ")");
+                               throw ModuleException(e.GetReason() + " (while creating mode from " + tag->getTagLocation() + ")");
                        }
                }
        }
 
        ~ModuleCustomPrefix()
        {
-               for (std::vector<CustomPrefixMode*>::iterator i = modes.begin(); i != modes.end(); i++)
-                       delete *i;
+               stdalgo::delete_all(modes);
        }
 
        Version GetVersion() CXX11_OVERRIDE