From 1467151e668c63e65a082d58c1801661fd58c62a Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Thu, 9 Jan 2025 23:45:12 +0100 Subject: [PATCH] UI - Add password fill compatiblity for "connectToServer" (2.19+) --- addons/ui/fnc_initDisplayPassword.sqf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/ui/fnc_initDisplayPassword.sqf b/addons/ui/fnc_initDisplayPassword.sqf index 8f0bae293..31fa095c9 100644 --- a/addons/ui/fnc_initDisplayPassword.sqf +++ b/addons/ui/fnc_initDisplayPassword.sqf @@ -1,4 +1,6 @@ #include "script_component.hpp" +// since 2.19 "server:port" is stored on the display in "guid" variable, makes password filling compatible with "connectToServer" command +#define GET_SERVER (if (productVersion#2 > 218) then {_display getVariable "guid"} else {_ctrlServerList lbData lbCurSel _ctrlServerList}) if (profileNamespace getVariable [QGVAR(StorePasswords), 1] < 1) exitWith {}; @@ -13,7 +15,7 @@ _ctrlConfirm ctrlAddEventHandler ["ButtonClick", { private _ctrlPassword = _display displayCtrl IDC_PASSWORD; private _ctrlServerList = (uiNamespace getVariable "RscDisplayMultiplayer") displayCtrl IDC_MULTI_SESSIONS; - private _server = _ctrlServerList lbData lbCurSel _ctrlServerList; + private _server = GET_SERVER; private _password = ctrlText _ctrlPassword; //diag_log ["write", _server, _password]; @@ -28,7 +30,7 @@ _ctrlConfirm ctrlAddEventHandler ["ButtonClick", { saveProfileNamespace; }]; -private _server = _ctrlServerList lbData lbCurSel _ctrlServerList; +private _server = GET_SERVER; // read password from cache private _passwordCache = profileNamespace getVariable [QGVAR(ServerPasswords), [[], []]];