]> jfr.im git - solanum.git/commitdiff
extensions/umode_hide_idle_time: mask times for hidden sources (#373)
authorAaron Jones <redacted>
Fri, 21 Oct 2022 08:01:41 +0000 (08:01 +0000)
committerGitHub <redacted>
Fri, 21 Oct 2022 08:01:41 +0000 (08:01 +0000)
If the user performing a WHOIS has hidden their idle time (is umode +I),
also prevent them from seeing other user's idle times, even if said users
are not themselves umode +I.

Suggested-by: @Unit193
extensions/umode_hide_idle_time.c
help/opers/umode
help/users/umode
modules/m_whois.c

index 13077638f049486135a993d69f5a4d1fd34ec410..8e61efff20589520c122b0882d7aff259f06e46d 100644 (file)
@@ -48,7 +48,7 @@ h_huc_doing_idle_time_hook(void *data_)
        if (data->approved == 0)
                return;
 
-       if (data->target->umodes & user_modes['I'])
+       if ((data->client->umodes | data->target->umodes) & user_modes['I'])
        {
                if (HasPrivilege(data->client, "auspex:usertimes"))
                        data->approved = WHOIS_IDLE_AUSPEX;
index c9e09e04cfd896a9ed5d042f1264ba3ed920a04d..5a2a6d02e3095689a3e45caa9cf41a37eae4e3f2 100644 (file)
@@ -24,6 +24,9 @@ User modes: (* designates that the umode is oper only)
          +G     - Deny users not on your /ACCEPT list and not in a channel
                   with you from messaging you and inviting you to channels.
                   This is a softer form of +g.
+       ? +I     - Hides your WHOIS idle time and prevents you seeing the idle
+                  time of other users (unless you have the auspex:usertimes
+                  privilege).
          +Q     - Prevents you from being affected by channel forwarding.
          +R     - Prevents unidentified users that you have not accepted from
                   messaging you.
index 942568126496ee5bb42f4a825ca54c649ec8e139..3eceab452edb168a2ff8a5fe4cd869fbb3807078 100644 (file)
@@ -19,7 +19,8 @@ User modes: (? designates that the umode is provided by an extension
          +G     - Deny users not on your /ACCEPT list and not in a channel
                   with you from messaging you and inviting you to channels.
                   This is a softer form of +g.
-       ? +I     - Hides your idle time.
+       ? +I     - Hides your WHOIS idle time and prevents you seeing the idle
+                  time of other users.
          +Q     - Prevents you from being affected by channel forwarding.
          +R     - Prevents unidentified users that you have not accepted from
                   messaging you.
index 68bb17c9bdf5ef7f7fc09646196cc97a9537b9e4..7ed5764343db1b2e7778ec6a5ed8caac6a60d64d 100644 (file)
 #include "ircd.h"
 #include "numeric.h"
 #include "s_conf.h"
+#include "s_user.h"
 #include "s_serv.h"
 #include "send.h"
 #include "match.h"
-#include "s_conf.h"
 #include "logger.h"
 #include "msg.h"
 #include "parse.h"
@@ -389,9 +389,12 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy)
                           hdata_showidle.approved ? (long)(rb_current_time() - target_p->localClient->last) : 0,
                           (unsigned long)target_p->localClient->firsttime);
 
-               if (hdata_showidle.approved == WHOIS_IDLE_AUSPEX || hdata_showidle.approved == WHOIS_IDLE_HIDE)
+               if (hdata_showidle.approved == WHOIS_IDLE_HIDE && (source_p->umodes & user_modes['I']))
+                       /* if the source has hidden their idle time, notify the source that they can't view others' idle times either */
+                       sendto_one_numeric(source_p, RPL_WHOISTEXT, form_str(RPL_WHOISTEXT), target_p->name, "has a hidden idle time because your own idle time is hidden");
+               else if (hdata_showidle.approved != WHOIS_IDLE_SHOW)
                        /* if the target has hidden their idle time, notify the source */
-                       sendto_one_numeric(source_p, RPL_WHOISTEXT, form_str(RPL_WHOISTEXT), target_p->name, "is using a private idle time");
+                       sendto_one_numeric(source_p, RPL_WHOISTEXT, form_str(RPL_WHOISTEXT), target_p->name, "is hiding their idle time");
        }
        else
        {