diff options
| author | Sadie Powell <sadie@witchery.services> | 2025-03-19 10:12:02 +0000 |
|---|---|---|
| committer | Sadie Powell <sadie@witchery.services> | 2025-03-19 10:12:02 +0000 |
| commit | e86fa67e38788982993e40210aa4a24db890dbbd (patch) | |
| tree | df6e7b9a827cbd9093d8b74e130d16e25251da30 /modules/memoserv | |
| parent | 1fc26420345901d2963657fd765fd24af4bce4cd (diff) | |
Use a set instead of a vector for storing memo ignores.
Diffstat (limited to 'modules/memoserv')
| -rw-r--r-- | modules/memoserv/ms_ignore.cpp | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/modules/memoserv/ms_ignore.cpp b/modules/memoserv/ms_ignore.cpp index 1a3a054d5..6b50d90bc 100644 --- a/modules/memoserv/ms_ignore.cpp +++ b/modules/memoserv/ms_ignore.cpp @@ -57,23 +57,15 @@ public: return; } - if (std::find(mi->ignores.begin(), mi->ignores.end(), param.ci_str()) == mi->ignores.end()) - { - mi->ignores.emplace_back(param.ci_str()); + if (mi->ignores.insert(param).second) source.Reply(_("\002%s\002 added to ignore list."), param.c_str()); - } else source.Reply(_("\002%s\002 is already on the ignore list."), param.c_str()); } else if (command.equals_ci("DEL") && !param.empty()) { - std::vector<Anope::string>::iterator it = std::find(mi->ignores.begin(), mi->ignores.end(), param.ci_str()); - - if (it != mi->ignores.end()) - { - mi->ignores.erase(it); + if (mi->ignores.erase(param)) source.Reply(_("\002%s\002 removed from the ignore list."), param.c_str()); - } else source.Reply(_("\002%s\002 is not on the ignore list."), param.c_str()); } |
