#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");
return MOD_RES_ALLOW;
return MOD_RES_PASSTHRU;
}
-
- ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding)
- {
- return MODEACTION_ALLOW;
- }
};
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