DECLARE_MODULE_AV1(trace, NULL, NULL, trace_clist, trace_hlist, NULL, "$Revision: 3183 $");
static void count_downlinks(struct Client *server_p, int *pservcount, int *pusercount);
-static int report_this_status(struct Client *source_p, struct Client *target_p, int dow);
+static int report_this_status(struct Client *source_p, struct Client *target_p);
+
+static const char *empty_sockhost = "255.255.255.255";
/*
* m_trace
- * parv[0] = sender prefix
* parv[1] = servername
*/
static int
if(ac2ptr == NULL)
{
- RB_DLINK_FOREACH(ptr, global_client_list.head)
+ RB_DLINK_FOREACH(ptr, global_serv_list.head)
{
ac2ptr = ptr->data;
*/
if(target_p != NULL)
{
- report_this_status(source_p, target_p, 0);
+ report_this_status(source_p, target_p);
tname = target_p->name;
}
if(MyClient(source_p))
{
if(doall || (wilds && match(tname, source_p->name)))
- report_this_status(source_p, source_p, 0);
+ report_this_status(source_p, source_p);
}
RB_DLINK_FOREACH(ptr, local_oper_list.head)
if(!doall && wilds && (match(tname, target_p->name) == 0))
continue;
- report_this_status(source_p, target_p, 0);
+ report_this_status(source_p, target_p);
}
if (IsExemptShide(source_p) || !ConfigServerHide.flatten_links)
if(!doall && wilds && !match(tname, target_p->name))
continue;
- report_this_status(source_p, target_p, 0);
+ report_this_status(source_p, target_p);
}
}
IsInvisible(target_p))
continue;
- cnt = report_this_status(source_p, target_p, dow);
+ cnt = report_this_status(source_p, target_p);
}
RB_DLINK_FOREACH(ptr, serv_list.head)
if(!doall && wilds && !match(tname, target_p->name))
continue;
- cnt = report_this_status(source_p, target_p, dow);
+ cnt = report_this_status(source_p, target_p);
}
if(MyConnect(source_p))
if(!doall && wilds && !match(tname, target_p->name))
continue;
- cnt = report_this_status(source_p, target_p, dow);
+ cnt = report_this_status(source_p, target_p);
}
}
* side effects - NONE
*/
static int
-report_this_status(struct Client *source_p, struct Client *target_p, int dow)
+report_this_status(struct Client *source_p, struct Client *target_p)
{
const char *name;
const char *class_name;
break;
case STAT_CLIENT:
- /* Only opers see users if there is a wildcard
- * but anyone can see all the opers.
- */
- if((IsOper(source_p) &&
- (MyClient(source_p) || !(dow && IsInvisible(target_p))))
- || !dow || IsOper(target_p) || (source_p == target_p))
- {
- int tnumeric = RPL_TRACEUSER;
- if(IsOper(target_p))
- tnumeric = RPL_TRACEOPERATOR;
-
- sendto_one_numeric(source_p, tnumeric, form_str(tnumeric),
- class_name, name,
- show_ip(source_p, target_p) ? ip : empty_sockhost,
- rb_current_time() - target_p->localClient->lasttime,
- rb_current_time() - target_p->localClient->last);
- cnt++;
- }
- break;
+ {
+ sendto_one_numeric(source_p,
+ IsOper(target_p) ? RPL_TRACEOPERATOR : RPL_TRACEUSER,
+ IsOper(target_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));
+ cnt++;
+ }
+ break;
case STAT_SERVER:
{
sendto_one_numeric(source_p, RPL_TRACESERVER, form_str(RPL_TRACESERVER),
class_name, servcount, usercount, name,
*(target_p->serv->by) ? target_p->serv->by : "*", "*",
- me.name, rb_current_time() - target_p->localClient->lasttime);
+ me.name,
+ (unsigned long)(rb_current_time() - target_p->localClient->lasttime));
cnt++;
}
default: /* ...we actually shouldn't come here... --msa */
sendto_one_numeric(source_p, RPL_TRACENEWTYPE,
- form_str(RPL_TRACENEWTYPE),
- me.name, source_p->name, name);
+ form_str(RPL_TRACENEWTYPE), name);
cnt++;
break;
}