diff options
author | Peter Powell <petpow@saberuk.com> | 2013-05-06 11:49:50 +0100 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2013-05-15 03:32:56 +0100 |
commit | accccc212cd4f08a3c5532b1ae7a17e76bac8718 (patch) | |
tree | 18f4370778cc79d2f21a4308dafbb29a77cfa213 /include | |
parent | 23e8bba13c55d33ce89d505780da36c9589e300a (diff) |
Replace some C-isms with C++-isms.
* 'const char*' to 'const std::string&'.
* snprintf to std::string concatenation.
* Replace duplicated OneOfMatches with InspIRCd::MatchMask.
Diffstat (limited to 'include')
-rw-r--r-- | include/channels.h | 2 | ||||
-rw-r--r-- | include/hashcomp.h | 2 | ||||
-rw-r--r-- | include/inspircd.h | 13 |
3 files changed, 12 insertions, 5 deletions
diff --git a/include/channels.h b/include/channels.h index 2b2681eac..56e1a5a49 100644 --- a/include/channels.h +++ b/include/channels.h @@ -176,7 +176,7 @@ class CoreExport Channel : public Extensible, public InviteBase * @param user The user being kicked (must be on this channel) * @param reason The reason for the kick */ - void KickUser(User *src, User *user, const char* reason); + void KickUser(User *src, User *user, const std::string& reason); /** Part a user from this channel with the given reason. * If the reason field is NULL, no reason will be sent. diff --git a/include/hashcomp.h b/include/hashcomp.h index 3c00844be..3963f96e7 100644 --- a/include/hashcomp.h +++ b/include/hashcomp.h @@ -284,7 +284,7 @@ namespace irc * mode changes to be obtained. */ int GetStackedLine(std::vector<std::string> &result, int max_line_size = 360); - + }; /** irc::tokenstream reads a string formatted as per RFC1459 and RFC2812. diff --git a/include/inspircd.h b/include/inspircd.h index b0cd8f675..c37658515 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -597,7 +597,7 @@ class CoreExport InspIRCd * @param map The character map to use when matching. */ static bool Match(const std::string &str, const std::string &mask, unsigned const char *map = NULL); - static bool Match(const char *str, const char *mask, unsigned const char *map = NULL); + static bool Match(const char *str, const char *mask, unsigned const char *map = NULL); /** Match two strings using pattern matching, optionally, with a map * to check case against (may be NULL). If map is null, match will be case insensitive. @@ -607,7 +607,14 @@ class CoreExport InspIRCd * @param map The character map to use when matching. */ static bool MatchCIDR(const std::string &str, const std::string &mask, unsigned const char *map = NULL); - static bool MatchCIDR(const char *str, const char *mask, unsigned const char *map = NULL); + static bool MatchCIDR(const char *str, const char *mask, unsigned const char *map = NULL); + + /** Matches a hostname and IP against a space delimited list of hostmasks. + * @param masks The space delimited masks to match against. + * @param hostname The hostname to try and match. + * @param ipaddr The IP address to try and match. + */ + static bool MatchMask(const std::string& masks, const std::string& hostname, const std::string& ipaddr); /** Return true if the given parameter is a valid nick!user\@host mask * @param mask A nick!user\@host masak to match against @@ -683,7 +690,7 @@ class CoreExport InspIRCd /** Returns the full version string of this ircd * @return The version string */ - std::string GetVersionString(bool rawversion = false); + std::string GetVersionString(bool getFullVersion = false); /** Attempt to write the process id to a given file * @param filename The PID file to attempt to write to |