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