diff options
| author | Sadie Powell <sadie@witchery.services> | 2025-03-08 12:41:22 +0000 |
|---|---|---|
| committer | Sadie Powell <sadie@witchery.services> | 2025-03-08 12:41:22 +0000 |
| commit | b4ab7dadb94c463b46e8bef5bce8c8c531bf1995 (patch) | |
| tree | 48311e75ab149d98e9524f3df3e4d284f07fd65e /modules | |
| parent | df0cd3ef3e9a5cd1230aebdb45569f54512373ad (diff) | |
Use a C++11 lambda instead of a channel sorting method.
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/nickserv/ns_alist.cpp | 9 | ||||
| -rw-r--r-- | modules/webcpanel/pages/chanserv/utils.cpp | 12 | ||||
| -rw-r--r-- | modules/webcpanel/pages/nickserv/alist.cpp | 9 |
3 files changed, 9 insertions, 21 deletions
diff --git a/modules/nickserv/ns_alist.cpp b/modules/nickserv/ns_alist.cpp index 526288aca..4b246f54f 100644 --- a/modules/nickserv/ns_alist.cpp +++ b/modules/nickserv/ns_alist.cpp @@ -14,11 +14,6 @@ class CommandNSAList final : public Command { - static bool ChannelSort(ChannelInfo *ci1, ChannelInfo *ci2) - { - return ci::less()(ci1->name, ci2->name); - } - public: CommandNSAList(Module *creator) : Command(creator, "nickserv/alist", 0, 2) { @@ -50,7 +45,9 @@ public: std::deque<ChannelInfo *> queue; nc->GetChannelReferences(queue); - std::sort(queue.begin(), queue.end(), ChannelSort); + std::sort(queue.begin(), queue.end(), [](auto *lhs, auto *rhs) { + return ci::less()(lhs->name, rhs->name); + }); for (auto *ci : queue) { diff --git a/modules/webcpanel/pages/chanserv/utils.cpp b/modules/webcpanel/pages/chanserv/utils.cpp index c1eafcf8b..bf46667b3 100644 --- a/modules/webcpanel/pages/chanserv/utils.cpp +++ b/modules/webcpanel/pages/chanserv/utils.cpp @@ -7,14 +7,6 @@ #include "../../webcpanel.h" -namespace -{ - bool ChannelSort(ChannelInfo *ci1, ChannelInfo *ci2) - { - return ci::less()(ci1->name, ci2->name); - } -} - namespace WebCPanel { @@ -25,7 +17,9 @@ void BuildChanList(NickAlias *na, TemplateFileServer::Replacements &replacements { std::deque<ChannelInfo *> queue; na->nc->GetChannelReferences(queue); - std::sort(queue.begin(), queue.end(), ChannelSort); + std::sort(queue.begin(), queue.end(), [](auto *lhs, auto *rhs) { + return ci::less()(lhs->name, rhs->name); + }); for (auto *ci : queue) { diff --git a/modules/webcpanel/pages/nickserv/alist.cpp b/modules/webcpanel/pages/nickserv/alist.cpp index 0d8026124..4b3d45fe3 100644 --- a/modules/webcpanel/pages/nickserv/alist.cpp +++ b/modules/webcpanel/pages/nickserv/alist.cpp @@ -7,11 +7,6 @@ #include "../../webcpanel.h" -static bool ChannelSort(ChannelInfo *ci1, ChannelInfo *ci2) -{ - return ci::less()(ci1->name, ci2->name); -} - WebCPanel::NickServ::Alist::Alist(const Anope::string &cat, const Anope::string &u) : WebPanelProtectedPage(cat, u) { } @@ -20,7 +15,9 @@ bool WebCPanel::NickServ::Alist::OnRequest(HTTPProvider *server, const Anope::st { std::deque<ChannelInfo *> queue; na->nc->GetChannelReferences(queue); - std::sort(queue.begin(), queue.end(), ChannelSort); + std::sort(queue.begin(), queue.end(), [](auto *lhs, auto *rhs) { + return ci::less()(lhs->name, rhs->name); + }); int chan_count = 0; |
