-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make server browser remember last used password for every server (#973)
* make serverbrowser remember last used password for every server * Travis can't handle # * Travis can't handle # * use DisplayLoad * password saving setting * LLSTRING
- Loading branch information
Showing
6 changed files
with
114 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include "script_component.hpp" | ||
|
||
[ | ||
QGVAR(StorePasswords), "LIST", | ||
[LLSTRING(StoreServerPasswords), LLSTRING(StoreServerPasswordsTooltip)], | ||
LLSTRING(Category), | ||
[[1, 0, -1], [ | ||
[LLSTRING(SavePasswords), LLSTRING(SavePasswordsTooltip)], | ||
[LLSTRING(DoNotSavePasswords), LLSTRING(DoNotSavePasswordsTooltip)], | ||
[LLSTRING(DeletePasswords), LLSTRING(DeletePasswordsTooltip)] | ||
], 0], | ||
2, | ||
{ | ||
if (_this isEqualTo -1) then { | ||
profileNamespace setVariable [QGVAR(ServerPasswords), nil]; | ||
}; | ||
|
||
profileNamespace setVariable [QGVAR(StorePasswords), _this]; | ||
saveProfileNamespace; | ||
} | ||
] call cba_settings_fnc_init; | ||
|
||
if (hasInterface) then { | ||
call COMPILE_FILE(flexiMenu\init); | ||
|
||
// recreate after loading a savegame | ||
addMissionEventHandler ["Loaded", { | ||
if (!isNil QGVAR(ProgressBarParams)) then { | ||
QGVAR(ProgressBar) cutRsc [QGVAR(ProgressBar), "PLAIN"]; | ||
}; | ||
}]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
|
||
PREP(initDisplayInterrupt); | ||
PREP(initDisplayMultiplayerSetup); | ||
PREP(initDisplayPassword); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#include "script_component.hpp" | ||
|
||
if (profileNamespace getVariable [QGVAR(StorePasswords), 1] < 1) exitWith {}; | ||
|
||
params ["_display"]; | ||
private _ctrlConfirm = _display displayCtrl IDC_OK; | ||
private _ctrlPassword = _display displayCtrl IDC_PASSWORD; | ||
private _ctrlServerList = (uinamespace getVariable "RscDisplayMultiplayer") displayCtrl IDC_MULTI_SESSIONS; | ||
|
||
_ctrlConfirm ctrlAddEventHandler ["ButtonClick", { | ||
params ["_ctrlConfirm"]; | ||
private _display = ctrlParent _ctrlConfirm; | ||
private _ctrlPassword = _display displayCtrl IDC_PASSWORD; | ||
private _ctrlServerList = (uinamespace getVariable "RscDisplayMultiplayer") displayCtrl IDC_MULTI_SESSIONS; | ||
|
||
private _server = _ctrlServerList lbData lbCurSel _ctrlServerList; | ||
private _password = ctrlText _ctrlPassword; | ||
//diag_log ["write", _server, _password]; | ||
|
||
// store password in cache | ||
private _passwordCache = profileNamespace getVariable [QGVAR(ServerPasswords), [[], []]]; | ||
private _index = (_passwordCache select 0) find _server; | ||
if (_index isEqualTo -1) then { | ||
_index = (_passwordCache select 0) pushBack _server; | ||
}; | ||
(_passwordCache select 1) set [_index, _password]; | ||
profileNamespace setVariable [QGVAR(ServerPasswords), _passwordCache]; | ||
saveProfileNamespace; | ||
}]; | ||
|
||
private _server = _ctrlServerList lbData lbCurSel _ctrlServerList; | ||
|
||
// read password from cache | ||
private _passwordCache = profileNamespace getVariable [QGVAR(ServerPasswords), [[], []]]; | ||
private _index = (_passwordCache select 0) find _server; | ||
private _password = (_passwordCache select 1) param [_index, ""]; | ||
//diag_log ["read", _server, _password]; | ||
|
||
if (_password != "") then { | ||
_ctrlPassword ctrlSetText _password; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters