| 47 |
|
* output - pointer to struct ResvChannel |
| 48 |
|
* side effects - |
| 49 |
|
*/ |
| 50 |
< |
struct ConfItem * |
| 50 |
> |
struct MaskItem * |
| 51 |
|
create_channel_resv(char *name, char *reason, int in_conf) |
| 52 |
|
{ |
| 53 |
< |
struct ConfItem *conf = NULL; |
| 54 |
< |
struct ResvChannel *resv_p = NULL; |
| 53 |
> |
struct MaskItem *conf = NULL; |
| 54 |
|
|
| 55 |
|
if (name == NULL || reason == NULL) |
| 56 |
|
return NULL; |
| 61 |
|
if (strlen(reason) > REASONLEN) |
| 62 |
|
reason[REASONLEN] = '\0'; |
| 63 |
|
|
| 64 |
< |
conf = make_conf_item(CRESV_TYPE); |
| 66 |
< |
resv_p = map_to_conf(conf); |
| 64 |
> |
conf = conf_make(CONF_CRESV); |
| 65 |
|
|
| 68 |
– |
strlcpy(resv_p->name, name, sizeof(resv_p->name)); |
| 66 |
|
DupString(conf->name, name); |
| 67 |
< |
DupString(resv_p->reason, reason); |
| 71 |
< |
resv_p->conf = in_conf; |
| 67 |
> |
DupString(conf->reason, reason); |
| 68 |
|
|
| 69 |
< |
dlinkAdd(resv_p, &resv_p->node, &resv_channel_list); |
| 70 |
< |
hash_add_resv(resv_p); |
| 69 |
> |
dlinkAdd(conf, &conf->node, &resv_channel_list); |
| 70 |
> |
hash_add_resv(conf); |
| 71 |
|
|
| 72 |
|
return conf; |
| 73 |
|
} |
| 80 |
|
* output - pointer to struct ResvNick |
| 81 |
|
* side effects - |
| 82 |
|
*/ |
| 83 |
< |
struct ConfItem * |
| 83 |
> |
struct MaskItem * |
| 84 |
|
create_nick_resv(char *name, char *reason, int in_conf) |
| 85 |
|
{ |
| 86 |
< |
struct ConfItem *conf = NULL; |
| 91 |
< |
struct MatchItem *resv_p = NULL; |
| 86 |
> |
struct MaskItem *conf = NULL; |
| 87 |
|
|
| 88 |
|
if (name == NULL || reason == NULL) |
| 89 |
|
return NULL; |
| 90 |
|
|
| 91 |
< |
if (find_matching_name_conf(NRESV_TYPE, name, NULL, NULL, 0)) |
| 91 |
> |
if (find_matching_name_conf(CONF_NRESV, name, NULL, NULL, 0)) |
| 92 |
|
return NULL; |
| 93 |
|
|
| 94 |
|
if (strlen(reason) > REASONLEN) |
| 95 |
|
reason[REASONLEN] = '\0'; |
| 96 |
|
|
| 97 |
< |
conf = make_conf_item(NRESV_TYPE); |
| 103 |
< |
resv_p = map_to_conf(conf); |
| 97 |
> |
conf = conf_make(CONF_NRESV); |
| 98 |
|
|
| 99 |
|
DupString(conf->name, name); |
| 100 |
< |
DupString(resv_p->reason, reason); |
| 107 |
< |
resv_p->action = in_conf; |
| 100 |
> |
DupString(conf->reason, reason); |
| 101 |
|
|
| 102 |
|
return conf; |
| 103 |
|
} |
| 114 |
|
dlink_node *ptr = NULL, *next_ptr = NULL; |
| 115 |
|
|
| 116 |
|
DLINK_FOREACH_SAFE(ptr, next_ptr, resv_channel_list.head) |
| 117 |
< |
delete_channel_resv(ptr->data); |
| 117 |
> |
{ |
| 118 |
> |
struct MaskItem *conf = ptr->data; |
| 119 |
> |
|
| 120 |
> |
if (!IsConfDatabase(conf)) |
| 121 |
> |
delete_channel_resv(conf); |
| 122 |
> |
} |
| 123 |
|
} |
| 124 |
|
|
| 125 |
|
/* delete_channel_resv() |
| 129 |
|
* side effects - given struct ResvChannel * is removed |
| 130 |
|
*/ |
| 131 |
|
int |
| 132 |
< |
delete_channel_resv(struct ResvChannel *resv_p) |
| 132 |
> |
delete_channel_resv(struct MaskItem *conf) |
| 133 |
|
{ |
| 134 |
< |
struct ConfItem *conf = NULL; |
| 135 |
< |
assert(resv_p != NULL); |
| 136 |
< |
|
| 139 |
< |
hash_del_resv(resv_p); |
| 140 |
< |
dlinkDelete(&resv_p->node, &resv_channel_list); |
| 141 |
< |
MyFree(resv_p->reason); |
| 142 |
< |
conf = unmap_conf_item(resv_p); |
| 143 |
< |
delete_conf_item(conf); |
| 134 |
> |
hash_del_resv(conf); |
| 135 |
> |
dlinkDelete(&conf->node, &resv_channel_list); |
| 136 |
> |
conf_free(conf); |
| 137 |
|
|
| 138 |
|
return 1; |
| 139 |
|
} |
| 145 |
|
* side effects - Finds a reserved channel whose name matches 'name', |
| 146 |
|
* if can't find one returns NULL. |
| 147 |
|
*/ |
| 148 |
< |
struct ResvChannel * |
| 148 |
> |
struct MaskItem * |
| 149 |
|
match_find_resv(const char *name) |
| 150 |
|
{ |
| 151 |
|
dlink_node *ptr = NULL; |
| 155 |
|
|
| 156 |
|
DLINK_FOREACH(ptr, resv_channel_list.head) |
| 157 |
|
{ |
| 158 |
< |
struct ResvChannel *chptr = ptr->data; |
| 158 |
> |
struct MaskItem *conf = ptr->data; |
| 159 |
|
|
| 160 |
< |
if (match_chan(name, chptr->name)) |
| 161 |
< |
return chptr; |
| 160 |
> |
if (match_chan(name, conf->name)) |
| 161 |
> |
return conf; |
| 162 |
|
} |
| 163 |
|
|
| 164 |
|
return NULL; |
| 173 |
|
void |
| 174 |
|
report_resv(struct Client *source_p) |
| 175 |
|
{ |
| 176 |
< |
dlink_node *ptr; |
| 177 |
< |
struct ConfItem *conf; |
| 185 |
< |
struct ResvChannel *resv_cp; |
| 186 |
< |
struct MatchItem *resv_np; |
| 176 |
> |
dlink_node *ptr = NULL; |
| 177 |
> |
struct MaskItem *conf = NULL; |
| 178 |
|
|
| 179 |
|
DLINK_FOREACH(ptr, resv_channel_list.head) |
| 180 |
|
{ |
| 181 |
< |
resv_cp = ptr->data; |
| 181 |
> |
conf = ptr->data; |
| 182 |
|
sendto_one(source_p, form_str(RPL_STATSQLINE), |
| 183 |
|
me.name, source_p->name, |
| 184 |
< |
resv_cp->conf ? 'Q' : 'q', |
| 185 |
< |
resv_cp->name, resv_cp->reason); |
| 184 |
> |
conf->hold ? 'q' : 'Q', |
| 185 |
> |
conf->name, conf->reason); |
| 186 |
|
} |
| 187 |
|
|
| 188 |
|
DLINK_FOREACH(ptr, nresv_items.head) |
| 189 |
|
{ |
| 190 |
< |
conf = ptr->data; |
| 200 |
< |
resv_np = map_to_conf(conf); |
| 201 |
< |
|
| 190 |
> |
conf = ptr->data;; |
| 191 |
|
sendto_one(source_p, form_str(RPL_STATSQLINE), |
| 192 |
|
me.name, source_p->name, |
| 193 |
< |
resv_np->action ? 'Q' : 'q', |
| 194 |
< |
conf->name, resv_np->reason); |
| 193 |
> |
conf->hold ? 'q' : 'Q', |
| 194 |
> |
conf->name, conf->reason); |
| 195 |
|
} |
| 196 |
|
} |
| 197 |
|
|