+
+struct Gline *
+IsNickGlined(struct Client *cptr, char *nick)
+{
+ struct Gline *gline;
+ struct Gline *sgline;
+
+ for (gline = GlobalGlineList; gline; gline = sgline) {
+ sgline = gline->gl_next;
+
+ if (gline->gl_expire <= CurrentTime) {
+ gline_free(gline);
+ continue;
+ }
+
+ if (GlineIsRealName(gline)) /* skip realname glines */
+ continue;
+
+ if (!ircd_strcmp(gline->gl_nick, "*")) /* skip glines w. wildcarded nick */
+ continue;
+
+ if (match(gline->gl_nick, nick) != 0)
+ continue;
+
+ if (match(gline->gl_user, (cli_user(cptr))->username) != 0)
+ continue;
+
+ if (GlineIsIpMask(gline)) {
+ if (!ipmask_check(&(cli_ip(cptr)), &gline->gl_addr, gline->gl_bits))
+ continue;
+ }
+ else {
+ if (match(gline->gl_host, (cli_user(cptr))->realhost) != 0)
+ continue;
+ }
+ return gline;
+ }
+ /*
+ * No Glines matched
+ */
+ return 0;
+}
+