summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2018-11-24 23:27:16 +0000
committerPeter Powell <petpow@saberuk.com>2018-11-24 23:27:16 +0000
commitcc5aff3e5a7d83eb0154faf1540fc74959a6f0e5 (patch)
tree10851e87ec7b97f9aa53d77e4f941f4b84855e27 /include
parent6596fb5ffea7a23827c994168ca1611918857af6 (diff)
Move IsValidDuration into the core.
Diffstat (limited to 'include')
-rw-r--r--include/command_parse.h27
-rw-r--r--include/inspircd.h6
2 files changed, 6 insertions, 27 deletions
diff --git a/include/command_parse.h b/include/command_parse.h
index 98484ca54..ccea2ac50 100644
--- a/include/command_parse.h
+++ b/include/command_parse.h
@@ -147,30 +147,3 @@ class CoreExport CommandParser
*/
static std::string TranslateUIDs(const std::vector<TranslateType>& to, const CommandBase::Params& source, bool prefix_final = false, CommandBase* custom_translator = NULL);
};
-
-/** A lookup table of values for multiplier characters used by
- * InspIRCd::Duration(). In this lookup table, the indexes for
- * the ascii values 'm' and 'M' have the value '60', the indexes
- * for the ascii values 'D' and 'd' have a value of '86400', etc.
- */
-const int duration_multi[] =
-{
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 86400, 1, 1, 1, 3600,
- 1, 1, 1, 1, 60, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 604800, 1, 31557600, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 86400, 1, 1, 1, 3600, 1, 1, 1, 1, 60,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 604800, 1, 31557600,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
-};
diff --git a/include/inspircd.h b/include/inspircd.h
index 1e0ca1925..a563edc7f 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -502,6 +502,12 @@ class CoreExport InspIRCd
*/
static unsigned long Duration(const std::string& str);
+ /** Determines whether a string contains a valid duration.
+ * @param str A string containing a time in the form 1y2w3d4h6m5s
+ * @return True if the string is a valid duration; otherwise, false.
+ */
+ static bool IsValidDuration(const std::string& str);
+
/** Attempt to compare a password to a string from the config file.
* This will be passed to handling modules which will compare the data
* against possible hashed equivalents in the input string.