helpops: handle the helper list properly on reload
Free the whole list on unload rather than leaking it, and initialise it to the list of people with +H on load.
This commit is contained in:
parent
6c639159b0
commit
0c5dd86cfc
1 changed files with 14 additions and 0 deletions
|
@ -108,17 +108,31 @@ do_dehelper(struct Client *source_p, struct Client *target_p)
|
|||
static int
|
||||
_modinit(void)
|
||||
{
|
||||
rb_dlink_node *ptr;
|
||||
|
||||
user_modes[UMODECHAR_HELPOPS] = find_umode_slot();
|
||||
construct_umodebuf();
|
||||
|
||||
RB_DLINK_FOREACH (ptr, global_client_list.head)
|
||||
{
|
||||
struct Client *client_p = ptr->data;
|
||||
if (IsPerson(client_p) && (client_p->umodes & user_modes[UMODECHAR_HELPOPS]))
|
||||
helper_add(client_p);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
_moddeinit(void)
|
||||
{
|
||||
rb_dlink_node *n, *tn;
|
||||
|
||||
user_modes[UMODECHAR_HELPOPS] = 0;
|
||||
construct_umodebuf();
|
||||
|
||||
RB_DLINK_FOREACH_SAFE(n, tn, helper_list.head)
|
||||
rb_dlinkDestroy(n, &helper_list);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in a new issue