diff options
| author | 2026-05-20 11:48:34 +0100 | |
|---|---|---|
| committer | 2026-05-20 12:08:51 +0100 | |
| commit | 5837dd2ee5b4e83f2f116f43589ae48664458e90 (patch) | |
| tree | cf394b309ad94355eaa523961497d6083a728e9d /src | |
| parent | Fix labelling quit messages. (diff) | |
| download | inspircd++-5837dd2ee5b4e83f2f116f43589ae48664458e90.tar.gz inspircd++-5837dd2ee5b4e83f2f116f43589ae48664458e90.tar.bz2 inspircd++-5837dd2ee5b4e83f2f116f43589ae48664458e90.zip | |
Fix some LIST filter edge cases.
This won't pass irctest until #375 is merged.
Diffstat (limited to 'src')
| -rw-r--r-- | src/coremods/core_list.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
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. |
