From 5837dd2ee5b4e83f2f116f43589ae48664458e90 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Wed, 20 May 2026 11:48:34 +0100 Subject: Fix some LIST filter edge cases. This won't pass irctest until #375 is merged. --- .github/workflows/ci-irctest.yml | 2 +- src/coremods/core_list.cpp | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci-irctest.yml b/.github/workflows/ci-irctest.yml index 9a0bcde31..d4c989467 100644 --- a/.github/workflows/ci-irctest.yml +++ b/.github/workflows/ci-irctest.yml @@ -10,7 +10,7 @@ name: irctest env: ANOPE_REF: 2.1.24 ATHEME_REF: 113eeb4866a008757c77123bc1a89ecdf62b0b39 # 2026-04-13 - IRCTEST_REF: b79a6eebe110e888d56cc865d8e54b634baf0b73 # 2026-04-29 + IRCTEST_REF: 104a419a77f89b622bf232cb8d5d7a2c23086daa # SADIE FORK: 2026-05-20 on: pull_request: diff --git a/src/coremods/core_list.cpp b/src/coremods/core_list.cpp index 3e9861070..2970569db 100644 --- a/src/coremods/core_list.cpp +++ b/src/coremods/core_list.cpp @@ -46,11 +46,11 @@ private: * @param value The parameter containing a minute count. * @return The UNIX time at \p value minutes ago. */ - static time_t ParseMinutes(const std::string& value) + static std::optional ParseMinutes(const std::string& value) { - time_t minutes = ConvToNum(value.c_str() + 2); - if (!minutes) - return 0; + const auto minutes = ConvToNum(value.c_str() + 2, -1); + if (minutes < 0) + return std::nullopt; return ServerInstance->Time() - (minutes * 60); } @@ -74,8 +74,8 @@ CmdResult CommandList::Handle(User* user, const Params& parameters) // C: Searching based on creation time, via the "Cval" modifiers // to search for a channel creation time that is lower or higher than val // respectively. - time_t mincreationtime = 0; - time_t maxcreationtime = 0; + std::optional mincreationtime; + std::optional maxcreationtime; // M: Searching based on mask. std::string match; @@ -85,8 +85,8 @@ CmdResult CommandList::Handle(User* user, const Params& parameters) // T: Searching based on topic time, via the "Tval" modifiers to // search for a topic time that is lower or higher than val respectively. - time_t mintopictime = 0; - time_t maxtopictime = 0; + std::optional mintopictime; + std::optional maxtopictime; // U: Searching based on user count within the channel, via the "val" modifiers to search for a channel that has less than or more than @@ -150,12 +150,12 @@ CmdResult CommandList::Handle(User* user, const Params& parameters) // Check the creation ts if a search has been specified. const time_t creationtime = chan->age; - if ((mincreationtime && creationtime <= mincreationtime) || (maxcreationtime && creationtime >= maxcreationtime)) + if ((mincreationtime && creationtime <= *mincreationtime) || (maxcreationtime && creationtime >= *maxcreationtime)) continue; // Check the topic ts if a search has been specified. const time_t topictime = chan->topicset; - if ((mintopictime && (!topictime || topictime <= mintopictime)) || (maxtopictime && (!topictime || topictime >= maxtopictime))) + if ((mintopictime && (!topictime || topictime <= *mintopictime)) || (maxtopictime && (!topictime || topictime >= *maxtopictime))) continue; // Attempt to match a glob pattern. -- cgit v1.3.1-10-gc9f91