mapi_hfn_list_av1 override_hfnlist[] = {
{ "umode_changed", (hookfn) check_umode_change },
- { "get_channel_access", (hookfn) hack_channel_access },
- { "can_join", (hookfn) hack_can_join },
- { "can_kick", (hookfn) hack_can_kick },
- { "can_send", (hookfn) hack_can_send },
+ { "get_channel_access", (hookfn) hack_channel_access, HOOK_HIGHEST },
+ { "can_join", (hookfn) hack_can_join, HOOK_HIGHEST },
+ { "can_kick", (hookfn) hack_can_kick, HOOK_HIGHEST },
+ { "can_send", (hookfn) hack_can_send, HOOK_HIGHEST },
{ "client_exit", (hookfn) handle_client_exit },
{ NULL, NULL }
};
check_umode_change(void *vdata)
{
hook_data_umode_changed *data = (hook_data_umode_changed *)vdata;
+ bool changed = false;
struct Client *source_p = data->client;
if (!MyClient(source_p))
if (data->oldumodes & UMODE_OPER && !IsOper(source_p))
source_p->umodes &= ~user_modes['p'];
- /* didn't change +p umode, we don't need to do anything */
- if (!((data->oldumodes ^ source_p->umodes) & user_modes['p']))
- return;
+ changed = ((data->oldumodes ^ source_p->umodes) & user_modes['p']);
if (source_p->umodes & user_modes['p'])
{
return;
}
- update_session_deadline(source_p, NULL);
-
- sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "%s has enabled oper-override (+p)",
- get_oper_name(source_p));
+ if (changed)
+ {
+ update_session_deadline(source_p, NULL);
+ }
}
- else if (!(source_p->umodes & user_modes['p']))
+ else if (changed && !(source_p->umodes & user_modes['p']))
{
rb_dlink_node *n, *tn;
if (session_p->client != source_p)
continue;
- sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "%s has disabled oper-override (+p)",
- get_oper_name(session_p->client));
-
rb_dlinkDelete(n, &overriding_opers);
rb_free(session_p);
}
hook_data_channel_approval *data = (hook_data_channel_approval *) vdata;
int alevel;
- if (data->target->umodes & user_modes['p'])
- {
- if (data->client->umodes & user_modes['p'])
- {
- /* Using oper-override to kick an oper
- * who's also using oper-override, better
- * report what happened.
- */
- update_session_deadline(data->client, NULL);
- sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "%s is using oper-override on %s (KICK %s)",
- get_oper_name(data->client), data->chptr->chname, data->target->name);
- }
- else
- {
- /* Like cmode +M, let's report any attempt
- * to kick the immune oper.
- */
- update_session_deadline(data->target, NULL);
- sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "%s attempted to kick %s from %s (who is +p)",
- data->client->name, data->target->name, data->chptr->chname);
- sendto_one_numeric(data->client, ERR_ISCHANSERVICE, "%s %s :Cannot kick immune IRC operators.",
- data->target->name, data->chptr->chname);
- data->approved = 0;
- }
- return;
- }
-
alevel = get_channel_access(data->client, data->chptr, data->msptr, data->dir, NULL);
if (alevel != CHFL_OVERRIDE)
return;