mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 02:52:02 -08:00
Improved command line autoconnect
Changed how the command line autoconnect was handled to leverage the existing autoconnect code.
This commit is contained in:
parent
6ad23a2f3d
commit
5e6474c06e
1 changed files with 10 additions and 16 deletions
|
|
@ -740,7 +740,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean autoConnect() {
|
public boolean autoConnect() {
|
||||||
boolean autoConnectParamValue = Boolean.parseBoolean(PREFS.get("autoConnect", "false"));
|
boolean autoConnectParamValue = startUser != null || Boolean.parseBoolean(PREFS.get("autoConnect", "false"));
|
||||||
boolean status = false;
|
boolean status = false;
|
||||||
if (autoConnectParamValue) {
|
if (autoConnectParamValue) {
|
||||||
status = performConnect(false);
|
status = performConnect(false);
|
||||||
|
|
@ -1238,26 +1238,20 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
instance = new MageFrame();
|
instance = new MageFrame();
|
||||||
instance.setVisible(true);
|
|
||||||
if( startUser != null){
|
|
||||||
//instance.connectDialog.
|
|
||||||
Connection startConnection = new Connection();
|
|
||||||
startConnection.setUsername(startUser);
|
|
||||||
startConnection.setHost(startServer);
|
|
||||||
if (startPort > 0){
|
|
||||||
startConnection.setPort(startPort);
|
|
||||||
}else {
|
|
||||||
startConnection.setPort(MagePreferences.getServerPortWithDefault(Config.port));
|
|
||||||
}
|
|
||||||
PreferencesDialog.setProxyInformation(startConnection);
|
|
||||||
startConnection.setPassword(startPassword);
|
|
||||||
boolean connectSuccess = connect(startConnection);
|
|
||||||
if (connectSuccess){
|
|
||||||
instance.connectDialog.hideDialog();
|
|
||||||
} else {
|
|
||||||
|
|
||||||
|
if( startUser != null){
|
||||||
|
instance.currentConnection = new Connection();
|
||||||
|
instance.currentConnection.setUsername(startUser);
|
||||||
|
instance.currentConnection.setHost(startServer);
|
||||||
|
if (startPort > 0){
|
||||||
|
instance.currentConnection.setPort(startPort);
|
||||||
|
}else {
|
||||||
|
instance.currentConnection.setPort(MagePreferences.getServerPortWithDefault(Config.port));
|
||||||
}
|
}
|
||||||
|
PreferencesDialog.setProxyInformation(instance.currentConnection);
|
||||||
|
instance.currentConnection.setPassword(startPassword);
|
||||||
}
|
}
|
||||||
|
instance.setVisible(true);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue