aboutsummaryrefslogtreecommitdiffstats
path: root/modules/delaymsg.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2026-03-29 13:34:14 +0100
committerGravatar Sadie Powell2026-03-29 14:12:41 +0100
commit5095617d6c53081521efb673823946cbfc183753 (patch)
treebd444f9c6b1a317500fc01902e6a1953a729bea9 /modules/delaymsg.cpp
parentGet rid of thismod/Parent in the mysql module. (diff)
downloadinspircd++-5095617d6c53081521efb673823946cbfc183753.tar.gz
inspircd++-5095617d6c53081521efb673823946cbfc183753.tar.bz2
inspircd++-5095617d6c53081521efb673823946cbfc183753.zip
Avoid the direct use of intptr_t wherever possible.
This may cause problems on systems like CheriBSD where the pointer type stores extra data.
Diffstat (limited to 'modules/delaymsg.cpp')
-rw-r--r--modules/delaymsg.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/modules/delaymsg.cpp b/modules/delaymsg.cpp
index 103ab3ae4..4997ad26a 100644
--- a/modules/delaymsg.cpp
+++ b/modules/delaymsg.cpp
@@ -28,13 +28,15 @@
#include "timeutils.h"
#include "numerichelper.h"
+using TimeExtItem = NumExtItem<time_t>;
+
class DelayMsgMode final
- : public ParamMode<DelayMsgMode, IntExtItem>
+ : public ParamMode<DelayMsgMode, TimeExtItem>
{
public:
- IntExtItem jointime;
+ TimeExtItem jointime;
DelayMsgMode(const WeakModulePtr& Parent)
- : ParamMode<DelayMsgMode, IntExtItem>(Parent, "delaymsg", 'd')
+ : ParamMode<DelayMsgMode, TimeExtItem>(Parent, "delaymsg", 'd')
, jointime(Parent, "delaymsg", ExtensionType::MEMBERSHIP)
{
ranktoset = ranktounset = OP_VALUE;
@@ -43,13 +45,13 @@ public:
bool ResolveModeConflict(const std::string& their_param, const std::string& our_param, Channel*) override
{
- return ConvToNum<intptr_t>(their_param) < ConvToNum<intptr_t>(our_param);
+ return ConvToNum<time_t>(their_param) < ConvToNum<time_t>(our_param);
}
bool OnSet(User* source, Channel* chan, std::string& parameter) override;
void OnUnset(User* source, Channel* chan) override;
- void SerializeParam(Channel* chan, intptr_t n, std::string& out)
+ void SerializeParam(Channel* chan, time_t n, std::string& out)
{
out += ConvToStr(n);
}
@@ -81,7 +83,7 @@ public:
bool DelayMsgMode::OnSet(User* source, Channel* chan, std::string& parameter)
{
// Setting a new limit, sanity check
- intptr_t limit = ConvToNum<intptr_t>(parameter);
+ auto limit = ConvToNum<time_t>(parameter);
if (limit <= 0)
limit = 1;
@@ -129,7 +131,7 @@ ModResult ModuleDelayMsg::HandleMessage(User* user, const MessageTarget& target)
if (ts == 0)
return MOD_RES_PASSTHRU;
- intptr_t len = djm.ext.Get(channel);
+ const auto len = djm.ext.Get(channel);
if ((ts + len) > ServerInstance->Time())
{