|
|
@ -272,7 +272,7 @@ public class ServerSetting implements SimpleListItem { |
|
|
|
* Converts local server settings into an old-style {@link DaemonSettings} object. |
|
|
|
* Converts local server settings into an old-style {@link DaemonSettings} object. |
|
|
|
* @param connectedToNetwork The name of the (wifi) network we are currently connected to, or null if this could not |
|
|
|
* @param connectedToNetwork The name of the (wifi) network we are currently connected to, or null if this could not |
|
|
|
* be determined |
|
|
|
* be determined |
|
|
|
* @param caller |
|
|
|
* @param caller A context to access the logger |
|
|
|
* @return A {@link DaemonSettings} object to execute server commands against |
|
|
|
* @return A {@link DaemonSettings} object to execute server commands against |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private DaemonSettings convertToDaemonSettings(String connectedToNetwork, Context caller) { |
|
|
|
private DaemonSettings convertToDaemonSettings(String connectedToNetwork, Context caller) { |
|
|
@ -282,12 +282,21 @@ public class ServerSetting implements SimpleListItem { |
|
|
|
if (!TextUtils.isEmpty(localNetwork)) |
|
|
|
if (!TextUtils.isEmpty(localNetwork)) |
|
|
|
Log.d(caller, "Creating adapter for " + name + " of type " + type.name() + ": connected to " |
|
|
|
Log.d(caller, "Creating adapter for " + name + " of type " + type.name() + ": connected to " |
|
|
|
+ connectedToNetwork + " and configured local network is " + localNetwork); |
|
|
|
+ connectedToNetwork + " and configured local network is " + localNetwork); |
|
|
|
return new DaemonSettings(name, type, |
|
|
|
String addressToUse = address; |
|
|
|
!TextUtils.isEmpty(connectedToNetwork) && !TextUtils.isEmpty(localAddress) |
|
|
|
int portToUse = port; |
|
|
|
&& connectedToNetwork.equals(localNetwork) ? localAddress : address, |
|
|
|
if (!TextUtils.isEmpty(localNetwork) && !TextUtils.isEmpty(localAddress) |
|
|
|
!TextUtils.isEmpty(connectedToNetwork) && connectedToNetwork.equals(localNetwork) ? localPort : port, |
|
|
|
&& !TextUtils.isEmpty(connectedToNetwork)) { |
|
|
|
ssl, sslTrustAll, sslTrustKey, folder, useAuthentication, username, password, extraPass, os, |
|
|
|
String[] localNetworks = localNetwork.split("\\|"); |
|
|
|
downloadDir, ftpUrl, ftpPassword, timeout, alarmOnFinishedDownload, alarmOnNewTorrent, |
|
|
|
for (String network : localNetworks) { |
|
|
|
Integer.toString(key), isAutoGenerated); |
|
|
|
if (connectedToNetwork.equals(network)) { |
|
|
|
|
|
|
|
addressToUse = localAddress; |
|
|
|
|
|
|
|
portToUse = localPort; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return new DaemonSettings(name, type, addressToUse, portToUse, ssl, sslTrustAll, sslTrustKey, folder, |
|
|
|
|
|
|
|
useAuthentication, username, password, extraPass, os, downloadDir, ftpUrl, ftpPassword, timeout, |
|
|
|
|
|
|
|
alarmOnFinishedDownload, alarmOnNewTorrent, Integer.toString(key), isAutoGenerated); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|