diff options
author | Jonathan Bauer | 2016-10-20 17:50:45 +0200 |
---|---|---|
committer | Jonathan Bauer | 2016-10-20 17:50:45 +0200 |
commit | 640e55db359710f45183c5f15f97dce0dea15cfd (patch) | |
tree | cdedd6cc526812d9e52ec73532e680f3e3829add /dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java | |
parent | [client] allow extending the expiry date on invalid images (diff) | |
download | tutor-module-640e55db359710f45183c5f15f97dce0dea15cfd.tar.gz tutor-module-640e55db359710f45183c5f15f97dce0dea15cfd.tar.xz tutor-module-640e55db359710f45183c5f15f97dce0dea15cfd.zip |
[client] reworked the logic of forcing custom sat selections
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java')
-rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java index 5b57bcea..7873b8ca 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java @@ -109,33 +109,42 @@ public class ThriftActions { satToken = session.token; masterToken = session.masterToken; } else { - // after global login, try to contact satellite + // determine which sat to connect to + // first check if a sat selection was forced Satellite sat = null; - if (data.satellites != null && data.satellites.size() == 1 && !forceCustomSatellite) { - sat = data.satellites.get(0); + if (forceCustomSatellite) { + sat = SatelliteListWindow.open(window, data.satellites); + if (sat == null) + return false; } - + // not forced, do regular sat processing if (sat == null) { - if (!forceCustomSatellite) { - // Remove testing servers (those starting with {x}) if shift was not pressed - for (Iterator<Satellite> it = data.satellites.iterator(); it.hasNext();) { - Satellite entry = it.next(); - if (entry.displayName != null && entry.displayName.startsWith("{x}")) { - it.remove(); + // if we received only one sat, use that one + if (data.satellites != null && data.satellites.size() == 1) { + sat = data.satellites.get(0); + } + // we had more than one, so check the list + if (sat == null) { + if (!forceCustomSatellite) { + // Remove testing servers (those starting with {x}) if shift was not pressed + for (Iterator<Satellite> it = data.satellites.iterator(); it.hasNext();) { + Satellite entry = it.next(); + if (entry.displayName != null && entry.displayName.startsWith("{x}")) { + it.remove(); + } } } - } - // after removing the test sats, check if we have only one left and directly use that - // instead of asking the user - if (data.satellites.size() != 1) { - sat = SatelliteListWindow.open(window, data.satellites); - if (sat == null) - return false; - } else { - sat = data.satellites.get(0); + // after removing the test sats, check if we have only one left and directly use that + // instead of asking the user + if (data.satellites.size() != 1) { + sat = SatelliteListWindow.open(window, data.satellites); + if (sat == null) + return false; + } else { + sat = data.satellites.get(0); + } } } - if (sat.addressList == null || sat.addressList.isEmpty()) { Gui.asyncMessageBox( "Login erfolgreich, aber für den ausgewählten Satelliten-Server ist\n" |