/*! \brief UNKLINE command handler * * \param source_p Pointer to allocated Client struct from which the message * originally comes from. This can be a local or remote client. * \param parc Integer holding the number of supplied arguments. * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL * pointers. * \note Valid arguments for this command are: * - parv[0] = command * - parv[1] = user\@host mask * - parv[2] = "ON" * - parv[3] = target server */ static int mo_unkline(struct Client *source_p, int parc, char *parv[]) { char *target_server = NULL; char *user, *host; if (!HasOFlag(source_p, OPER_FLAG_UNKLINE)) { sendto_one_numeric(source_p, &me, ERR_NOPRIVS, "unkline"); return 0; } if (EmptyString(parv[1])) { sendto_one_numeric(source_p, &me, ERR_NEEDMOREPARAMS, "UNKLINE"); return 0; } if (parse_aline("UNKLINE", source_p, parc, parv, 0, &user, &host, NULL, &target_server, NULL) < 0) return 0; if (target_server) { sendto_match_servs(source_p, target_server, CAP_UNKLN, "UNKLINE %s %s %s", target_server, user, host); /* Allow ON to apply local unkline as well if it matches */ if (match(target_server, me.name)) return 0; } else cluster_a_line(source_p, "UNKLINE", CAP_UNKLN, SHARED_UNKLINE, "%s %s", user, host); if (remove_kline_match(host, user)) { sendto_one_notice(source_p, &me, ":K-Line for [%s@%s] is removed", user, host); sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, "%s has removed the K-Line for: [%s@%s]", get_oper_name(source_p), user, host); ilog(LOG_TYPE_KLINE, "%s removed K-Line for [%s@%s]", get_oper_name(source_p), user, host); } else sendto_one_notice(source_p, &me, ":No K-Line for [%s@%s] found", user, host); return 0; }
/*! \brief UNKLINE command handler * * \param source_p Pointer to allocated Client struct from which the message * originally comes from. This can be a local or remote client. * \param parc Integer holding the number of supplied arguments. * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL * pointers. * \note Valid arguments for this command are: * - parv[0] = command * - parv[1] = target server * - parv[2] = user mask * - parv[3] = host mask */ static int ms_unkline(struct Client *source_p, int parc, char *parv[]) { const char *kuser, *khost; if (parc != 4 || EmptyString(parv[3])) return 0; sendto_match_servs(source_p, parv[1], CAP_UNKLN, "UNKLINE %s %s %s", parv[1], parv[2], parv[3]); kuser = parv[2]; khost = parv[3]; if (match(parv[1], me.name)) return 0; if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(CONF_ULINE, source_p->servptr->name, source_p->username, source_p->host, SHARED_UNKLINE)) { if (remove_kline_match(khost, kuser)) { if (IsClient(source_p)) sendto_one_notice(source_p, &me, ":K-Line for [%s@%s] is removed", kuser, khost); sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, "%s has removed the K-Line for: [%s@%s]", get_oper_name(source_p), kuser, khost); ilog(LOG_TYPE_KLINE, "%s removed K-Line for [%s@%s]", get_oper_name(source_p), kuser, khost); } else if (IsClient(source_p)) sendto_one_notice(source_p, &me, ":No K-Line for [%s@%s] found", kuser, khost); } return 0; }