diff options
| author | rburchell <rburchell@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-02-15 15:20:47 +0000 |
|---|---|---|
| committer | rburchell <rburchell@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-02-15 15:20:47 +0000 |
| commit | b10305ef3b568a43541213b3ab102f85695d7d37 (patch) | |
| tree | 0ba9817f190c9b080b81e3974e89476448299c58 /include | |
| parent | e1828057c322f6e905bcc55a9b5613853d394081 (diff) | |
Convert to use new, (drastically) faster matching algorithm, from InspIRCd. This adds Anope::Match(), and marks match_wild() and match_wild_nocase() deprecated.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2059 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'include')
| -rw-r--r-- | include/extern.h | 6 | ||||
| -rw-r--r-- | include/services.h | 11 |
2 files changed, 15 insertions, 2 deletions
diff --git a/include/extern.h b/include/extern.h index d826bd62e..9942d8271 100644 --- a/include/extern.h +++ b/include/extern.h @@ -634,8 +634,10 @@ E char *stristr(char *s1, char *s2); E char *strnrepl(char *s, int32 size, const char *old, const char *nstr); E const char *merge_args(int argc, char **argv); E const char *merge_args(int argc, const char **argv); -E int match_wild(const char *pattern, const char *str); -E int match_wild_nocase(const char *pattern, const char *str); + +// Use Anope::Match() instead of these. +E int match_wild(const char *pattern, const char *str) MARK_DEPRECATED; +E int match_wild_nocase(const char *pattern, const char *str) MARK_DEPRECATED; E int dotime(const char *s); E char *duration(NickAlias * na, char *buf, int bufsize, time_t seconds); E char *expire_left(NickAlias * na, char *buf, int len, time_t expires); diff --git a/include/services.h b/include/services.h index bceb829a0..55b9a2a4a 100644 --- a/include/services.h +++ b/include/services.h @@ -1364,6 +1364,17 @@ struct Uplink { } }; +class Anope +{ + public: + /** Check whether two strings match. + * @param mask The pattern to check (e.g. foo*bar) + * @param str The string to check against the pattern (e.g. foobar) + * @param case_sensitive Whether or not the match is case sensitive, default false. + */ + CoreExport static bool Anope::Match(const std::string &str, const std::string &mask, bool case_sensitive = false); +}; + /*************************************************************************/ #endif /* SERVICES_H */ |
