summaryrefslogtreecommitdiff
path: root/src/coremods
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2018-12-12 20:34:46 +0000
committerPeter Powell <petpow@saberuk.com>2018-12-12 21:43:24 +0000
commit0f7cfd46ef2d277f5f82e34a2852c75212d75261 (patch)
tree73445b54ad2ce50ae75999ec9f939ff1097b057a /src/coremods
parent4e0cb28c1913c4ef76dd06b04fe321afe310f232 (diff)
Fix conversion issues by replacing ConvToInt with ConvToNum<T>.
The former was a thin wrapper around atol and brought with it all of the weird parsing logic of atol which is almost never what is actually wanted. It also almost never returned the numeric type which is actually wanted which can cause weird issues when casting.
Diffstat (limited to 'src/coremods')
-rw-r--r--src/coremods/core_channel/cmd_invite.cpp4
-rw-r--r--src/coremods/core_channel/invite.cpp2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/coremods/core_channel/cmd_invite.cpp b/src/coremods/core_channel/cmd_invite.cpp
index 1b480aa20..ebb95f1b4 100644
--- a/src/coremods/core_channel/cmd_invite.cpp
+++ b/src/coremods/core_channel/cmd_invite.cpp
@@ -53,7 +53,7 @@ CmdResult CommandInvite::Handle(User* user, const Params& parameters)
if (IS_LOCAL(user))
timeout = ServerInstance->Time() + InspIRCd::Duration(parameters[2]);
else if (parameters.size() > 3)
- timeout = ConvToInt(parameters[3]);
+ timeout = ConvToNum<time_t>(parameters[3]);
}
if (!c)
@@ -75,7 +75,7 @@ CmdResult CommandInvite::Handle(User* user, const Params& parameters)
return CMD_INVALID;
// Drop the invite if our channel TS is lower
- time_t RemoteTS = ConvToInt(parameters[2]);
+ time_t RemoteTS = ConvToNum<time_t>(parameters[2]);
if (c->age < RemoteTS)
return CMD_FAILURE;
}
diff --git a/src/coremods/core_channel/invite.cpp b/src/coremods/core_channel/invite.cpp
index 7ac662edc..51fb638f8 100644
--- a/src/coremods/core_channel/invite.cpp
+++ b/src/coremods/core_channel/invite.cpp
@@ -162,7 +162,7 @@ void Invite::APIImpl::Unserialize(LocalUser* user, const std::string& value)
{
Channel* chan = ServerInstance->FindChan(channame);
if (chan)
- Create(user, chan, ConvToInt(exptime));
+ Create(user, chan, ConvToNum<time_t>(exptime));
}
}