summaryrefslogtreecommitdiff
path: root/include/builtinmodes.h
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-02-15 14:38:24 +0100
committerAttila Molnar <attilamolnar@hush.com>2014-02-15 14:38:24 +0100
commit0556720b559d7ec5d8badacf0ac9b11e9c864847 (patch)
tree0435a0e5b8e722fe35afb3f820f804bec8c0c7b2 /include/builtinmodes.h
parent88baaf9e68efd9824b906a69320053734d408e14 (diff)
Add ParamModeBase and ParamMode, change all parameter modes to inherit from ParamMode
- Type of the extension used to store data is a template parameter - The extension is automatically unset when the mode is unset - Handlers inheriting from ParamMode have to provide OnSet() and SerializeParam(); may optionally provide OnUnset() - Transparently handle the case when OnSet() modifies the mode parameter - Remove Channel::custom_mode_params map; ask the mode handlers to serialize their parameters instead
Diffstat (limited to 'include/builtinmodes.h')
-rw-r--r--include/builtinmodes.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/include/builtinmodes.h b/include/builtinmodes.h
index ce73a7817..6aab727cc 100644
--- a/include/builtinmodes.h
+++ b/include/builtinmodes.h
@@ -47,21 +47,24 @@ class ModeChannelInviteOnly : public SimpleChannelModeHandler
/** Channel mode +k
*/
-class ModeChannelKey : public ModeHandler
+class ModeChannelKey : public ParamMode<ModeChannelKey, LocalStringExt>
{
public:
ModeChannelKey();
ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding);
+ void SerializeParam(Channel* chan, const std::string* key, std::string& out);
+ ModeAction OnSet(User* source, Channel* chan, std::string& param);
};
/** Channel mode +l
*/
-class ModeChannelLimit : public ParamChannelModeHandler
+class ModeChannelLimit : public ParamMode<ModeChannelLimit, LocalIntExt>
{
public:
ModeChannelLimit();
- bool ParamValidate(std::string& parameter);
bool ResolveModeConflict(std::string &their_param, const std::string &our_param, Channel* channel);
+ void SerializeParam(Channel* chan, intptr_t n, std::string& out);
+ ModeAction OnSet(User* source, Channel* channel, std::string& parameter);
};
/** Channel mode +m