2 * Copyright (C) 2021 David Schultz <me@zpld.me>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
29 #include "s_newconf.h"
31 static const char hide_desc
[] = "Provides user mode +I to hide a user's idle time";
33 static void h_huc_doing_idle_time_hook(void *);
35 mapi_hfn_list_av1 huc_hfnlist
[] = {
36 { "doing_whois_show_idle", h_huc_doing_idle_time_hook
},
37 { "doing_trace_show_idle", h_huc_doing_idle_time_hook
},
38 { "doing_stats_show_idle", h_huc_doing_idle_time_hook
},
39 { "doing_who_show_idle", h_huc_doing_idle_time_hook
},
44 h_huc_doing_idle_time_hook(void *data_
)
46 hook_data_client_approval
*data
= data_
;
48 if (data
->approved
== 0)
51 if ((data
->client
->umodes
| data
->target
->umodes
) & user_modes
['I'])
53 if (HasPrivilege(data
->client
, "auspex:usertimes"))
54 data
->approved
= WHOIS_IDLE_AUSPEX
;
55 else if (data
->client
!= data
->target
)
56 data
->approved
= WHOIS_IDLE_HIDE
;
63 user_modes
['I'] = find_umode_slot();
67 ierror("umode_hide_idle_time: unable to allocate usermode slot for +I, unloading extension");
80 DECLARE_MODULE_AV2(hide_idle_time
, _modinit
, _moddeinit
, NULL
, NULL
, huc_hfnlist
, NULL
, NULL
, hide_desc
);