From 640e55db359710f45183c5f15f97dce0dea15cfd Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Thu, 20 Oct 2016 17:50:45 +0200 Subject: [client] reworked the logic of forcing custom sat selections --- .../org/openslx/dozmod/thrift/ThriftActions.java | 49 +++++++++++++--------- 1 file changed, 29 insertions(+), 20 deletions(-) (limited to 'dozentenmodul/src/main/java') 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 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 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" -- cgit v1.2.3-55-g7522