@ -250,20 +250,28 @@ public class ServerSetting implements SimpleListItem {
@@ -250,20 +250,28 @@ public class ServerSetting implements SimpleListItem {
/ * *
* Returns the appropriate daemon adapter to which tasks can be executed , in accordance with this server ' s settings
* @param connectedToNetwork The name of the ( wifi ) network we are currently connected to , or null if this could not
* be determined
* @return An IDaemonAdapter instance of the specific torrent client daemon type
* /
public IDaemonAdapter createServerAdapter ( ) {
return type . createAdapter ( convertToDaemonSettings ( ) ) ;
public IDaemonAdapter createServerAdapter ( String connectedToNetwork ) {
return type . createAdapter ( convertToDaemonSettings ( connectedToNetwork ) ) ;
}
private DaemonSettings convertToDaemonSettings ( ) {
// Convert local server settings into an old-style DaemonSetting object
// The local integer key is converted to the idString string
// TODO: Add localaddress and localnetwork to DaemonSettings, or solve properly rework the Connect library
// handling of settings
return new DaemonSettings ( name , type , address , port , ssl , sslTrustAll , sslTrustKey ,
folder , useAuthentication , username , password , extraPass , os , downloadDir , ftpUrl , ftpPassword ,
timeout , alarmOnFinishedDownload , alarmOnNewTorrent , Integer . toString ( key ) , isAutoGenerated ) ;
/ * *
* 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
* @return A { @link DaemonSettings } object to execute server commands against
* /
private DaemonSettings convertToDaemonSettings ( String connectedToNetwork ) {
// The local integer key is converted to the idString string.
// The host name address used is dependent on the network that we are currently connected to (to allow a
// distinct connection IP or host name when connected to a local network).
return new DaemonSettings ( name , type ,
connectedToNetwork ! = null & & connectedToNetwork . equals ( localNetwork ) ? localAddress : address , port ,
ssl , sslTrustAll , sslTrustKey , folder , useAuthentication , username , password , extraPass , os ,
downloadDir , ftpUrl , ftpPassword , timeout , alarmOnFinishedDownload , alarmOnNewTorrent ,
Integer . toString ( key ) , isAutoGenerated ) ;
}
}