+int mask_match(char *mask, struct UserNode *user) {
+ char usermask[NICKLEN+USERLEN+HOSTLEN+3];
+ char matchmask[strlen(mask)+3];
+ strcpy(matchmask, mask);
+ char *host = strchr(mask, '@');
+ if(host) {
+ struct IPNode *ip = createIPNode(host);
+ int bits = (ip->flags & IPNODE_IS_IPV6 ? 128 : 32);
+ if((host = strchr(host, '/'))) {
+ bits = atoi(host+1);
+ }
+ if(ip && user->ip&& !ipmatch(user->ip, ip, bits)) {
+ host[1] = '*';
+ host[2] = '\0';
+ }
+ }
+ sprintf(usermask, "%s!%s@%s", user->nick, user->ident, user->host);
+ return match(matchmask, usermask);
+}
+