X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_chanhistory.cpp;h=540fa29087cbb548307826967d6429e5ae7c1ee7;hb=da53c17315d3eb0d0177608d306d208bdf05786b;hp=06840744b1e7269ad7d9806bee8079def89720e6;hpb=75e144b55e761b663958599dc40dc8fd670445db;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_chanhistory.cpp b/src/modules/m_chanhistory.cpp index 06840744b..540fa2908 100644 --- a/src/modules/m_chanhistory.cpp +++ b/src/modules/m_chanhistory.cpp @@ -48,20 +48,6 @@ struct HistoryList class HistoryMode : public ParamMode > { - bool IsValidDuration(const std::string& duration) - { - for (std::string::const_iterator i = duration.begin(); i != duration.end(); ++i) - { - unsigned char c = *i; - if (((c >= '0') && (c <= '9')) || (c == 's') || (c == 'S')) - continue; - - if (duration_multi[c] == 1) - return false; - } - return true; - } - public: unsigned int maxlines; HistoryMode(Module* Creator) @@ -79,15 +65,15 @@ class HistoryMode : public ParamMode > } std::string duration(parameter, colon+1); - if ((IS_LOCAL(source)) && ((duration.length() > 10) || (!IsValidDuration(duration)))) + if ((IS_LOCAL(source)) && ((duration.length() > 10) || (!InspIRCd::IsValidDuration(duration)))) { source->WriteNumeric(Numerics::InvalidModeParameter(channel, this, parameter)); return MODEACTION_DENY; } - unsigned int len = ConvToInt(parameter.substr(0, colon)); - unsigned int time = InspIRCd::Duration(duration); - if (len == 0 || (len > maxlines && IS_LOCAL(source))) + unsigned int len = ConvToNum(parameter.substr(0, colon)); + unsigned long time; + if (!InspIRCd::Duration(duration, time) || len == 0 || (len > maxlines && IS_LOCAL(source))) { source->WriteNumeric(Numerics::InvalidModeParameter(channel, this, parameter)); return MODEACTION_DENY; @@ -221,7 +207,7 @@ class ModuleChanHistory Version GetVersion() CXX11_OVERRIDE { - return Version("Provides channel history replayed on join", VF_VENDOR); + return Version("Provides channel mode +H, allows for the channel message history to be replayed on join", VF_VENDOR); } };