]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/wildcard.cpp
Tidyup
[user/henk/code/inspircd.git] / src / wildcard.cpp
index aa9f52102d66e9600d0fcfa1371fe68d62c86647..57b1bab4814bcf144031bd602770be37710c05bb 100644 (file)
 using namespace std;
 
 #include <string>
-#include "inspircd_config.h"
 #include "inspircd.h"
-#include "helperfuncs.h"
+#include "hashcomp.h"
 #include "inspstring.h"
 
-extern char lowermap[255];
+using irc::sockets::MatchCIDR;
 
 // Wed 27 Apr 2005 - Brain
 // I've taken our our old wildcard routine -
@@ -36,7 +35,7 @@ extern char lowermap[255];
 
 bool match(const char *str, const char *mask)
 {
-       unsigned char *cp, *mp;
+       unsigned char *cp = NULL, *mp = NULL;
        unsigned char* string = (unsigned char*)str;
        unsigned char* wild = (unsigned char*)mask;
 
@@ -83,3 +82,10 @@ bool match(const char *str, const char *mask)
        return !*wild;
 }
 
+/* Overloaded function that has the option of using cidr */
+bool match(const char *str, const char *mask, bool use_cidr_match)
+{
+       if (use_cidr_match && MatchCIDR(str, mask, true))
+               return true;
+       return match(str, mask);
+}