From f835ac55cbc35e011823240e93b91426b060fa7a Mon Sep 17 00:00:00 2001 From: "geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b" Date: Sat, 1 Oct 2005 18:58:56 +0000 Subject: BUILD : 1.7.11 (906) BUGS : NOTES : Added information on the uplink server via /os stats uplink git-svn-id: svn://svn.anope.org/anope/trunk@906 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@652 5417fbe8-f217-4b02-8779-1006273d7864 --- Changes | 1 + Changes.lang | 4 + lang/cat.l | 8 ++ lang/de.l | 8 ++ lang/en_us.l | 23 +++-- lang/es.l | 8 ++ lang/fr.l | 8 ++ lang/gr.l | 8 ++ lang/hun.l | 8 ++ lang/it.l | 8 ++ lang/nl.l | 8 ++ lang/pl.l | 8 ++ lang/pt.l | 8 ++ lang/ru.l | 8 ++ lang/tr.l | 8 ++ src/core/os_stats.c | 276 ++++++++++++++++++++++++++++++++++++++-------------- src/servers.c | 4 +- version.log | 6 +- 18 files changed, 330 insertions(+), 80 deletions(-) diff --git a/Changes b/Changes index f79775951..3333e5b3a 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,7 @@ Anope Version S V N -------------------- Provided by Anope Dev. - 2005 +10/01 A Information on uplink server can be displayed via OperServ STATS. [ #00] 09/29 A Configuration option to change fantasy command prefix character. [ #00] 09/28 A Event for fantasy commands triggered without channel access. [ #00] 10/01 F UserKeys gave an error without message when missing. [ #00] diff --git a/Changes.lang b/Changes.lang index 61a0ca32a..941c0eb54 100644 --- a/Changes.lang +++ b/Changes.lang @@ -1,8 +1,12 @@ Anope Version S V N -------------------- *** New Strings: + OPER_STATS_UPLINK_SERVER + OPER_STATS_UPLINK_CAPAB + OPER_STATS_UPLINK_SERVER_COUNT *** Mod Strings: + OPER_HELP_STATS *** Del Strings: diff --git a/lang/cat.l b/lang/cat.l index 1b5a47eb5..a7b7c73b0 100644 --- a/lang/cat.l +++ b/lang/cat.l @@ -2516,6 +2516,14 @@ OPER_STATS_SZLINE_EXPIRE_NONE OPER_STATS_RESET Estadistiques restablertes. +# MODE responses +OPER_STATS_UPLINK_SERVER + Uplink server: %s +OPER_STATS_UPLINK_CAPAB + Uplink capab: %s +OPER_STATS_UPLINK_SERVER_COUNT + Servers found: %d + # MODE responses OPER_MODE_SYNTAX MODE canal Modes diff --git a/lang/de.l b/lang/de.l index 64339387e..fa3e2b20f 100644 --- a/lang/de.l +++ b/lang/de.l @@ -2485,6 +2485,14 @@ OPER_STATS_SZLINE_EXPIRE_NONE OPER_STATS_RESET Statistiken zurückgesetzt. +# MODE responses +OPER_STATS_UPLINK_SERVER + Uplink server: %s +OPER_STATS_UPLINK_CAPAB + Uplink capab: %s +OPER_STATS_UPLINK_SERVER_COUNT + Servers found: %d + # MODE responses OPER_MODE_SYNTAX MODE Channel Modi diff --git a/lang/en_us.l b/lang/en_us.l index d23f087cc..befab0905 100644 --- a/lang/en_us.l +++ b/lang/en_us.l @@ -2443,6 +2443,12 @@ OPER_STATS_SZLINE_EXPIRE_NONE Default SZLINE expiry time: No expiration OPER_STATS_RESET Statistics reset. +OPER_STATS_UPLINK_SERVER + Uplink server: %s +OPER_STATS_UPLINK_CAPAB + Uplink capab: %s +OPER_STATS_UPLINK_SERVER_COUNT + Servers found: %d # MODE responses OPER_MODE_SYNTAX @@ -5371,7 +5377,7 @@ OPER_HELP_GLOBAL The message will be sent from the nick %s. OPER_HELP_STATS - Syntax: STATS [AKILL | ALL | RESET] + Syntax: STATS [AKILL | ALL | RESET | MEMORY | UPLINK] Without any option, shows the current number of users and IRCops online (excluding Services), the highest number of @@ -5381,14 +5387,19 @@ OPER_HELP_STATS With the AKILL option, displays the current size of the AKILL list and the current default expiry time. - The ALL option is available only to Services admins, and - displays information on Services' memory usage. Using this - option can freeze Services for a short period of time on - large networks, so don't overuse it! - The RESET option currently resets the maximum user count to the number of users currently present on the network. + The MEMORY option displays information on the memory + usage of Services. Using this option can freeze Services for + a short period of time on large networks; don't overuse it! + + The UPLINK option displays information about the current + server Anope uses as an uplink to the network. + + The ALL displays the user and uptime statistics, and + everything you'd see with MEMORY and UPLINK options. + UPTIME may be used as a synonym for STATS. OPER_HELP_OPER diff --git a/lang/es.l b/lang/es.l index 055150a81..31fd7aced 100644 --- a/lang/es.l +++ b/lang/es.l @@ -2489,6 +2489,14 @@ OPER_STATS_SZLINE_EXPIRE_NONE OPER_STATS_RESET Estadisticas reseteadas. +# MODE responses +OPER_STATS_UPLINK_SERVER + Uplink server: %s +OPER_STATS_UPLINK_CAPAB + Uplink capab: %s +OPER_STATS_UPLINK_SERVER_COUNT + Servers found: %d + # MODE responses OPER_MODE_SYNTAX MODE canal modos diff --git a/lang/fr.l b/lang/fr.l index 5a18c2c57..fa077cc16 100644 --- a/lang/fr.l +++ b/lang/fr.l @@ -2529,6 +2529,14 @@ OPER_STATS_SZLINE_EXPIRE_NONE OPER_STATS_RESET Statistiques réinitialisées. +# MODE responses +OPER_STATS_UPLINK_SERVER + Uplink server: %s +OPER_STATS_UPLINK_CAPAB + Uplink capab: %s +OPER_STATS_UPLINK_SERVER_COUNT + Servers found: %d + # MODE responses OPER_MODE_SYNTAX MODE channel modes diff --git a/lang/gr.l b/lang/gr.l index 4e8aec841..6280fca8f 100644 --- a/lang/gr.l +++ b/lang/gr.l @@ -2518,6 +2518,14 @@ OPER_STATS_SZLINE_EXPIRE_NONE OPER_STATS_RESET Ôá óôáôéóôéêÜ óâÞóôçêáí. +# MODE responses +OPER_STATS_UPLINK_SERVER + Uplink server: %s +OPER_STATS_UPLINK_CAPAB + Uplink capab: %s +OPER_STATS_UPLINK_SERVER_COUNT + Servers found: %d + # MODE responses OPER_MODE_SYNTAX MODE channel modes diff --git a/lang/hun.l b/lang/hun.l index 23138d440..5e0d4b7d4 100644 --- a/lang/hun.l +++ b/lang/hun.l @@ -2485,6 +2485,14 @@ OPER_STATS_RESET Statisztika nullázva. # MODE válaszok +OPER_STATS_UPLINK_SERVER + Uplink server: %s +OPER_STATS_UPLINK_CAPAB + Uplink capab: %s +OPER_STATS_UPLINK_SERVER_COUNT + Servers found: %d + +# MODE responses OPER_MODE_SYNTAX MODE szoba mód diff --git a/lang/it.l b/lang/it.l index a95a64678..f920e069b 100644 --- a/lang/it.l +++ b/lang/it.l @@ -2449,6 +2449,14 @@ OPER_STATS_SZLINE_EXPIRE_NONE OPER_STATS_RESET Le statistiche sono state azzerate. +# MODE responses +OPER_STATS_UPLINK_SERVER + Uplink server: %s +OPER_STATS_UPLINK_CAPAB + Uplink capab: %s +OPER_STATS_UPLINK_SERVER_COUNT + Servers found: %d + # MODE responses OPER_MODE_SYNTAX MODE canale modi diff --git a/lang/nl.l b/lang/nl.l index d957bb213..c7d9e741c 100644 --- a/lang/nl.l +++ b/lang/nl.l @@ -2488,6 +2488,14 @@ OPER_STATS_SZLINE_EXPIRE_NONE OPER_STATS_RESET Statistieken opnieuw gezet. +# MODE responses +OPER_STATS_UPLINK_SERVER + Uplink server: %s +OPER_STATS_UPLINK_CAPAB + Uplink capab: %s +OPER_STATS_UPLINK_SERVER_COUNT + Servers found: %d + # MODE responses OPER_MODE_SYNTAX MODE kanaal modes diff --git a/lang/pl.l b/lang/pl.l index 39806d578..bb2aac890 100644 --- a/lang/pl.l +++ b/lang/pl.l @@ -2674,6 +2674,14 @@ OPER_STATS_SZLINE_EXPIRE_NONE OPER_STATS_RESET Statystyki zresetowano. +# MODE responses +OPER_STATS_UPLINK_SERVER + Uplink server: %s +OPER_STATS_UPLINK_CAPAB + Uplink capab: %s +OPER_STATS_UPLINK_SERVER_COUNT + Servers found: %d + # MODE responses OPER_MODE_SYNTAX MODE kana³ mody diff --git a/lang/pt.l b/lang/pt.l index a6d5cb8b0..63bdd2224 100644 --- a/lang/pt.l +++ b/lang/pt.l @@ -2461,6 +2461,14 @@ OPER_STATS_SZLINE_EXPIRE_NONE OPER_STATS_RESET Resetar estatísticas. +# MODE responses +OPER_STATS_UPLINK_SERVER + Uplink server: %s +OPER_STATS_UPLINK_CAPAB + Uplink capab: %s +OPER_STATS_UPLINK_SERVER_COUNT + Servers found: %d + # MODE responses OPER_MODE_SYNTAX MODE canal modos diff --git a/lang/ru.l b/lang/ru.l index 17492890f..5eddbb9b1 100644 --- a/lang/ru.l +++ b/lang/ru.l @@ -2496,6 +2496,14 @@ OPER_STATS_SZLINE_EXPIRE_NONE OPER_STATS_RESET Ñòàòèñòèêà ñáðîøåíà. +# MODE responses +OPER_STATS_UPLINK_SERVER + Uplink server: %s +OPER_STATS_UPLINK_CAPAB + Uplink capab: %s +OPER_STATS_UPLINK_SERVER_COUNT + Servers found: %d + # MODE responses OPER_MODE_SYNTAX MODE #êàíàë ðåæèìû diff --git a/lang/tr.l b/lang/tr.l index 11c7e0dc8..6deca3831 100644 --- a/lang/tr.l +++ b/lang/tr.l @@ -2511,6 +2511,14 @@ OPER_STATS_SZLINE_EXPIRE_NONE OPER_STATS_RESET Ýstatistikler resetlendi. +# MODE responses +OPER_STATS_UPLINK_SERVER + Uplink server: %s +OPER_STATS_UPLINK_CAPAB + Uplink capab: %s +OPER_STATS_UPLINK_SERVER_COUNT + Servers found: %d + # MODE responses OPER_MODE_SYNTAX MODE kanaladý modlar diff --git a/src/core/os_stats.c b/src/core/os_stats.c index f621c56d1..9171287f8 100644 --- a/src/core/os_stats.c +++ b/src/core/os_stats.c @@ -70,6 +70,24 @@ void myOperServHelp(User * u) } } +/** + * Count servers connected to server s + * @param s The server to start counting from + * @return Amount of servers connected to server s + **/ +int stats_count_servers(Server *s) +{ + int count = 1; + + while (s) { + if (s->links) + count += stats_count_servers(s->links); + s = s->next; + } + + return count; +} + /** * The /os stats command. * @param u The user who issued the command @@ -83,6 +101,8 @@ int do_stats(User * u) mins = (uptime / 60) % 60, secs = uptime % 60; struct tm *tm; char timebuf[64]; + char buf[512]; + int buflen; if (extra && stricmp(extra, "ALL") != 0) { if (stricmp(extra, "AKILL") == 0) { @@ -207,81 +227,195 @@ int do_stats(User * u) notice_lang(s_OperServ, u, PERMISSION_DENIED); } return MOD_CONT; - } else { + } else if (stricmp(extra, "MEMORY") && stricmp(extra, "UPLINK")) { notice_lang(s_OperServ, u, OPER_STATS_UNKNOWN_OPTION, extra); } } - - notice_lang(s_OperServ, u, OPER_STATS_CURRENT_USERS, usercnt, opcnt); - tm = localtime(&maxusertime); - strftime_lang(timebuf, sizeof(timebuf), u, STRFTIME_DATE_TIME_FORMAT, - tm); - notice_lang(s_OperServ, u, OPER_STATS_MAX_USERS, maxusercnt, timebuf); - if (days > 1) { - notice_lang(s_OperServ, u, OPER_STATS_UPTIME_DHMS, - days, hours, mins, secs); - } else if (days == 1) { - notice_lang(s_OperServ, u, OPER_STATS_UPTIME_1DHMS, - days, hours, mins, secs); - } else { - if (hours > 1) { - if (mins != 1) { - if (secs != 1) { - notice_lang(s_OperServ, u, OPER_STATS_UPTIME_HMS, - hours, mins, secs); - } else { - notice_lang(s_OperServ, u, OPER_STATS_UPTIME_HM1S, - hours, mins, secs); - } - } else { - if (secs != 1) { - notice_lang(s_OperServ, u, OPER_STATS_UPTIME_H1MS, - hours, mins, secs); - } else { - notice_lang(s_OperServ, u, OPER_STATS_UPTIME_H1M1S, - hours, mins, secs); - } - } - } else if (hours == 1) { - if (mins != 1) { - if (secs != 1) { - notice_lang(s_OperServ, u, OPER_STATS_UPTIME_1HMS, - hours, mins, secs); - } else { - notice_lang(s_OperServ, u, OPER_STATS_UPTIME_1HM1S, - hours, mins, secs); - } - } else { - if (secs != 1) { - notice_lang(s_OperServ, u, OPER_STATS_UPTIME_1H1MS, - hours, mins, secs); - } else { - notice_lang(s_OperServ, u, OPER_STATS_UPTIME_1H1M1S, - hours, mins, secs); - } - } - } else { - if (mins != 1) { - if (secs != 1) { - notice_lang(s_OperServ, u, OPER_STATS_UPTIME_MS, - mins, secs); - } else { - notice_lang(s_OperServ, u, OPER_STATS_UPTIME_M1S, - mins, secs); - } - } else { - if (secs != 1) { - notice_lang(s_OperServ, u, OPER_STATS_UPTIME_1MS, - mins, secs); - } else { - notice_lang(s_OperServ, u, OPER_STATS_UPTIME_1M1S, - mins, secs); - } - } - } + + if ((stricmp(extra, "MEMORY") != 0) && (stricmp(extra, "UPLINK") != 0)) { + notice_lang(s_OperServ, u, OPER_STATS_CURRENT_USERS, usercnt, opcnt); + tm = localtime(&maxusertime); + strftime_lang(timebuf, sizeof(timebuf), u, STRFTIME_DATE_TIME_FORMAT, + tm); + notice_lang(s_OperServ, u, OPER_STATS_MAX_USERS, maxusercnt, timebuf); + if (days > 1) { + notice_lang(s_OperServ, u, OPER_STATS_UPTIME_DHMS, + days, hours, mins, secs); + } else if (days == 1) { + notice_lang(s_OperServ, u, OPER_STATS_UPTIME_1DHMS, + days, hours, mins, secs); + } else { + if (hours > 1) { + if (mins != 1) { + if (secs != 1) { + notice_lang(s_OperServ, u, OPER_STATS_UPTIME_HMS, + hours, mins, secs); + } else { + notice_lang(s_OperServ, u, OPER_STATS_UPTIME_HM1S, + hours, mins, secs); + } + } else { + if (secs != 1) { + notice_lang(s_OperServ, u, OPER_STATS_UPTIME_H1MS, + hours, mins, secs); + } else { + notice_lang(s_OperServ, u, OPER_STATS_UPTIME_H1M1S, + hours, mins, secs); + } + } + } else if (hours == 1) { + if (mins != 1) { + if (secs != 1) { + notice_lang(s_OperServ, u, OPER_STATS_UPTIME_1HMS, + hours, mins, secs); + } else { + notice_lang(s_OperServ, u, OPER_STATS_UPTIME_1HM1S, + hours, mins, secs); + } + } else { + if (secs != 1) { + notice_lang(s_OperServ, u, OPER_STATS_UPTIME_1H1MS, + hours, mins, secs); + } else { + notice_lang(s_OperServ, u, OPER_STATS_UPTIME_1H1M1S, + hours, mins, secs); + } + } + } else { + if (mins != 1) { + if (secs != 1) { + notice_lang(s_OperServ, u, OPER_STATS_UPTIME_MS, + mins, secs); + } else { + notice_lang(s_OperServ, u, OPER_STATS_UPTIME_M1S, + mins, secs); + } + } else { + if (secs != 1) { + notice_lang(s_OperServ, u, OPER_STATS_UPTIME_1MS, + mins, secs); + } else { + notice_lang(s_OperServ, u, OPER_STATS_UPTIME_1M1S, + mins, secs); + } + } + } + } } - - if (extra && stricmp(extra, "ALL") == 0 && is_services_admin(u)) { + + if (extra && ((stricmp(extra, "ALL") == 0) || (stricmp(extra, "UPLINK") == 0)) && is_services_admin(u)) { + notice_lang(s_OperServ, u, OPER_STATS_UPLINK_SERVER, serv_uplink->name); + buf[0] = '\0'; + buflen = 511; /* How confusing, this is the amount of space left! */ + if (uplink_capab & CAPAB_NOQUIT) { + strncat(buf, " NOQUIT", buflen); + buflen -= 7; + } + if (uplink_capab & CAPAB_TSMODE) { + strncat(buf, " TSMODE", buflen); + buflen -= 7; + } + if (uplink_capab & CAPAB_UNCONNECT) { + strncat(buf, " UNCONNECT", buflen); + buflen -= 10; + } + if (uplink_capab & CAPAB_NICKIP) { + strncat(buf, " NICKIP", buflen); + buflen -= 7; + } + if (uplink_capab & CAPAB_NSJOIN) { + strncat(buf, " SSJOIN", buflen); + buflen -= 7; + } + if (uplink_capab & CAPAB_ZIP) { + strncat(buf, " ZIP", buflen); + buflen -= 4; + } + if (uplink_capab & CAPAB_BURST) { + strncat(buf, " BURST", buflen); + buflen -= 6; + } + if (uplink_capab & CAPAB_TS5) { + strncat(buf, " TS5", buflen); + buflen -= 4; + } + if (uplink_capab & CAPAB_TS3) { + strncat(buf, " TS3", buflen); + buflen -= 4; + } + if (uplink_capab & CAPAB_DKEY) { + strncat(buf, " DKEY", buflen); + buflen -= 5; + } + if (uplink_capab & CAPAB_PT4) { + strncat(buf, " PT4", buflen); + buflen -= 4; + } + if (uplink_capab & CAPAB_SCS) { + strncat(buf, " SCS", buflen); + buflen -= 4; + } + if (uplink_capab & CAPAB_QS) { + strncat(buf, " QS", buflen); + buflen -= 3; + } + if (uplink_capab & CAPAB_UID) { + strncat(buf, " UID", buflen); + buflen -= 4; + } + if (uplink_capab & CAPAB_KNOCK) { + strncat(buf, " KNOCK", buflen); + buflen -= 6; + } + if (uplink_capab & CAPAB_CLIENT) { + strncat(buf, " CLIENT", buflen); + buflen -= 7; + } + if (uplink_capab & CAPAB_IPV6) { + strncat(buf, " IPV6", buflen); + buflen -= 5; + } + if (uplink_capab & CAPAB_SSJ5) { + strncat(buf, " SSJ5", buflen); + buflen -= 5; + } + if (uplink_capab & CAPAB_SN2) { + strncat(buf, " SN2", buflen); + buflen -= 5; + } + if (uplink_capab & CAPAB_TOKEN) { + strncat(buf, " TOKEN", buflen); + buflen -= 6; + } + if (uplink_capab & CAPAB_VHOST) { + strncat(buf, " VHOST", buflen); + buflen -= 6; + } + if (uplink_capab & CAPAB_SSJ3) { + strncat(buf, " SSJ3", buflen); + buflen -= 5; + } + if (uplink_capab & CAPAB_SJB64) { + strncat(buf, " SJB64", buflen); + buflen -= 6; + } + if (uplink_capab & CAPAB_CHANMODE) { + strncat(buf, " CHANMODES=", buflen); + buflen -= 11; + strncat(buf, ircd->chanmodes, buflen); + buflen -= strlen(ircd->chanmodes); + } + if (uplink_capab & CAPAB_NICKCHARS) { + strncat(buf, " NICKCHARS=", buflen); + buflen -= 11; + strncat(buf, ircd->nickchars, buflen); + buflen -= strlen(ircd->nickchars); + } + notice_lang(s_OperServ, u, OPER_STATS_UPLINK_CAPAB, buf); + notice_lang(s_OperServ, u, OPER_STATS_UPLINK_SERVER_COUNT, stats_count_servers(serv_uplink)); + } + + if (extra && ((stricmp(extra, "ALL") == 0) || (stricmp(extra, "MEMORY") == 0)) && is_services_admin(u)) { long count, mem; notice_lang(s_OperServ, u, OPER_STATS_BYTES_READ, diff --git a/src/servers.c b/src/servers.c index 2fe928318..0a076c334 100644 --- a/src/servers.c +++ b/src/servers.c @@ -188,7 +188,7 @@ static void delete_server(Server * serv, const char *quitreason) } u = unext; } - if (debug >= 2) + if (debug) alog("debug: delete_server() cleared all users"); } } @@ -200,7 +200,7 @@ static void delete_server(Server * serv, const char *quitreason) s = snext; } - if (debug >= 2) + if (debug) alog("debug: delete_server() cleared all servers"); free(serv->name); diff --git a/version.log b/version.log index 5f7347fbd..d74fe3c95 100644 --- a/version.log +++ b/version.log @@ -9,10 +9,14 @@ VERSION_MAJOR="1" VERSION_MINOR="7" VERSION_PATCH="11" VERSION_EXTRA="-svn" -VERSION_BUILD="905" +VERSION_BUILD="906" # $Log$ # +# BUILD : 1.7.11 (906) +# BUGS : +# NOTES : Added information on the uplink server via /os stats uplink +# # BUILD : 1.7.11 (905) # BUGS : # NOTES : Fixed up config; UserKeys can be safely missing again, you get a real warning when they are identical, and fixed a small grammar error in the GlobalOnCycle warning just above -- cgit