/* 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) { struct ConfItem *conf = NULL; int services = 0; if(IsServices(source_p)) services = 1; if(IsChanPrefix(*name)) { struct ResvChannel *resv_p; if((conf = create_channel_resv(name, reason, 0)) == NULL) { if(!services) sendto_one(source_p, ":%s NOTICE %s :A RESV has already been placed on channel: %s", me.name, source_p->name, name); return; } resv_p = map_to_conf(conf); if(tkline_time != 0) { if(!services) { sendto_one(source_p, ":%s NOTICE %s :A %d minute %s RESV has been placed on channel: %s", me.name, source_p->name, tkline_time / 60, (MyClient(source_p) ? "local" : "remote"), name); sendto_realops_flags(UMODE_ALL, L_ALL, "%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"), resv_p->name, resv_p->reason); } ilog(L_TRACE, "%s added temporary %d min. RESV for [%s] [%s]", source_p->name, (int) tkline_time / 60, conf->name, resv_p->reason); resv_p->hold = CurrentTime + tkline_time; add_temp_line(conf); } else { if(!services) { sendto_one(source_p, ":%s NOTICE %s :A %s RESV has been placed on channel %s", me.name, source_p->name, (MyClient(source_p) ? "local" : "remote"), name); sendto_realops_flags(UMODE_ALL, L_ALL, "%s has placed a %s RESV on channel %s : [%s]", get_oper_name(source_p), (MyClient(source_p) ? "local" : "remote"), resv_p->name, resv_p->reason); } write_conf_line(source_p, conf, NULL /* not used */ , 0 /* not used */ ); } } else { struct MatchItem *resv_p = NULL; if(!valid_wild_card_simple(name) && !IsServices(source_p)) { sendto_one(source_p, ":%s NOTICE %s :Please include at least %d non-wildcard characters with the resv", me.name, source_p->name, ConfigFileEntry.min_nonwildcard_simple); return; } if(!IsAdmin(source_p) && !IsServices(source_p) && strpbrk(name, "*?#")) { sendto_one(source_p, ":%s NOTICE %s :You must be an admin to perform a " "wildcard RESV", me.name, source_p->name); return; } if((conf = create_nick_resv(name, reason, 0)) == NULL) { if(!services) sendto_one(source_p, ":%s NOTICE %s :A RESV has already been placed on nick %s", me.name, source_p->name, name); return; } resv_p = map_to_conf(conf); if(tkline_time != 0) { if(!services) { sendto_one(source_p, ":%s NOTICE %s :A %d minute %s RESV has been placed on nick %s : [%s]", me.name, source_p->name, tkline_time / 60, (MyClient(source_p) ? "local" : "remote"), conf->name, resv_p->reason); sendto_realops_flags(UMODE_ALL, L_ALL, "%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, resv_p->reason); } ilog(L_TRACE, "%s added temporary %d min. RESV for [%s] [%s]", source_p->name, (int) tkline_time / 60, conf->name, resv_p->reason); resv_p->hold = CurrentTime + tkline_time; add_temp_line(conf); } else { if(!services) { sendto_one(source_p, ":%s NOTICE %s :A %s RESV has been placed on nick %s : [%s]", me.name, source_p->name, (MyClient(source_p) ? "local" : "remote"), conf->name, resv_p->reason); sendto_realops_flags(UMODE_ALL, L_ALL, "%s has placed a %s RESV on nick %s : [%s]", get_oper_name(source_p), (MyClient(source_p) ? "local" : "remote"), conf->name, resv_p->reason); } write_conf_line(source_p, conf, NULL /* not used */ , 0 /* not used */ ); } } }
/* parse_resv() * * inputs - source_p, NULL supported * - thing to resv * - reason * outputs - none * side effects - parse resv, create if valid */ static void parse_resv (struct Client *source_p, char *name, char *reason, int cluster) { struct ConfItem *conf; if (IsChanPrefix (*name)) { struct ResvChannel *resv_p; if ((conf = create_channel_resv (name, reason, 0)) == NULL) { if (!cluster) sendto_one (source_p, ":%s NOTICE %s :A RESV has already been placed on channel: %s", me.name, source_p->name, name); return; } resv_p = (struct ResvChannel *) map_to_conf (conf); if (!cluster) sendto_one (source_p, ":%s NOTICE %s :A %s RESV has been placed on channel: %s", me.name, source_p->name, (MyClient (source_p) ? "local" : "remote"), name); sendto_realops_flags (UMODE_ALL, L_ALL, "%s has placed a %s RESV on channel: %s [%s]", get_oper_name (source_p), (MyClient (source_p) ? "local" : "remote"), resv_p->name, resv_p->reason); write_conf_line (source_p, conf, NULL /* not used */ , 0 /* not used */ ); } else if (clean_resv_nick (name)) { struct MatchItem *resv_p; if ((strchr (name, '*') || strchr (name, '?')) && !IsAdmin (source_p)) { if (!cluster) sendto_one (source_p, ":%s NOTICE %s :You must be an admin to perform a wildcard RESV", me.name, source_p->name); return; } if ((conf = create_nick_resv (name, reason, 0)) == NULL) { if (!cluster) sendto_one (source_p, ":%s NOTICE %s :A RESV has already been placed on nick: %s", me.name, source_p->name, name); return; } resv_p = (struct MatchItem *) map_to_conf (conf); if (!cluster) sendto_one (source_p, ":%s NOTICE %s :A %s RESV has been placed on nick: %s [%s]", me.name, source_p->name, (MyClient (source_p) ? "local" : "remote"), conf->name, resv_p->reason); sendto_realops_flags (UMODE_ALL, L_ALL, "%s has placed a %s RESV on nick: %s [%s]", get_oper_name (source_p), (MyClient (source_p) ? "local" : "remote"), conf->name, resv_p->reason); write_conf_line (source_p, conf, NULL /* not used */ , 0 /* not used */ ); } else if (!cluster) sendto_one (source_p, ":%s NOTICE %s :You have specified an invalid resv: [%s]", me.name, source_p->name, name); }