helpops: remove +H if usermode:helpops is lost

This commit is contained in:
Ed Kellett 2019-08-03 06:41:09 +01:00
parent 0c5dd86cfc
commit 5339043003
No known key found for this signature in database
GPG key ID: CB9986DEF342FABC

View file

@ -220,8 +220,7 @@ h_hdl_umode_changed(hook_data_umode_changed *hdata)
struct Client *source_p = hdata->client; struct Client *source_p = hdata->client;
/* didn't change +H umode, we don't need to do anything */ /* didn't change +H umode, we don't need to do anything */
if (!((hdata->oldumodes ^ source_p->umodes) & user_modes[UMODECHAR_HELPOPS])) bool changed = (hdata->oldumodes ^ source_p->umodes) & user_modes[UMODECHAR_HELPOPS];
return;
if (source_p->umodes & user_modes[UMODECHAR_HELPOPS]) if (source_p->umodes & user_modes[UMODECHAR_HELPOPS])
{ {
@ -229,14 +228,20 @@ h_hdl_umode_changed(hook_data_umode_changed *hdata)
{ {
source_p->umodes &= ~user_modes[UMODECHAR_HELPOPS]; source_p->umodes &= ~user_modes[UMODECHAR_HELPOPS];
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "usermode:helpops"); sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "usermode:helpops");
/* they didn't ask for +H so we must be removing it */
if (!changed)
helper_delete(source_p);
return; return;
} }
if (changed)
helper_add(source_p); helper_add(source_p);
} }
else if (!(source_p->umodes & user_modes[UMODECHAR_HELPOPS])) else if (changed)
{
helper_delete(source_p); helper_delete(source_p);
} }
}
static void static void
h_hdl_whois(hook_data_client *hdata) h_hdl_whois(hook_data_client *hdata)