# HG changeset patch # User Carl Byington # Date 1403571279 25200 # Node ID 156b53fc4815ed616c96f5d1223febd8fae3f6a9 # Parent 86f9031005735abab7f84e82315f1f12a083c5a6 add showurl command diff -r 86f903100573 -r 156b53fc4815 src/com/five_ten_sg/connectbot/service/TerminalMonitor.java --- a/src/com/five_ten_sg/connectbot/service/TerminalMonitor.java Mon Jun 23 11:54:26 2014 -0700 +++ b/src/com/five_ten_sg/connectbot/service/TerminalMonitor.java Mon Jun 23 17:54:39 2014 -0700 @@ -4,6 +4,7 @@ import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; +import android.net.Uri; import android.os.IBinder; import android.util.Log; import android.view.View; @@ -32,6 +33,7 @@ public static final char MONITOR_CMD_GETFIELD = 6; public static final char MONITOR_CMD_SCREENWATCH = 7; public static final char MONITOR_CMD_DEPRESS = 8; + public static final char MONITOR_CMD_SHOWURL = 9; private static final int MONITORPORT = 6000; private static final String LOCALHOST = "127.0.0.1"; @@ -122,6 +124,12 @@ break; + case MONITOR_CMD_SHOWURL: + if (packet.length > 1) + showUrl(packet, 1); + + break; + default: break; } @@ -369,6 +377,19 @@ buffer.setField(l, c, da); } + public synchronized void showUrl(char [] data, int offset) { + Log.i(TAG, "setField()"); + char[] da = new char[data.length - offset]; + int i; + + for (i = 0; i < da.length; i++) { + da[i] = data[i + offset]; + } + String url = new String(da); + Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); + parent.startActivity(intent); + } + public synchronized void getField(int l, int c, int len) { Log.i(TAG, "getField()"); char[] arg2 = new char[4 + len];