+2009-01-12 Michael Poole <mdpoole@troilus.org>
+
+ * ircd/gline.c (count_users): Accept "flags" mask to limit count
+ to local users.
+ (gline_add): Pass the flags to count_users().
+
2009-01-12 Michael Poole <mdpoole@troilus.org>
* include/gline.h (gline_forward_deactivation): Declare.
/** Count number of users who match \a mask.
* @param[in] mask user\@host or user\@ip mask to check.
+ * @param[in] flags Bitmask possibly containing the value GLINE_LOCAL, to limit searches to this server.
* @return Count of matching users.
*/
static int
-count_users(char *mask)
+count_users(char *mask, int flags)
{
struct irc_in_addr ipmask;
struct Client *acptr;
for (acptr = GlobalClientList; acptr; acptr = cli_next(acptr)) {
if (!IsUser(acptr))
continue;
+ if ((flags & GLINE_LOCAL) && !MyConnect(acptr))
+ continue;
ircd_snprintf(0, namebuf, sizeof(namebuf), "%s@%s",
cli_user(acptr)->username, cli_user(acptr)->host);
break;
}
- if ((tmp = count_users(uhmask)) >=
+ if ((tmp = count_users(uhmask, flags)) >=
feature_int(FEAT_GLINEMAXUSERCOUNT) && !(flags & GLINE_OPERFORCE))
return send_reply(sptr, ERR_TOOMANYUSERS, tmp);
}