diff src/org/tn5250j/framework/tn5250/tnvt.java @ 119:6969d6cebcd7

add more 5250 config items
author Carl Byington <carl@five-ten-sg.com>
date Wed, 18 Jun 2014 18:55:56 -0700
parents 77ac18bc1b2f
children dcac61b6f2e6
line wrap: on
line diff
--- a/src/org/tn5250j/framework/tn5250/tnvt.java	Wed Jun 18 16:53:58 2014 -0700
+++ b/src/org/tn5250j/framework/tn5250/tnvt.java	Wed Jun 18 18:55:56 2014 -0700
@@ -85,6 +85,7 @@
 import android.util.Log;
 
 import com.five_ten_sg.connectbot.R;
+import com.five_ten_sg.connectbot.bean.HostBean;
 import com.five_ten_sg.connectbot.service.TerminalBridge;
 import com.five_ten_sg.connectbot.service.TerminalManager;
 import de.mud.terminal.vt320;
@@ -154,6 +155,7 @@
     private static int STRSCAN = 1;
     // WVL - LDC : 05/08/2005 : TFX.006253 - support STRPCCMD
     private boolean strpccmd; // = false;
+    private String encryption;
     private String user;
     private String password;
     private String library;
@@ -186,27 +188,6 @@
         this.manager    = manager;
         setCodePage("37");
         dataIncluded = new boolean[24];
-
-        if (System.getProperties().containsKey("SESSION_CONNECT_USER")) {
-            user = System.getProperties().getProperty("SESSION_CONNECT_USER");
-
-            if (System.getProperties().containsKey("SESSION_CONNECT_PASSWORD"))
-                password = System.getProperties().getProperty(
-                               "SESSION_CONNECT_PASSWORD");
-
-            if (System.getProperties().containsKey("SESSION_CONNECT_LIBRARY"))
-                library = System.getProperties().getProperty(
-                              "SESSION_CONNECT_LIBRARY");
-
-            if (System.getProperties().containsKey("SESSION_CONNECT_MENU"))
-                initialMenu = System.getProperties().getProperty(
-                                  "SESSION_CONNECT_MENU");
-
-            if (System.getProperties().containsKey("SESSION_CONNECT_PROGRAM"))
-                program = System.getProperties().getProperty(
-                              "SESSION_CONNECT_PROGRAM");
-        }
-
         baosp = new ByteArrayOutputStream();
         baosrsp = new ByteArrayOutputStream();
     }
@@ -260,11 +241,22 @@
         Log.i(TAG, " socks set ");
     }
 
-    public final boolean connect(String hostname, int port, String encryption, String homeDirectory, vt320 buffer) {
+    private String fixer(String value, String default) {
+        if ((value == null) || (value.length() == 0)) return default;
+        return value;
+    }
+
+    public final boolean connect(HostBean host, String homeDirectory, vt320 buffer) {
         try {
-            this.hostname = hostname;
-            this.port     = port;
-            this.buffer   = buffer;
+            this.hostname    = host.getHostname();
+            this.port        = host.getPort();
+            this.buffer      = buffer;
+            this.encryption  = fixer(host.getEncryption5250(), "NONE");
+            this.user        = host.getUsername();
+            this.password    = host.getPassword();
+            this.library     = host.getLibrary();
+            this.initialMenu = host.getInitialMenu();
+            this.program     = host.getProgram();
 
             try {
                 screen52.getOIA().setInputInhibited(ScreenOIA.INPUTINHIBITED_SYSTEM_WAIT,