[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] make v0 connections handle lists of event names.



Update of /home/or/cvsroot/control/java/net/freehaven/tor/control/examples
In directory moria:/tmp/cvs-serv11903/java/net/freehaven/tor/control/examples

Modified Files:
	Main.java 
Log Message:
make v0 connections handle lists of event names.

Index: Main.java
===================================================================
RCS file: /home/or/cvsroot/control/java/net/freehaven/tor/control/examples/Main.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Main.java	20 Jul 2005 22:48:35 -0000	1.5
+++ Main.java	20 Jul 2005 22:55:41 -0000	1.6
@@ -52,10 +52,10 @@
         throws IOException {
         TorControlConnection conn = TorControlConnection.getConnection(
                                     new java.net.Socket("127.0.0.1", 9100));
-        if (conn instanceof TorControlConnection1) {
-            System.err.println("Debugging");
-            ((TorControlConnection1)conn).setDebugging(System.err);
-        }
+        //if (conn instanceof TorControlConnection1) {
+        //    System.err.println("Debugging");
+        //    ((TorControlConnection1)conn).setDebugging(System.err);
+        //}
         Thread th = conn.launchThread(daemon);
         conn.authenticate(new byte[0]);
         return conn;
@@ -111,31 +111,7 @@
         TorControlConnection conn = getConnection(args, false);
         ArrayList lst = new ArrayList();
         for (int i = 1; i < args.length; ++i) {
-            short s = -1;
-            if (args[i].equals("circ"))
-                s = EVENT_CIRCSTATUS;
-            else if (args[i].equals("stream"))
-                s = EVENT_STREAMSTATUS;
-            else if (args[i].equals("orconn"))
-                s = EVENT_ORCONNSTATUS;
-            else if (args[i].equals("bw"))
-                s = EVENT_BANDWIDTH;
-            else if (args[i].equals("newdesc"))
-                s = EVENT_NEWDESCRIPTOR;
-            else if (args[i].equals("info"))
-                s = EVENT_MSG_INFO;
-            else if (args[i].equals("notice"))
-                s = EVENT_MSG_NOTICE;
-            else if (args[i].equals("warn"))
-                s = EVENT_MSG_WARN;
-            else if (args[i].equals("error"))
-                s = EVENT_MSG_ERROR;
-            else {
-                System.err.println("Unrecognized event type: "+args[i]);
-                continue;
-            }
-            lst.add(new Integer(s));
-
+            lst.add(args[i]);
         }
         conn.setEventHandler(
             new DebuggingEventHandler(new PrintWriter(System.out, true)));