]> jfr.im git - solanum.git/commitdiff
helpops: fix up graph cleanup for helpers_list
authorWilliam Pitcock <redacted>
Fri, 16 Sep 2016 22:02:50 +0000 (17:02 -0500)
committerWilliam Pitcock <redacted>
Fri, 16 Sep 2016 22:02:50 +0000 (17:02 -0500)
extensions/helpops.c

index 465e363d05d14cd6c94cf08546ccb87f9a3544e7..d1de9498d1d1755af8bec7e25d53476fcaa21d45 100644 (file)
@@ -22,6 +22,7 @@ static void h_hdl_new_remote_user(struct Client *client_p);
 static void h_hdl_client_exit(hook_data_client_exit *hdata);
 static void h_hdl_umode_changed(hook_data_umode_changed *hdata);
 static void h_hdl_whois(hook_data_client *hdata);
 static void h_hdl_client_exit(hook_data_client_exit *hdata);
 static void h_hdl_umode_changed(hook_data_umode_changed *hdata);
 static void h_hdl_whois(hook_data_client *hdata);
+static void recurse_client_exit(struct Client *client_p);
 static void mo_dehelper(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
 static void me_dehelper(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
 static void do_dehelper(struct Client *source_p, struct Client *target_p);
 static void mo_dehelper(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
 static void me_dehelper(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
 static void do_dehelper(struct Client *source_p, struct Client *target_p);
@@ -159,27 +160,31 @@ h_hdl_new_remote_user(struct Client *client_p)
 }
 
 static void
 }
 
 static void
-h_hdl_client_exit(hook_data_client_exit *hdata)
+recurse_client_exit(struct Client *client_p)
 {
 {
-       if (IsPerson(hdata->target))
+       if (IsPerson(client_p))
        {
        {
-               if (hdata->target->umodes & UMODE_HELPOPS)
-                       rb_dlinkFindDestroy(hdata->target, &helper_list);
+               if (client_p->umodes & UMODE_HELPOPS)
+                       rb_dlinkFindDestroy(client_p, &helper_list);
        }
        }
-       else if (IsServer(hdata->target))
+       else if (IsServer(client_p))
        {
                rb_dlink_node *nptr;
 
        {
                rb_dlink_node *nptr;
 
-               RB_DLINK_FOREACH(nptr, hdata->target->serv->users.head)
-               {
-                       struct Client *client_p = nptr->data;
+               RB_DLINK_FOREACH(nptr, client_p->serv->users.head)
+                       recurse_client_exit(nptr->data);
 
 
-                       if (client_p->umodes & UMODE_HELPOPS)
-                               rb_dlinkFindDestroy(client_p, &helper_list);
-               }
+               RB_DLINK_FOREACH(nptr, client_p->serv->servers.head)
+                       recurse_client_exit(nptr->data);
        }
 }
 
        }
 }
 
+static void
+h_hdl_client_exit(hook_data_client_exit *hdata)
+{
+       recurse_client_exit(hdata->target);
+}
+
 static void
 h_hdl_umode_changed(hook_data_umode_changed *hdata)
 {
 static void
 h_hdl_umode_changed(hook_data_umode_changed *hdata)
 {