From e86fa67e38788982993e40210aa4a24db890dbbd Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Wed, 19 Mar 2025 10:12:02 +0000 Subject: Use a set instead of a vector for storing memo ignores. --- modules/memoserv/ms_ignore.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'modules/memoserv') 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::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()); } -- cgit