rename adduser -> addtueruser
[saartuer.git] / AndTuer / src / de / hacksaar / andtuer / AsyncTyshell.java
index 4dcdcafd719d4f27273045a48d9e8331bf7b8316..623698813e25c907a698cb679252883111676010 100644 (file)
@@ -5,6 +5,10 @@ import android.util.Log;
 import de.hacksaar.javatuer.InteractiveLogin;
 import de.hacksaar.javatuer.TyshellClient;
 
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.util.LinkedList;
 import java.util.Queue;
 
@@ -50,10 +54,28 @@ class AsyncTyshell extends AsyncTask<Void, Void, Void> {
                }
        }
 
+       private void readUnlimited(InputStreamReader inputStreamReader) {
+               final BufferedReader reader = new BufferedReader(inputStreamReader);
+               new Thread(new Runnable() {
+                       @Override
+                       public void run() {
+                               String line;
+                               try {
+                                       while((line = reader.readLine()) != null) {
+                                               prompter.sendMessage(line);
+                                       }
+                               } catch (Exception e) {
+                                       Log.w("end read unlimited!", e);
+                               }
+                       }
+               }).start();
+       }
+
        @Override
        protected Void doInBackground(Void... voids) {
                TyshellClient client = new TyshellClient(hostname, port, new AndroidLogging());
                client.connect(username, keyFile, new AsyncInteractiveLogin());
+               readUnlimited(client.getInputStream());
                while (disconnect) {
                        String msg = null;
                        synchronized (messages) {