diff options
-rw-r--r-- | Changes | 1 | ||||
-rw-r--r-- | Changes.lang | 4 | ||||
-rw-r--r-- | lang/cat.l | 8 | ||||
-rw-r--r-- | lang/de.l | 8 | ||||
-rw-r--r-- | lang/en_us.l | 23 | ||||
-rw-r--r-- | lang/es.l | 8 | ||||
-rw-r--r-- | lang/fr.l | 8 | ||||
-rw-r--r-- | lang/gr.l | 8 | ||||
-rw-r--r-- | lang/hun.l | 8 | ||||
-rw-r--r-- | lang/it.l | 8 | ||||
-rw-r--r-- | lang/nl.l | 8 | ||||
-rw-r--r-- | lang/pl.l | 8 | ||||
-rw-r--r-- | lang/pt.l | 8 | ||||
-rw-r--r-- | lang/ru.l | 8 | ||||
-rw-r--r-- | lang/tr.l | 8 | ||||
-rw-r--r-- | src/core/os_stats.c | 276 | ||||
-rw-r--r-- | src/servers.c | 4 | ||||
-rw-r--r-- | version.log | 6 |
18 files changed, 330 insertions, 80 deletions
@@ -1,6 +1,7 @@ Anope Version S V N -------------------- Provided by Anope Dev. <dev@anope.org> - 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 @@ -2517,6 +2517,14 @@ 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 @@ -2486,6 +2486,14 @@ 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 @@ -2490,6 +2490,14 @@ 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 @@ -2530,6 +2530,14 @@ 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 @@ -2519,6 +2519,14 @@ 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 @@ -2450,6 +2450,14 @@ 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 @@ -2489,6 +2489,14 @@ 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 @@ -2675,6 +2675,14 @@ 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 @@ -2462,6 +2462,14 @@ 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 @@ -2497,6 +2497,14 @@ 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 #êàíàë ðåæèìû @@ -2512,6 +2512,14 @@ 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 @@ -71,6 +71,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 * @param MOD_CONT to continue processing other modules, MOD_STOP to stop processing. @@ -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 |