+static void
+hack_can_kick(void *vdata)
+{
+ hook_data_channel_approval *data = (hook_data_channel_approval *) vdata;
+ int alevel;
+
+ alevel = get_channel_access(data->client, data->chptr, data->msptr, data->dir, NULL);
+ if (alevel != CHFL_OVERRIDE)
+ return;
+
+ if (data->client->umodes & user_modes['p'])
+ {
+ 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);
+ }
+}
+
+static void
+hack_can_send(void *vdata)
+{
+ hook_data_channel_approval *data = (hook_data_channel_approval *) vdata;
+
+ if (data->dir == MODE_QUERY)
+ return;
+
+ if (data->approved == CAN_SEND_NONOP || data->approved == CAN_SEND_OPV)
+ return;
+
+ if (data->client->umodes & user_modes['p'])
+ {
+ data->approved = CAN_SEND_NONOP;
+
+ if (MyClient(data->client))
+ {
+ update_session_deadline(data->client, NULL);
+ sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "%s is using oper-override on %s (forcing message)",
+ get_oper_name(data->client), data->chptr->chname);
+ }
+ }
+}
+
+static void
+handle_client_exit(void *vdata)
+{
+ hook_data_client_exit *data = (hook_data_client_exit *) vdata;
+ rb_dlink_node *n, *tn;
+ struct Client *source_p = data->target;
+
+ RB_DLINK_FOREACH_SAFE(n, tn, overriding_opers.head)
+ {
+ struct OverrideSession *session_p = n->data;
+
+ if (session_p->client != source_p)
+ continue;
+
+ rb_dlinkDelete(n, &overriding_opers);
+ rb_free(session_p);
+ }
+}
+