X-Git-Url: https://jfr.im/git/solanum.git/blobdiff_plain/3c7d6fcce7a021ea7c4948a37a32aeca072e5b10..4d12e65469c877f8028d5ac40a39457ec96b2f40:/modules/m_trace.c diff --git a/modules/m_trace.c b/modules/m_trace.c index fb0fdb92..ae9a0057 100644 --- a/modules/m_trace.c +++ b/modules/m_trace.c @@ -27,7 +27,6 @@ #include "hook.h" #include "client.h" #include "hash.h" -#include "common.h" #include "hash.h" #include "match.h" #include "ircd.h" @@ -53,10 +52,12 @@ struct Message trace_msgtab = { }; int doing_trace_hook; +int doing_trace_show_idle_hook; mapi_clist_av1 trace_clist[] = { &trace_msgtab, NULL }; mapi_hlist_av1 trace_hlist[] = { { "doing_trace", &doing_trace_hook }, + { "doing_trace_show_idle", &doing_trace_show_idle_hook }, { NULL, NULL } }; DECLARE_MODULE_AV2(trace, NULL, NULL, trace_clist, trace_hlist, NULL, NULL, NULL, trace_desc); @@ -126,7 +127,7 @@ m_trace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_ /* giving this out with flattened links defeats the * object --fl */ - if(IsOper(source_p) || IsExemptShide(source_p) || + if(IsOperGeneral(source_p) || IsExemptShide(source_p) || !ConfigServerHide.flatten_links) sendto_one_numeric(source_p, RPL_TRACELINK, form_str(RPL_TRACELINK), @@ -205,6 +206,9 @@ m_trace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_ if(!doall && wilds && (match(tname, target_p->name) == 0)) continue; + if(!SeesOper(target_p, source_p)) + continue; + report_this_status(source_p, target_p); } @@ -234,14 +238,14 @@ m_trace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_ target_p = ptr->data; /* dont show invisible users to remote opers */ - if(IsInvisible(target_p) && dow && !MyConnect(source_p) && !IsOper(target_p)) + if(IsInvisible(target_p) && dow && !MyConnect(source_p) && !SeesOper(target_p, source_p)) continue; if(!doall && wilds && !match(tname, target_p->name)) continue; /* remote opers may not see invisible normal users */ - if(dow && !MyConnect(source_p) && !IsOper(target_p) && + if(dow && !MyConnect(source_p) && !SeesOper(target_p, source_p) && IsInvisible(target_p)) continue; @@ -379,13 +383,22 @@ report_this_status(struct Client *source_p, struct Client *target_p) case STAT_CLIENT: { + /* fire the doing_trace_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_trace_show_idle_hook, &hdata_showidle); + sendto_one_numeric(source_p, - IsOper(target_p) ? RPL_TRACEOPERATOR : RPL_TRACEUSER, - IsOper(target_p) ? form_str(RPL_TRACEOPERATOR) : form_str(RPL_TRACEUSER), + SeesOper(target_p, source_p) ? RPL_TRACEOPERATOR : RPL_TRACEUSER, + SeesOper(target_p, source_p) ? form_str(RPL_TRACEOPERATOR) : form_str(RPL_TRACEUSER), class_name, name, show_ip(source_p, target_p) ? ip : empty_sockhost, - (unsigned long)(rb_current_time() - target_p->localClient->lasttime), - (unsigned long)(rb_current_time() - target_p->localClient->last)); + hdata_showidle.approved ? (unsigned long)(rb_current_time() - target_p->localClient->lasttime) : 0, + hdata_showidle.approved ? (unsigned long)(rb_current_time() - target_p->localClient->last) : 0); cnt++; }