]> jfr.im git - solanum.git/blobdiff - modules/m_who.c
Add ACCOUNTEXTBAN ISUPPORT token
[solanum.git] / modules / m_who.c
index e9760943c1a255d9314b7b2cef13136e22ca3b46..d47d44bb43e2dbe639dd2a181ce21443a2b9e162 100644 (file)
@@ -91,8 +91,14 @@ _moddeinit(void)
        delete_isupport("WHOX");
 }
 
+int doing_who_show_idle_hook;
+
 mapi_clist_av1 who_clist[] = { &who_msgtab, NULL };
-DECLARE_MODULE_AV2(who, _modinit, _moddeinit, who_clist, NULL, NULL, NULL, NULL, who_desc);
+mapi_hlist_av1 who_hlist[] = {
+       { "doing_who_show_idle", &doing_who_show_idle_hook },
+       { NULL, NULL }
+};
+DECLARE_MODULE_AV2(who, _modinit, _moddeinit, who_clist, who_hlist, NULL, NULL, NULL, who_desc);
 
 /*
 ** m_who
@@ -367,8 +373,12 @@ who_global(struct Client *source_p, const char *mask, int server_oper, int opers
                        who_common_channel(source_p, msptr->chptr, mask, server_oper, &maxmatches, fmt);
                }
        }
-       else if (!ConfigFileEntry.operspy_dont_care_user_info)
-               report_operspy(source_p, "WHO", mask);
+       else
+       {
+               maxmatches = INT_MAX;
+               if (!ConfigFileEntry.operspy_dont_care_user_info)
+                       report_operspy(source_p, "WHO", mask);
+       }
 
        /* second, list all matching visible clients and clear all marks
         * on invisible clients
@@ -527,7 +537,19 @@ do_who(struct Client *source_p, struct Client *target_p, struct membership *mspt
                if (fmt->fields & FIELD_HOP)
                        append_format(str, sizeof str, &pos, " %d", ConfigServerHide.flatten_links && !IsOperGeneral(source_p) && !IsExemptShide(source_p) ? 0 : target_p->hopcount);
                if (fmt->fields & FIELD_IDLE)
-                       append_format(str, sizeof str, &pos, " %d", (int)(MyClient(target_p) ? rb_current_time() - target_p->localClient->last : 0));
+               {
+                       /* fire the doing_who_show_idle hook to allow modules to tell us whether to show the idle time */
+                       hook_data_client_approval hdata_showidle;
+
+                       hdata_showidle.client = source_p;
+                       hdata_showidle.target = target_p;
+                       hdata_showidle.approved = WHOIS_IDLE_SHOW;
+
+                       call_hook(doing_who_show_idle_hook, &hdata_showidle);
+
+                       append_format(str, sizeof str, &pos, " %d",
+                               hdata_showidle.approved ? (int)(MyClient(target_p) ? rb_current_time() - target_p->localClient->last : 0) : 0);
+               }
                if (fmt->fields & FIELD_ACCOUNT)
                {
                        /* display as in whois */