/* apply_tdline() * * inputs - * output - NONE * side effects - tkline as given is placed */ static void apply_dline(struct Client *source_p, struct MaskItem *conf, time_t tkline_time) { if (tkline_time) { conf->until = CurrentTime + tkline_time; sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, "%s added temporary %d min. D-Line for [%s] [%s]", get_oper_name(source_p), tkline_time/60, conf->host, conf->reason); sendto_one(source_p, ":%s NOTICE %s :Added temporary %d min. D-Line [%s]", MyConnect(source_p) ? me.name : ID_or_name(&me, source_p->from), source_p->name, tkline_time/60, conf->host); ilog(LOG_TYPE_DLINE, "%s added temporary %d min. D-Line for [%s] [%s]", get_oper_name(source_p), tkline_time/60, conf->host, conf->reason); } else { sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, "%s added D-Line for [%s] [%s]", get_oper_name(source_p), conf->host, conf->reason); sendto_one(source_p, ":%s NOTICE %s :Added D-Line [%s]", MyConnect(source_p) ? me.name : ID_or_name(&me, source_p->from), source_p->name, conf->host); ilog(LOG_TYPE_DLINE, "%s added D-Line for [%s] [%s]", get_oper_name(source_p), conf->host, conf->reason); } SetConfDatabase(conf); conf->setat = CurrentTime; add_conf_by_address(CONF_DLINE, conf); rehashed_klines = 1; }
/* parse_resv() * * inputs - source_p, NULL supported * - thing to resv * - time_t if tkline * - reason * outputs - none * side effects - parse resv, create if valid */ static void parse_resv(struct Client *source_p, char *name, int tkline_time, char *reason) { if (IsChanPrefix(*name)) { struct MaskItem *conf = NULL; if ((conf = create_resv(name, reason, NULL)) == NULL) { if (IsClient(source_p)) sendto_one_notice(source_p, &me, ":A RESV has already been placed on channel: %s", name); return; } conf->setat = CurrentTime; SetConfDatabase(conf); if (tkline_time) { if (IsClient(source_p)) sendto_one_notice(source_p, &me, ":A %d minute %s RESV has been placed on channel: %s", tkline_time/60, (MyClient(source_p) ? "local" : "remote"), name); sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, "%s has placed a %d minute %s RESV on channel: %s [%s]", get_oper_name(source_p), tkline_time/60, (MyClient(source_p) ? "local" : "remote"), conf->name, conf->reason); ilog(LOG_TYPE_RESV, "%s added temporary %d min. RESV for [%s] [%s]", get_oper_name(source_p), (int)tkline_time/60, conf->name, conf->reason); conf->until = CurrentTime + tkline_time; } else { if (IsClient(source_p)) sendto_one_notice(source_p, &me, ":A %s RESV has been placed on channel %s", (MyClient(source_p) ? "local" : "remote"), name); sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, "%s has placed a %s RESV on channel %s : [%s]", get_oper_name(source_p), (MyClient(source_p) ? "local" : "remote"), conf->name, conf->reason); ilog(LOG_TYPE_RESV, "%s added RESV for [%s] [%s]", get_oper_name(source_p), conf->name, conf->reason); } } else { struct MaskItem *conf = NULL; if (!valid_wild_card_simple(name)) { if (IsClient(source_p)) sendto_one_notice(source_p, &me, ":Please include at least %u non-wildcard characters with the resv", ConfigGeneral.min_nonwildcard_simple); return; } if (!HasUMode(source_p, UMODE_ADMIN) && has_wildcards(name)) { if (IsClient(source_p)) sendto_one_notice(source_p, &me, ":You must be an admin to perform a wildcard RESV"); return; } if ((conf = create_resv(name, reason, NULL)) == NULL) { if (IsClient(source_p)) sendto_one_notice(source_p, &me, ":A RESV has already been placed on nick %s", name); return; } conf->setat = CurrentTime; SetConfDatabase(conf); if (tkline_time) { if (IsClient(source_p)) sendto_one_notice(source_p, &me, ":A %d minute %s RESV has been placed on nick %s : [%s]", tkline_time/60, (MyClient(source_p) ? "local" : "remote"), conf->name, conf->reason); sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, "%s has placed a %d minute %s RESV on nick %s : [%s]", get_oper_name(source_p), tkline_time/60, (MyClient(source_p) ? "local" : "remote"), conf->name, conf->reason); ilog(LOG_TYPE_RESV, "%s added temporary %d min. RESV for [%s] [%s]", get_oper_name(source_p), (int)tkline_time/60, conf->name, conf->reason); conf->until = CurrentTime + tkline_time; } else { if (IsClient(source_p)) sendto_one_notice(source_p, &me, ":A %s RESV has been placed on nick %s : [%s]", (MyClient(source_p) ? "local" : "remote"), conf->name, conf->reason); sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, "%s has placed a %s RESV on nick %s : [%s]", get_oper_name(source_p), (MyClient(source_p) ? "local" : "remote"), conf->name, conf->reason); ilog(LOG_TYPE_RESV, "%s added RESV for [%s] [%s]", get_oper_name(source_p), conf->name, conf->reason); } } }