Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI - Add password fill compatiblity for "connectToServer" (2.19+) #1726

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions addons/ui/fnc_initDisplayPassword.sqf
Original file line number Diff line number Diff line change
@@ -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})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this for the profiling branch (will still be 218)?

Copy link
Contributor

@dedmen dedmen Jan 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes on current profiling branch.
Also you don't need to check for product version, the variable is always set in versions that support it. Just use the default value as fallback.
So put the lbData as a default value.


if (profileNamespace getVariable [QGVAR(StorePasswords), 1] < 1) exitWith {};

Expand All @@ -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];

Expand All @@ -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), [[], []]];
Expand Down
Loading