diff options
author | Peter Powell <petpow@saberuk.com> | 2019-01-28 10:31:55 +0000 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2019-01-28 11:15:15 +0000 |
commit | 5ed970ca7d4e079ca9ff577974572a577c65e823 (patch) | |
tree | ab46c1dd205d155bfb091666629145c8e4723da6 | |
parent | 874ce50b8dfa74567a426c11bbaef7cda9ad0299 (diff) |
Fix parsing anticaps mode parameters (again).
It is better to fix the underlying bug than the result of it.
This replaces commit 963213132dd923d0e7dbd47ea6f20373cdef343b.
-rw-r--r-- | src/modules/m_anticaps.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/modules/m_anticaps.cpp b/src/modules/m_anticaps.cpp index aa605e6ed..e916edd53 100644 --- a/src/modules/m_anticaps.cpp +++ b/src/modules/m_anticaps.cpp @@ -34,9 +34,9 @@ class AntiCapsSettings public: const AntiCapsMethod method; const uint16_t minlen; - const uint16_t percent; + const uint8_t percent; - AntiCapsSettings(const AntiCapsMethod& Method, const uint16_t& MinLen, const uint16_t& Percent) + AntiCapsSettings(const AntiCapsMethod& Method, const uint16_t& MinLen, const uint8_t& Percent) : method(Method) , minlen(MinLen) , percent(Percent) @@ -83,13 +83,13 @@ class AntiCapsMode : public ParamMode<AntiCapsMode, SimpleExtItem<AntiCapsSettin return true; } - bool ParsePercent(irc::sepstream& stream, uint16_t& percent) + bool ParsePercent(irc::sepstream& stream, uint8_t& percent) { std::string percentstr; if (!stream.GetToken(percentstr)) return false; - uint16_t result = ConvToNum<uint16_t>(percentstr); + uint8_t result = ConvToNum<uint8_t>(percentstr); if (result < 1 || result > 100) return false; @@ -108,7 +108,7 @@ class AntiCapsMode : public ParamMode<AntiCapsMode, SimpleExtItem<AntiCapsSettin irc::sepstream stream(parameter, ':'); AntiCapsMethod method; uint16_t minlen; - uint16_t percent; + uint8_t percent; // Attempt to parse the method. if (!ParseMethod(stream, method) || !ParseMinimumLength(stream, minlen) || !ParsePercent(stream, percent)) @@ -148,7 +148,7 @@ class AntiCapsMode : public ParamMode<AntiCapsMode, SimpleExtItem<AntiCapsSettin out.push_back(':'); out.append(ConvToStr(acs->minlen)); out.push_back(':'); - out.append(ConvToStr(acs->percent)); + out.append(ConvNumeric(acs->percent)); } }; |