int extban_modeq_is_banned(aClient *sptr, aChannel *chptr, char *banin, int type) { char *ban = banin + 3; if (type != BANCHK_MSG) return 0; #ifdef DISABLE_STACKED_EXTBANS return extban_is_banned_helper(ban); #else return ban_check_mask(sptr, chptr, ban, type, 0); #endif }
/** ban_check_mask - Checks if the current user in ban checking (ban_ip, etc) matches the specified n!u@h mask -or- run an extended ban. * @param sptr Client to check (can be remote client) * @param chptr Channel to check * @param banstr Mask string to check user * @param type Type of ban to check for (BANCHK_*) * @param no_extbans 0 to check extbans, nonzero to disable extban checking. * @returns Nonzero if the mask/extban succeeds. Zero if it doesn't. * @comments This is basically extracting the mask and extban check from is_banned_with_nick, but with being a bit more strict in what an extban is. * Strange things could happen if this is called outside standard ban checking. */ inline int ban_check_mask(aClient *sptr, aChannel *chptr, char *banstr, int type, int no_extbans) { Extban *extban = NULL; if (!no_extbans && banstr[0] == '~' && banstr[1] != '\0' && banstr[2] == ':') { /* Is an extended ban. */ extban = findmod_by_bantype(banstr[1]); if (!extban) { return 0; } else { return extban->is_banned(sptr, chptr, banstr, type); } } else { /* Is a n!u@h mask. */ return extban_is_banned_helper(banstr); } }