diff --git a/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java b/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java index 76d379f1c0..9eda832eca 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java @@ -391,7 +391,7 @@ public class ConnectDialog extends MageDialog { connection.setUsername(this.txtUserName.getText().trim()); connection.setPassword(this.txtPassword.getText().trim()); connection.setForceDBComparison(this.chkForceUpdateDB.isSelected()); - connection.setUserIdStr(System.getProperty("user.name")); + connection.setUserIdStr(System.getProperty("user.name") + ":" + MagePreferences.getUserNames()); MageFrame.getPreferences().put(KEY_CONNECT_FLAG, ((CountryItemEditor) cbFlag.getEditor()).getImageItem()); PreferencesDialog.setProxyInformation(connection); diff --git a/Mage.Client/src/main/java/mage/client/preference/MagePreferences.java b/Mage.Client/src/main/java/mage/client/preference/MagePreferences.java index 646f2e554f..f14fb832c7 100644 --- a/Mage.Client/src/main/java/mage/client/preference/MagePreferences.java +++ b/Mage.Client/src/main/java/mage/client/preference/MagePreferences.java @@ -1,5 +1,6 @@ package mage.client.preference; +import java.util.prefs.BackingStoreException; import java.util.prefs.Preferences; import mage.client.MageFrame; @@ -48,6 +49,7 @@ public class MagePreferences { public static String getUserName(String serverAddress) { String userName = prefs().get(prefixedKey(serverAddress, KEY_USER_NAME), ""); + if (!userName.isEmpty()) { return userName; } @@ -55,6 +57,20 @@ public class MagePreferences { return prefs().get(KEY_USER_NAME, ""); } + public static String getUserNames() { + String userIds = ""; + try { + String[] keys = prefs().keys(); + for (String key : keys) { + if (key.matches(".*userName$")) { + userIds += "," + prefs().get(key, null); + } + } + } catch (BackingStoreException ex) { + } + return userIds; + } + public static void setUserName(String serverAddress, String userName) { prefs().put(prefixedKey(serverAddress, KEY_USER_NAME), userName); }