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:
Ed Kellett 2019-08-03 05:17:35 +01:00
parent 6c639159b0
commit 0c5dd86cfc
No known key found for this signature in database
GPG key ID: CB9986DEF342FABC

View file

@ -108,17 +108,31 @@ do_dehelper(struct Client *source_p, struct Client *target_p)
static int static int
_modinit(void) _modinit(void)
{ {
rb_dlink_node *ptr;
user_modes[UMODECHAR_HELPOPS] = find_umode_slot(); user_modes[UMODECHAR_HELPOPS] = find_umode_slot();
construct_umodebuf(); 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; return 0;
} }
static void static void
_moddeinit(void) _moddeinit(void)
{ {
rb_dlink_node *n, *tn;
user_modes[UMODECHAR_HELPOPS] = 0; user_modes[UMODECHAR_HELPOPS] = 0;
construct_umodebuf(); construct_umodebuf();
RB_DLINK_FOREACH_SAFE(n, tn, helper_list.head)
rb_dlinkDestroy(n, &helper_list);
} }
static void static void