X-Git-Url: https://jfr.im/git/irc/evilnet/x3.git/blobdiff_plain/2e9062b9f9b65c105a3e230a56752f1c5abed332..0b401fb654b69fd9649954a9bdd5ff041971e62d:/src/tools.c?ds=inline diff --git a/src/tools.c b/src/tools.c index f982272..ce3c936 100644 --- a/src/tools.c +++ b/src/tools.c @@ -367,6 +367,10 @@ irc_strtolower(char *str) { int irccasecmp(const char *stra, const char *strb) { + if (!stra) + return -1; + if (!strb) + return 1; while (*stra && (tolower(*stra) == tolower(*strb))) stra++, strb++; return tolower(*stra) - tolower(*strb); @@ -641,7 +645,7 @@ user_matches_glob(struct userNode *user, const char *orig_glob, int flags, int s if (is_extended) { log_module(MAIN_LOG, LOG_DEBUG, "Extended ban. T (%c) R (%d) M (%s)", exttype, extreverse, glob); switch (exttype) { - case 'a': + case 'a': // account if (user->handle_info) { if (extreverse) { if (0 != strcasecmp(glob, user->handle_info->handle)) @@ -655,7 +659,7 @@ user_matches_glob(struct userNode *user, const char *orig_glob, int flags, int s return 1; } return match_ircglob(user->hostname, glob); - case 'c': + case 'c': // another channel if (!strstr(glob, "#")) return -1; @@ -732,6 +736,17 @@ user_matches_glob(struct userNode *user, const char *orig_glob, int flags, int s return match_ircglob(user->hostname, glob); case 't': /* this is handled ircd side */ return match_ircglob(user->hostname, glob); + case 'R': /* this is handled ircd side */ + return match_ircglob(user->hostname, glob); + case 'm': // mute by mark + if(user->mark && !strcmp(glob, user->mark)) + return true; + else + return false; + + case 'M': // mute by mark unless authed + return false; // can never match a logged in user + default: return -1; } @@ -782,7 +797,8 @@ user_matches_glob(struct userNode *user, const char *orig_glob, int flags, int s /* If only matching the visible hostnames, bail early. */ if ((flags & MATCH_VISIBLE) && IsHiddenHost(user) - && (IsFakeHost(user) || (hidden_host_suffix && user->handle_info))) + && (IsFakeHost(user) || (hidden_host_suffix && user->handle_info) || + user->crypthost || user->cryptip)) return 0; /* If it might be an IP glob, test that. */ if (!glob[strspn(glob, "0123456789./*?")]