aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Sadie Powell2026-05-20 11:48:34 +0100
committerGravatar Sadie Powell2026-05-20 12:08:51 +0100
commit5837dd2ee5b4e83f2f116f43589ae48664458e90 (patch)
treecf394b309ad94355eaa523961497d6083a728e9d
parentFix labelling quit messages. (diff)
Fix some LIST filter edge cases.
This won't pass irctest until #375 is merged.
-rw-r--r--.github/workflows/ci-irctest.yml2
-rw-r--r--src/coremods/core_list.cpp20
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<time_t> ParseMinutes(const std::string& value)
{
- time_t minutes = ConvToNum<time_t>(value.c_str() + 2);
- if (!minutes)
- return 0;
+ const auto minutes = ConvToNum<time_t>(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 "C<val" and "C>val" 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<time_t> mincreationtime;
+ std::optional<time_t> 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 "T<val" and "T>val" 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<time_t> mintopictime;
+ std::optional<time_t> maxtopictime;
// U: Searching based on user count within the channel, via the "<val" and
// ">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.