- return !(IsService(target)
- || (!match_opers && IsOper(target))
- || (target->handle_info
- && target->handle_info->opserv_level > user->handle_info->opserv_level));
+ unsigned char is_victim;
+ unsigned int nn;
+
+ is_victim = !(IsService(target)
+ || (!match_opers && IsOper(target))
+ || (target->handle_info
+ && target->handle_info->opserv_level > user->handle_info->opserv_level));
+
+ // If we don't need an ip check or want to hit opers or the the "cheap" check already disqualified the target, we are done.
+ if (!check_ip || match_opers || !is_victim)
+ return is_victim;
+
+ for(nn = 0; nn < curr_opers.used; nn++) {
+ if(memcmp(&curr_opers.list[nn]->ip, &target->ip, sizeof(irc_in_addr_t)) == 0)
+ return 0;
+ }
+
+ return 1;