diff options
author | michael <michael@82007160-df01-0410-b94d-b575c5fd34c7> | 2012-11-04 15:37:10 +0000 |
---|---|---|
committer | michael <michael@82007160-df01-0410-b94d-b575c5fd34c7> | 2012-11-04 15:37:10 +0000 |
commit | 90aeacbf12d63dcd628caed461bd744639603d76 (patch) | |
tree | 5eb5c2aa3fd576ac33d84d2911482a3f200c1bea /modules/m_resv.c | |
parent | 8daa0e2a6fe61e95dc2dd145ebbdb2b05c097196 (diff) |
- Initial rewrite of the configuration subsystem
git-svn-id: svn://svn.ircd-hybrid.org/svnroot/ircd-hybrid/trunk@1632 82007160-df01-0410-b94d-b575c5fd34c7
Diffstat (limited to 'modules/m_resv.c')
-rw-r--r-- | modules/m_resv.c | 60 |
1 files changed, 25 insertions, 35 deletions
diff --git a/modules/m_resv.c b/modules/m_resv.c index ba0e540..2fcbf88 100644 --- a/modules/m_resv.c +++ b/modules/m_resv.c @@ -140,7 +140,7 @@ ms_resv(struct Client *client_p, struct Client *source_p, if (!IsClient(source_p) || !match(parv[1], me.name)) return; - if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(ULINE_TYPE, source_p->servptr->name, + if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(CONF_ULINE, source_p->servptr->name, source_p->username, source_p->host, SHARED_RESV)) parse_resv(source_p, parv[2], 0, parv[3]); @@ -199,7 +199,7 @@ ms_unresv(struct Client *client_p, struct Client *source_p, if (!IsClient(source_p) || !match(parv[1], me.name)) return; - if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(ULINE_TYPE, source_p->servptr->name, + if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(CONF_ULINE, source_p->servptr->name, source_p->username, source_p->host, SHARED_UNRESV)) remove_resv(source_p, parv[2]); @@ -217,11 +217,9 @@ ms_unresv(struct Client *client_p, struct Client *source_p, static void parse_resv(struct Client *source_p, char *name, int tkline_time, char *reason) { - struct ConfItem *conf = NULL; - if (IsChanPrefix(*name)) { - struct ResvChannel *resv_p; + struct MaskItem *conf = NULL; if ((conf = create_channel_resv(name, reason, 0)) == NULL) { @@ -231,9 +229,8 @@ parse_resv(struct Client *source_p, char *name, int tkline_time, char *reason) return; } - resv_p = map_to_conf(conf); - resv_p->setat = CurrentTime; - SetConfDatabase(resv_p); + conf->setat = CurrentTime; + SetConfDatabase(conf); if (tkline_time != 0) { @@ -247,11 +244,11 @@ parse_resv(struct Client *source_p, char *name, int tkline_time, char *reason) get_oper_name(source_p), tkline_time/60, (MyClient(source_p) ? "local" : "remote"), - resv_p->name, resv_p->reason); + conf->name, conf->reason); ilog(LOG_TYPE_IRCD, "%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; + conf->name, conf->reason); + conf->hold = CurrentTime + tkline_time; } else { @@ -263,12 +260,12 @@ parse_resv(struct Client *source_p, char *name, int tkline_time, char *reason) "%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); + conf->name, conf->reason); } } else { - struct MatchItem *resv_p = NULL; + struct MaskItem *conf = NULL; if (!valid_wild_card_simple(name)) { @@ -292,9 +289,8 @@ parse_resv(struct Client *source_p, char *name, int tkline_time, char *reason) return; } - resv_p = map_to_conf(conf); - resv_p->setat = CurrentTime; - SetConfDatabase(resv_p); + conf->setat = CurrentTime; + SetConfDatabase(conf); if (tkline_time != 0) { @@ -303,17 +299,17 @@ parse_resv(struct Client *source_p, char *name, int tkline_time, char *reason) me.name, source_p->name, tkline_time/60, (MyClient(source_p) ? "local" : "remote"), - conf->name, resv_p->reason); + 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, resv_p->reason); + conf->name, conf->reason); ilog(LOG_TYPE_IRCD, "%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; + conf->name, conf->reason); + conf->hold = CurrentTime + tkline_time; } else { @@ -321,12 +317,12 @@ parse_resv(struct Client *source_p, char *name, int tkline_time, char *reason) ":%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); + 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, resv_p->reason); + conf->name, conf->reason); } } } @@ -334,14 +330,12 @@ parse_resv(struct Client *source_p, char *name, int tkline_time, char *reason) static void remove_resv(struct Client *source_p, const char *name) { - struct ConfItem *conf = NULL; + struct MaskItem *conf = NULL; if (IsChanPrefix(*name)) { - struct ResvChannel *resv_p; - if (resv_channel_list.head == NULL || - !(resv_p = hash_find_resv(name))) + !(conf = hash_find_resv(name))) { sendto_one(source_p, ":%s NOTICE %s :A RESV does not exist for channel: %s", @@ -349,7 +343,7 @@ remove_resv(struct Client *source_p, const char *name) return; } - if (!IsConfDatabase(resv_p)) + if (!IsConfDatabase(conf)) { sendto_one(source_p, ":%s NOTICE %s :The RESV for channel: %s is in ircd.conf and must be removed by hand.", @@ -357,7 +351,7 @@ remove_resv(struct Client *source_p, const char *name) return; } - delete_channel_resv(resv_p); + delete_channel_resv(conf); sendto_one(source_p, ":%s NOTICE %s :The RESV has been removed on channel: %s", me.name, source_p->name, name); @@ -367,18 +361,14 @@ remove_resv(struct Client *source_p, const char *name) } else { - struct MatchItem *resv_p = NULL; - - if ((conf = find_exact_name_conf(NRESV_TYPE, NULL, name, NULL, NULL)) == NULL) + if ((conf = find_exact_name_conf(CONF_NRESV, NULL, name, NULL, NULL)) == NULL) { sendto_one(source_p, ":%s NOTICE %s :A RESV does not exist for nick: %s", me.name, source_p->name, name); return; } - resv_p = map_to_conf(conf); - - if (!IsConfDatabase(resv_p)) + if (!IsConfDatabase(conf)) { sendto_one(source_p, ":%s NOTICE %s :The RESV for nick: %s is in ircd.conf and must be removed by hand.", @@ -386,7 +376,7 @@ remove_resv(struct Client *source_p, const char *name) return; } - delete_conf_item(conf); + conf_free(conf); sendto_one(source_p, ":%s NOTICE %s :The RESV has been removed on nick: %s", me.name, source_p->name, name); sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |