diff options
author | Adam <Adam@anope.org> | 2014-08-03 18:22:03 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2014-08-03 18:22:03 -0400 |
commit | cf89e10a4c5d968ca46ca462cf643cfe8c246be0 (patch) | |
tree | 27f3eb9ea8daa878450ed7dc9fde20130f7343d7 | |
parent | 6842ad36f7367412859232ad226071ae860d3d87 (diff) |
Add ms_ignore:max config option
-rw-r--r-- | data/memoserv.example.conf | 12 | ||||
-rw-r--r-- | modules/commands/ms_ignore.cpp | 6 |
2 files changed, 17 insertions, 1 deletions
diff --git a/data/memoserv.example.conf b/data/memoserv.example.conf index 1ab45514e..9f07ec424 100644 --- a/data/memoserv.example.conf +++ b/data/memoserv.example.conf @@ -137,7 +137,17 @@ command { service = "MemoServ"; name = "DEL"; command = "memoserv/del"; } * * Used to ignore memos from specific users. */ -module { name = "ms_ignore" } +module +{ + name = "ms_ignore" + + /* + * The maximum number of entries that may be on a memo ignore list. + * + * This directive is optional. + */ + max = 32 +} command { service = "MemoServ"; name = "IGNORE"; command = "memoserv/ignore"; } /* diff --git a/modules/commands/ms_ignore.cpp b/modules/commands/ms_ignore.cpp index 4483f9684..5db7117bf 100644 --- a/modules/commands/ms_ignore.cpp +++ b/modules/commands/ms_ignore.cpp @@ -50,6 +50,12 @@ class CommandMSIgnore : public Command source.Reply(ACCESS_DENIED); else if (command.equals_ci("ADD") && !param.empty()) { + if (mi->ignores.size() >= Config->GetModule(this->owner)->Get<unsigned>("max", "32")) + { + source.Reply(_("Sorry, the memo ignore list for \002%s\002 is full."), channel.c_str()); + return; + } + if (std::find(mi->ignores.begin(), mi->ignores.end(), param.ci_str()) == mi->ignores.end()) { mi->ignores.push_back(param.ci_str()); |