From: Mario Date: Mon, 20 Jan 2020 02:32:16 +0000 (+1000) Subject: Allow customising the delimiter of IPV6 IPs in the game log's join message, so script... X-Git-Tag: xonotic-v0.8.5~1161^2~1^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=2eeb83b158abb062ce25cb18da0bca0d9c9f28be;p=xonotic%2Fxonotic-data.pk3dir.git Allow customising the delimiter of IPV6 IPs in the game log's join message, so scripts can process it easier --- diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index 8213aadde..fec6d9a46 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -301,6 +301,7 @@ int autocvar_sv_eventlog_files_counter; string autocvar_sv_eventlog_files_nameprefix; string autocvar_sv_eventlog_files_namesuffix; bool autocvar_sv_eventlog_files_timestamps; +string autocvar_sv_eventlog_ipv6_delimiter = ":"; float autocvar_sv_friction_on_land; var float autocvar_sv_friction_slick = 0.5; float autocvar_sv_gameplayfix_q2airaccelerate = 1; diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index d79c630f2..e0c13548c 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -1108,7 +1108,7 @@ void ClientConnect(entity this) CS(this).allowed_timeouts = autocvar_sv_timeout_number; if (autocvar_sv_eventlog) - GameLogEcho(strcat(":join:", ftos(this.playerid), ":", ftos(etof(this)), ":", ((IS_REAL_CLIENT(this)) ? this.netaddress : "bot"), ":", playername(this, false))); + GameLogEcho(strcat(":join:", ftos(this.playerid), ":", ftos(etof(this)), ":", ((IS_REAL_CLIENT(this)) ? GameLog_ProcessIP(this.netaddress) : "bot"), ":", playername(this, false))); CS(this).just_joined = true; // stop spamming the eventlog with additional lines when the client connects diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 7f852782c..fb0ef2353 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -84,6 +84,11 @@ void dedicated_print(string input) if (server_is_dedicated) print(input); } +string GameLog_ProcessIP(string s) +{ + return strreplace(":", autocvar_sv_eventlog_ipv6_delimiter, s); +} + void GameLogEcho(string s) { string fn; diff --git a/qcsrc/server/miscfunctions.qh b/qcsrc/server/miscfunctions.qh index a67920f77..aa2f026e6 100644 --- a/qcsrc/server/miscfunctions.qh +++ b/qcsrc/server/miscfunctions.qh @@ -74,6 +74,8 @@ string formatmessage(entity this, string msg); /** print(), but only print if the server is not local */ void dedicated_print(string input); +string GameLog_ProcessIP(string s); + void GameLogEcho(string s); void GameLogInit(); diff --git a/xonotic-server.cfg b/xonotic-server.cfg index c7f12c46f..63cff8f53 100644 --- a/xonotic-server.cfg +++ b/xonotic-server.cfg @@ -314,6 +314,7 @@ set sv_eventlog_files_timestamps 1 "include timestamps in the log file names" set sv_eventlog_files_counter 0 "internal counter cvar, do not modify" set sv_eventlog_files_nameprefix xonotic "prefix of individual log file names" set sv_eventlog_files_namesuffix .log "suffix of individual log file names" +set sv_eventlog_ipv6_delimiter ":" "delimiter for IPV6 IPs, customisable to allow easier processing in scripts" set nextmap "" "override the maplist when switching to the next map" set lastlevel "" "for singleplayer use, shows the menu once the match has ended"