+2002-04-15 Alex Badea <vampire@p16.pub.ro>
+
+ * ircd/m_stats.c: added verbose server reporting (/stats v
+ or /stats V for machine-readable format) (bugzilla bug 52)
+
+ * include/numeric.h: added RPL_STATSVERBOSE 236
+
+ * ircd/s_err.c: added RPL_STATSVERBOSE
+
+ * ircd/s_stats.c: added help for stats 'v'
+
2002-04-15 Alex Badea <vampire@p16.pub.ro>
* ircd/class.c (get_client_class): fixed typo which caused
#define RPL_SERVLIST 234 /* unused */
#define RPL_SERVLISTEND 235 /* unused */
+#define RPL_STATSVERBOSE 236 /* Undernet verbose server list */
#define RPL_STATSENGINE 237 /* Undernet engine name */
#define RPL_STATSFLINE 238 /* Undernet feature lines */
/* RPL_STATSIAUTH 239 IRCnet extension */
return 1;
}
+static int report_servers_verbose(struct Client *sptr, char stat)
+{
+ struct Client *acptr;
+ int i;
+
+ /* lowercase 'v' is for human-readable,
+ * uppercase 'V' is for machine-readable */
+ if (stat == 'v')
+ send_reply(sptr, SND_EXPLICIT | RPL_STATSVERBOSE,
+ "%-20s Burst Hops Numeric Lag Clients/Max Proto "
+ "%-10s :Info", "Servername", "LinkTS");
+ for (i = 0; i <= HighestFd; i++) {
+ if (!(acptr = LocalClientArray[i]) || !IsServer(acptr))
+ continue;
+ send_reply(sptr, SND_EXPLICIT | RPL_STATSVERBOSE, stat == 'v' ?
+ "%-20s %c%c %4i %s %-4i %5i %5i %5i P%-2i %Tu :%s" :
+ "%s %c%c %i %s %i %i %i %i P%i %Tu :%s",
+ cli_name(acptr),
+ IsBurst(acptr) ? 'B' : '-',
+ IsBurstAck(acptr) ? 'A' : '-',
+ cli_hopcount(acptr),
+ NumServ(acptr),
+ base64toint(cli_yxx(acptr)),
+ cli_serv(acptr)->lag,
+ cli_serv(acptr)->clients,
+ cli_serv(acptr)->nn_mask,
+ cli_serv(acptr)->prot,
+ cli_serv(acptr)->timestamp,
+ cli_info(acptr));
+ }
+ return 0;
+}
+
/*
* m_stats - generic message handler
send_reply(sptr, RPL_STATSCONN, max_connection_count, max_client_count);
break;
}
+ case 'V':
+ case 'v':
+ report_servers_verbose(sptr, stat);
+ break;
case 'W':
case 'w':
calc_load(sptr);
send_reply(sptr, RPL_STATSCONN, max_connection_count, max_client_count);
break;
}
+ case 'V':
+ case 'v':
+ report_servers_verbose(sptr, stat);
+ break;
case 'W':
case 'w':
calc_load(sptr);
case 'z':
count_memory(sptr, parv[0]);
break;
+
default:
stat = '*';
while (*infotext)
/* 235 */
{ RPL_SERVLISTEND, 0, "235" },
/* 236 */
- { 0 },
+ { RPL_STATSVERBOSE, "V :Sent as explicit", "236" },
/* 237 */
{ RPL_STATSENGINE, "%s :Event loop engine", "237" },
/* 238 */
"f - Feature settings.",
"m - Message usage information.",
"t - Local connection statistics (Total SND/RCV, etc).",
+ "v - Server list with verbose information.",
"w - Userload statistics.",
"M - Memory allocation & leak monitoring.",
"z - Memory/Structure allocation information.",