From cec679f63b2776502ab17c5db18ca43fd611192a Mon Sep 17 00:00:00 2001 From: Tony Mountifield Date: Mon, 28 Feb 2022 15:59:31 +0000 Subject: [PATCH 1/3] Make server GUI default to "None" directory if not set. Fixes #2441. If the directory is not set in the ini file or the command line, the server should not automatically register to All Genres 1. It should default to not registering until the user actually chooses a directory. --- src/settings.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/settings.cpp b/src/settings.cpp index 5136505217..5fdc4f1572 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -829,9 +829,9 @@ directoryAddress = GetIniSetting ( IniXMLDocument, "server", "centralservaddr", // directory type // CServerListManager defaults to AT_NONE - // Server GUI defaults to AT_DEFAULT + // Server GUI also defaults to AT_NONE (previously AT_DEFAULT, when registration was controlled by a checkbox) // Because type could be AT_CUSTOM, it has to be set after the address to avoid multiple registrations - EDirectoryType directoryType = AT_DEFAULT; + EDirectoryType directoryType = AT_NONE; // if command line is set, use it if ( CommandLineOptions.contains ( "--centralserver" ) || CommandLineOptions.contains ( "--directoryserver" ) ) @@ -840,15 +840,6 @@ directoryAddress = GetIniSetting ( IniXMLDocument, "server", "centralservaddr", } else { - // clang-format off -// TODO compatibility to old version < 3.8.2 -// if "servlistenabled" exists and is false, set directory type to AT_NONE -if ( GetFlagIniSet ( IniXMLDocument, "server", "servlistenabled", bValue ) && !bValue ) -{ - directoryType = AT_NONE; -} - // clang-format on - // clang-format off // TODO compatibility to old version < ????? // only the case that manual was set in old ini must be considered From 67597b60993e650548bdf39af56543ef2a6b7700 Mon Sep 17 00:00:00 2001 From: Tony Mountifield Date: Tue, 1 Mar 2022 15:48:00 +0000 Subject: [PATCH 2/3] Comments update --- src/settings.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/settings.cpp b/src/settings.cpp index 5fdc4f1572..62a747a497 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -829,11 +829,10 @@ directoryAddress = GetIniSetting ( IniXMLDocument, "server", "centralservaddr", // directory type // CServerListManager defaults to AT_NONE - // Server GUI also defaults to AT_NONE (previously AT_DEFAULT, when registration was controlled by a checkbox) // Because type could be AT_CUSTOM, it has to be set after the address to avoid multiple registrations EDirectoryType directoryType = AT_NONE; - // if command line is set, use it + // if a command line Directory server address is set, set the Directory Type (genre) to AT_CUSTOM so it's used if ( CommandLineOptions.contains ( "--centralserver" ) || CommandLineOptions.contains ( "--directoryserver" ) ) { directoryType = AT_CUSTOM; From f77edbb8e70567f023daaeca9f192f1ebdb924ef Mon Sep 17 00:00:00 2001 From: Tony Mountifield Date: Thu, 3 Mar 2022 16:10:31 +0000 Subject: [PATCH 3/3] Improve backward compatibility --- src/settings.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/settings.cpp b/src/settings.cpp index 62a747a497..f994c0910b 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -840,11 +840,10 @@ directoryAddress = GetIniSetting ( IniXMLDocument, "server", "centralservaddr", else { // clang-format off -// TODO compatibility to old version < ????? -// only the case that manual was set in old ini must be considered -if ( GetFlagIniSet ( IniXMLDocument, "server", "defcentservaddr", bValue ) && !bValue ) +// TODO compatibility to old version < 3.4.7 +if ( GetFlagIniSet ( IniXMLDocument, "server", "defcentservaddr", bValue ) ) { - directoryType = AT_CUSTOM; + directoryType = bValue ? AT_DEFAULT : AT_CUSTOM; } else // clang-format on @@ -867,6 +866,15 @@ else { directoryType = static_cast ( iValue ); } + + // clang-format off +// TODO compatibility to old version < 3.9.0 +// override type to AT_NONE if servlistenabled exists and is false +if ( GetFlagIniSet ( IniXMLDocument, "server", "servlistenabled", bValue ) && !bValue ) +{ + directoryType = AT_NONE; +} + // clang-format on } pServer->SetDirectoryType ( directoryType );