]> jfr.im git - solanum.git/commitdiff
helpops: handle cleaning up remote opers from the helpops list
authorWilliam Pitcock <redacted>
Fri, 16 Sep 2016 17:56:18 +0000 (12:56 -0500)
committerWilliam Pitcock <redacted>
Fri, 16 Sep 2016 17:56:18 +0000 (12:56 -0500)
extensions/helpops.c

index c2a7e00cf96bfba4bd3db63b18c02052ce0afc16..183229fadb02a08a73de2fe1df386831de30a597 100644 (file)
@@ -161,8 +161,23 @@ h_hdl_new_remote_user(struct Client *client_p)
 static void
 h_hdl_client_exit(hook_data_client_exit *hdata)
 {
-       if (hdata->target->umodes & UMODE_HELPOPS)
-               rb_dlinkFindDestroy(hdata->target, &helper_list);
+       if (MyClient(hdata->target) && IsPerson(hdata->target))
+       {
+               if (hdata->target->umodes & UMODE_HELPOPS)
+                       rb_dlinkFindDestroy(hdata->target, &helper_list);
+       }
+       else if (IsServer(hdata->target))
+       {
+               rb_dlink_node *nptr;
+
+               RB_DLINK_FOREACH(nptr, hdata->target->serv->users.head)
+               {
+                       struct Client *client_p = nptr->data;
+
+                       if (client_p->umodes & UMODE_HELPOPS)
+                               rb_dlinkFindDestroy(client_p, &helper_list);
+               }
+       }
 }
 
 static void