Author: bdonlan
Date: 2005-11-14 19:37:48 -0500 (Mon, 14 Nov 2005)
New Revision: 922
Added:
trunk/clients/javer3/Javer3/src/javer3/client/
trunk/clients/javer3/Javer3/src/javer3/client/HaverClient.java
trunk/clients/javer3/Javer3/src/javer3/client/ObjectQueue.java
trunk/clients/javer3/Javer3/src/javer3/client/Receiver.java
trunk/clients/javer3/Javer3/src/javer3/client/message/
Removed:
trunk/clients/javer3/Javer3/src/javer3/HaverClient.java
trunk/clients/javer3/Javer3/src/javer3/ObjectQueue.java
trunk/clients/javer3/Javer3/src/javer3/Receiver.java
trunk/clients/javer3/Javer3/src/javer3/message/
Modified:
trunk/clients/javer3/Javer3/src/javer3/Main.java
trunk/clients/javer3/Javer3/src/javer3/client/message/ConnectFailed.java
trunk/clients/javer3/Javer3/src/javer3/client/message/ConnectIOException.java
trunk/clients/javer3/Javer3/src/javer3/client/message/ConnectMessage.java
trunk/clients/javer3/Javer3/src/javer3/client/message/ConnectRejected.java
trunk/clients/javer3/Javer3/src/javer3/client/message/DisconnectMessage.java
trunk/clients/javer3/Javer3/src/javer3/client/message/ExceptionDisconnect.java
trunk/clients/javer3/Javer3/src/javer3/client/message/GracefulDisconnect.java
trunk/clients/javer3/Javer3/src/javer3/client/message/JoinedChannel.java
trunk/clients/javer3/Javer3/src/javer3/client/message/Message.java
trunk/clients/javer3/Javer3/src/javer3/client/message/PartedChannel.java
trunk/clients/javer3/Javer3/src/javer3/client/message/PrivateChat.java
trunk/clients/javer3/Javer3/src/javer3/client/message/PublicChat.java
trunk/clients/javer3/Javer3/src/javer3/client/message/ServerDisconnect.java
Log:
more reorg
Deleted: trunk/clients/javer3/Javer3/src/javer3/HaverClient.java
===================================================================
--- trunk/clients/javer3/Javer3/src/javer3/HaverClient.java 2005-11-14
22:01:32 UTC (rev 921)
+++ trunk/clients/javer3/Javer3/src/javer3/HaverClient.java 2005-11-15
00:37:48 UTC (rev 922)
@@ -1,384 +0,0 @@
-/*
- * HaverClient.java
- *
- * Created on November 13, 2005, 11:31 PM
- *
- * To change this template, choose Tools | Options and locate the template
under
- * the Source Creation and Management node. Right-click the template and choose
- * Open. You can then make changes to the template in the Source Editor.
- */
-
-package javer3;
-import java.io.*;
-import java.net.*;
-import java.util.*;
-import java.lang.reflect.*;
-import javer3.message.*;
-
-/**
- *
- * @author bdonlan
- */
-public class HaverClient {
-
- private Object lock = new Object();
- static final int ST_IDLE = 0; // Not connected, not connecting
- static final int ST_CONN = 1; // Connecting
- static final int ST_HELO = 2; // Protocol handshake
- static final int ST_IDENT = 3; // C: IDENT sent
- static final int ST_READY = 10; // Ready for action
-
- public static final String version = "Javer/0.03";
-
- Set clients = new HashSet();
-
- int state = ST_IDLE;
- Writer current_writer = null;
-
- IOException ex = null;
-
- String uid = null; // XXX?
-
- /* We don't have a 'disconnecting' state - the writer thread handles that.
- * We just send the appropriate message down and reset the appropriate
- * variables. Disconnect errors are handled by the reader thread.
- *
- * If an exception occurs in the writer, set ex to that exception, and
close
- * the socket. The reader will pick up and dispatch the exception.
- *
- * Note that the writer is responsible for spawning the reader. If an
- * exception occurs early, it must dispatch it on its own.
- */
-
- private class Reader implements Runnable {
- Socket _s;
-
- public void run() {
- IOException e_ = null;
- try {
- BufferedReader r =
- new BufferedReader(
- new InputStreamReader(
- _s.getInputStream()
- ));
- while (true) {
- String line = r.readLine();
- if (line == null)
- return;
- handleLine(line);
- }
- } catch (IOException e) {
- e_ = e;
- } finally {
- synchronized(lock) {
- if (e_ == null)
- e_ = ex;
- ex = null;
- dispatch(new ExceptionDisconnect(e_));
- if (current_writer != null)
- current_writer.close();
- current_writer = null;
- state = ST_IDLE;
- return;
- }
- }
- }
-
- Reader(Socket s) {
- _s = s;
- }
- }
-
- private class Writer implements Runnable {
- private class WM_Line {
- String s;
- WM_Line(String _s) { s = _s; }
- }
-
- private class WM_EOF {}
-
- private java.net.Socket s;
- private String host;
- private int port;
-
- private ObjectQueue q = new ObjectQueue();
-
- public void run() {
- assert state == ST_CONN && current_writer == this;
- ex = null;
- try {
- if (s == null) {
- s = new Socket(host, port);
- }
- host = null;
-
- new Thread(new Reader(s)).start();
- }
- catch (IOException e) {
- dispatch(new ConnectIOException(e));
- synchronized (lock) { state = ST_IDLE; }
- return;
- }
- try {
- synchronized (lock) {
- state = ST_HELO;
- }
- OutputStreamWriter osw = new OutputStreamWriter(
- s.getOutputStream());
- PrintWriter w = new PrintWriter(
- new BufferedWriter(osw)
- );
-
- println("HAVER\t" + version);
-
- while (true) {
- Object o;
- try {
- o = q.block();
- } catch (InterruptedException e) {
- continue;
- }
- if (o instanceof WM_Line) {
- String l = ((WM_Line)o).s;
- System.out.println("C: " + l);
- w.println(l);
- if (!q.hasData())
- w.flush();
- } else if (o instanceof WM_EOF) {
- synchronized(lock) {
- ex = null;
- w.close();
- try { s.close(); } catch (IOException e) { }
- current_writer = null;
- return;
- }
- }
- }
- } catch(IOException e) {
- synchronized (lock) {
- if (current_writer != this) { return; }
- ex = e;
- try { s.close(); } catch (Throwable t) {}
- }
- }
- }
-
- Writer(String h, int p) {
- host = h;
- port = p;
- s = null;
- }
-
- Writer(Socket _s) {
- s = _s;
- }
-
- void println(String ln) {
- q.post(new WM_Line(ln));
- }
-
- void close() {
- q.post(new WM_EOF());
- }
- }
-
- public void connect(String host, int port, String uid) {
- synchronized (lock) {
- if (state != ST_IDLE)
- throw new IllegalStateException("Already connected or
connecting");
- state = ST_CONN;
- assert current_writer == null;
- current_writer = new Writer(host, port);
- new Thread(current_writer).start();
- this.uid = uid;
- }
- }
-
- static String[] decodeLine(String line) {
- int ptr = 0;
- Vector v = new Vector();
-
- while (true) {
- int next = line.indexOf("\t", ptr);
- if (next == -1)
- break;
- v.add(line.substring(ptr, next));
- ptr = next + 1;
- }
- v.add(line.substring(ptr));
-
- String a[] = new String[v.size()];
- Iterator i = v.iterator();
- int j = 0;
- while (i.hasNext())
- a[j++] = (String)i.next();
- return a;
- }
-
- static String encodeLine(String[] line) {
- StringBuffer buf = new StringBuffer();
-
- for (int i = 0; i < line.length; i++) {
- if (i != 0)
- buf.append('\t');
- buf.append(line[i]);
- }
-
- return buf.toString();
- }
-
-
- /** Creates a new instance of HaverClient */
- public HaverClient() {
- }
-
- void dispatch(Message m) {
- synchronized (clients) {
- Iterator i = clients.iterator();
- while (i.hasNext()) {
- Receiver r = (Receiver)i.next();
- try {
- r.dispatchMessage(m);
- } catch (Throwable t) {
- t.printStackTrace();
- }
- }
- }
- }
-
- public void register(Receiver r) {
- synchronized(clients) {
- clients.add(r);
- }
- }
-
- public void unregister(Receiver r) {
- synchronized (clients) {
- clients.remove(r);
- }
- }
-
- void handleLine(String s) {
- System.out.println("S: " + s);
-
- String[] bits = decodeLine(s);
-
- /*
- * Flattering child you shall know me,
- * see why in shadow I hide.
- * Look at your face in the mirror,
- * I am there inside!
- */
- String meth = bits[0].toUpperCase() + "_handler";
- Class[] args = { String[].class };
-
- try {
- Method m = this.getClass().getDeclaredMethod(meth, args);
- m.invoke(this, new Object[] { bits });
- } catch (NoSuchMethodException e) {}
- catch (SecurityException e) {
- System.err.println("Security exception while reflecting,
shouldn't happen");
- e.printStackTrace();
- }
- catch (IllegalAccessException e) {
- System.err.println("Access exception while reflecting, shouldn't
happen");
- e.printStackTrace();
- }
- catch (IllegalArgumentException e) {
- System.err.println("Argument exception while reflecting,
shouldn't happen");
- e.printStackTrace();
- }
- catch (InvocationTargetException ie) {
- ie.getTargetException().printStackTrace();
- }
- catch (Throwable t) {
- System.err.println("WTF, some other kind of exception while
reflecting:");
- t.printStackTrace();
- }
- }
-
- void sendLine(String[] args) {
- if (current_writer == null) {
- new Exception("Warn: sendLine with null writer").printStackTrace();
- return;
- }
- current_writer.println(encodeLine(args));
- }
-
- void HAVER_handler(String[] args) {
- synchronized (lock) {
- // XXX what if this fails
- sendLine(new String[] { "IDENT", uid });
- state = ST_IDENT;
- }
- }
-
- void HELLO_handler(String[] args) {
- synchronized (lock) {
- state = ST_READY;
- }
- dispatch(new ConnectMessage());
- }
-
- void JOIN_handler(String[] args) {
- String chan = args[1];
- String who = args[2];
- boolean me = who.equals(uid);
-
- dispatch(new JoinedChannel(who, chan, me));
- }
-
- public void join(String channel) {
- sendLine(new String[] { "JOIN", channel });
- }
-
- void PART_handler(String[] args) {
- String chan = args[1];
- String who = args[2];
- boolean me = who.equals(uid);
-
- dispatch(new PartedChannel(who, chan, me));
- }
-
- public void part(String channel) {
- sendLine(new String[] { "PART", channel });
- }
-
- void PING_handler(String[] args) {
- String[] response = { "PONG", args[1] };
- sendLine(response);
- }
-
- void IN_handler(String[] args) {
- String channel = args[1];
- String sender = args[2];
- String[] mesg = new String[args.length - 3];
- System.arraycopy(mesg, 0, args, 3, args.length - 3);
-
- dispatch(new PublicChat(sender, channel, mesg));
- }
-
- void FROM_handler(String[] args) {
- String sender = args[1];
- String[] mesg = new String[args.length - 2];
- System.arraycopy(mesg, 0, args, 2, args.length - 2);
-
- dispatch(new PrivateChat(sender, mesg));
- }
-
- public void sendPublicMessage(String destination, String[] args) {
- String[] mesg = new String[args.length + 2];
- mesg[0] = "IN";
- mesg[1] = destination;
- System.arraycopy(mesg, 2, args, 0, args.length);
- sendLine(mesg);
- }
-
- public void sendPrivateMessage(String destination, String[] args) {
- String[] mesg = new String[args.length + 2];
- mesg[0] = "TO";
- mesg[1] = destination;
- System.arraycopy(mesg, 2, args, 0, args.length);
- sendLine(mesg);
- }
-}
Modified: trunk/clients/javer3/Javer3/src/javer3/Main.java
===================================================================
--- trunk/clients/javer3/Javer3/src/javer3/Main.java 2005-11-14 22:01:32 UTC
(rev 921)
+++ trunk/clients/javer3/Javer3/src/javer3/Main.java 2005-11-15 00:37:48 UTC
(rev 922)
@@ -10,7 +10,8 @@
package javer3;
-import javer3.message.*;
+import javer3.client.message.*;
+import javer3.client.*;
/**
*
Deleted: trunk/clients/javer3/Javer3/src/javer3/ObjectQueue.java
===================================================================
--- trunk/clients/javer3/Javer3/src/javer3/ObjectQueue.java 2005-11-14
22:01:32 UTC (rev 921)
+++ trunk/clients/javer3/Javer3/src/javer3/ObjectQueue.java 2005-11-15
00:37:48 UTC (rev 922)
@@ -1,59 +0,0 @@
-/*
- * ObjectQueue.java
- *
- * Created on May 27, 2005, 3:03 PM
- */
-
-package javer3;
-import java.util.*;
-
-/**
- *
- * @author bdonlan
- */
-public class ObjectQueue {
- LinkedList theQueue = new LinkedList();
-
- /** Creates a new instance of ObjectQueue */
- public ObjectQueue() {
- }
-
- public Object block(long millis) throws InterruptedException {
- synchronized (theQueue) {
- if (theQueue.isEmpty()) {
- theQueue.wait(millis);
- }
- if (theQueue.isEmpty()) {
- System.err.println("ObjectQueue: Awakened with nothing to show
for it...");
- return null;
- }
- Object o = theQueue.removeFirst();
- return o;
- }
- }
-
- public Object block() throws InterruptedException {
- return block(0);
- }
-
- public boolean hasData() {
- synchronized (theQueue) {
- return !theQueue.isEmpty();
- }
- }
-
- public Object poll() {
- synchronized (theQueue) {
- if (theQueue.isEmpty())
- return null;
- return theQueue.removeFirst();
- }
- }
-
- public void post(Object o) {
- synchronized (theQueue) {
- theQueue.addLast(o);
- theQueue.notify();
- }
- }
-}
Deleted: trunk/clients/javer3/Javer3/src/javer3/Receiver.java
===================================================================
--- trunk/clients/javer3/Javer3/src/javer3/Receiver.java 2005-11-14
22:01:32 UTC (rev 921)
+++ trunk/clients/javer3/Javer3/src/javer3/Receiver.java 2005-11-15
00:37:48 UTC (rev 922)
@@ -1,21 +0,0 @@
-/*
- * Receiver.java
- *
- * Created on November 14, 2005, 12:21 AM
- *
- * To change this template, choose Tools | Options and locate the template
under
- * the Source Creation and Management node. Right-click the template and choose
- * Open. You can then make changes to the template in the Source Editor.
- */
-
-package javer3;
-
-import javer3.message.Message;
-
-/**
- *
- * @author bdonlan
- */
-public interface Receiver {
- public void dispatchMessage(Message m);
-}
Copied: trunk/clients/javer3/Javer3/src/javer3/client/HaverClient.java (from
rev 921, trunk/clients/javer3/Javer3/src/javer3/HaverClient.java)
===================================================================
--- trunk/clients/javer3/Javer3/src/javer3/HaverClient.java 2005-11-14
22:01:32 UTC (rev 921)
+++ trunk/clients/javer3/Javer3/src/javer3/client/HaverClient.java
2005-11-15 00:37:48 UTC (rev 922)
@@ -0,0 +1,384 @@
+/*
+ * HaverClient.java
+ *
+ * Created on November 13, 2005, 11:31 PM
+ *
+ * To change this template, choose Tools | Options and locate the template
under
+ * the Source Creation and Management node. Right-click the template and choose
+ * Open. You can then make changes to the template in the Source Editor.
+ */
+
+package javer3;
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import java.lang.reflect.*;
+import javer3.client.message.*;
+
+/**
+ *
+ * @author bdonlan
+ */
+public class HaverClient {
+
+ private Object lock = new Object();
+ static final int ST_IDLE = 0; // Not connected, not connecting
+ static final int ST_CONN = 1; // Connecting
+ static final int ST_HELO = 2; // Protocol handshake
+ static final int ST_IDENT = 3; // C: IDENT sent
+ static final int ST_READY = 10; // Ready for action
+
+ public static final String version = "Javer/0.03";
+
+ Set clients = new HashSet();
+
+ int state = ST_IDLE;
+ Writer current_writer = null;
+
+ IOException ex = null;
+
+ String uid = null; // XXX?
+
+ /* We don't have a 'disconnecting' state - the writer thread handles that.
+ * We just send the appropriate message down and reset the appropriate
+ * variables. Disconnect errors are handled by the reader thread.
+ *
+ * If an exception occurs in the writer, set ex to that exception, and
close
+ * the socket. The reader will pick up and dispatch the exception.
+ *
+ * Note that the writer is responsible for spawning the reader. If an
+ * exception occurs early, it must dispatch it on its own.
+ */
+
+ private class Reader implements Runnable {
+ Socket _s;
+
+ public void run() {
+ IOException e_ = null;
+ try {
+ BufferedReader r =
+ new BufferedReader(
+ new InputStreamReader(
+ _s.getInputStream()
+ ));
+ while (true) {
+ String line = r.readLine();
+ if (line == null)
+ return;
+ handleLine(line);
+ }
+ } catch (IOException e) {
+ e_ = e;
+ } finally {
+ synchronized(lock) {
+ if (e_ == null)
+ e_ = ex;
+ ex = null;
+ dispatch(new ExceptionDisconnect(e_));
+ if (current_writer != null)
+ current_writer.close();
+ current_writer = null;
+ state = ST_IDLE;
+ return;
+ }
+ }
+ }
+
+ Reader(Socket s) {
+ _s = s;
+ }
+ }
+
+ private class Writer implements Runnable {
+ private class WM_Line {
+ String s;
+ WM_Line(String _s) { s = _s; }
+ }
+
+ private class WM_EOF {}
+
+ private java.net.Socket s;
+ private String host;
+ private int port;
+
+ private ObjectQueue q = new ObjectQueue();
+
+ public void run() {
+ assert state == ST_CONN && current_writer == this;
+ ex = null;
+ try {
+ if (s == null) {
+ s = new Socket(host, port);
+ }
+ host = null;
+
+ new Thread(new Reader(s)).start();
+ }
+ catch (IOException e) {
+ dispatch(new ConnectIOException(e));
+ synchronized (lock) { state = ST_IDLE; }
+ return;
+ }
+ try {
+ synchronized (lock) {
+ state = ST_HELO;
+ }
+ OutputStreamWriter osw = new OutputStreamWriter(
+ s.getOutputStream());
+ PrintWriter w = new PrintWriter(
+ new BufferedWriter(osw)
+ );
+
+ println("HAVER\t" + version);
+
+ while (true) {
+ Object o;
+ try {
+ o = q.block();
+ } catch (InterruptedException e) {
+ continue;
+ }
+ if (o instanceof WM_Line) {
+ String l = ((WM_Line)o).s;
+ System.out.println("C: " + l);
+ w.println(l);
+ if (!q.hasData())
+ w.flush();
+ } else if (o instanceof WM_EOF) {
+ synchronized(lock) {
+ ex = null;
+ w.close();
+ try { s.close(); } catch (IOException e) { }
+ current_writer = null;
+ return;
+ }
+ }
+ }
+ } catch(IOException e) {
+ synchronized (lock) {
+ if (current_writer != this) { return; }
+ ex = e;
+ try { s.close(); } catch (Throwable t) {}
+ }
+ }
+ }
+
+ Writer(String h, int p) {
+ host = h;
+ port = p;
+ s = null;
+ }
+
+ Writer(Socket _s) {
+ s = _s;
+ }
+
+ void println(String ln) {
+ q.post(new WM_Line(ln));
+ }
+
+ void close() {
+ q.post(new WM_EOF());
+ }
+ }
+
+ public void connect(String host, int port, String uid) {
+ synchronized (lock) {
+ if (state != ST_IDLE)
+ throw new IllegalStateException("Already connected or
connecting");
+ state = ST_CONN;
+ assert current_writer == null;
+ current_writer = new Writer(host, port);
+ new Thread(current_writer).start();
+ this.uid = uid;
+ }
+ }
+
+ static String[] decodeLine(String line) {
+ int ptr = 0;
+ Vector v = new Vector();
+
+ while (true) {
+ int next = line.indexOf("\t", ptr);
+ if (next == -1)
+ break;
+ v.add(line.substring(ptr, next));
+ ptr = next + 1;
+ }
+ v.add(line.substring(ptr));
+
+ String a[] = new String[v.size()];
+ Iterator i = v.iterator();
+ int j = 0;
+ while (i.hasNext())
+ a[j++] = (String)i.next();
+ return a;
+ }
+
+ static String encodeLine(String[] line) {
+ StringBuffer buf = new StringBuffer();
+
+ for (int i = 0; i < line.length; i++) {
+ if (i != 0)
+ buf.append('\t');
+ buf.append(line[i]);
+ }
+
+ return buf.toString();
+ }
+
+
+ /** Creates a new instance of HaverClient */
+ public HaverClient() {
+ }
+
+ void dispatch(Message m) {
+ synchronized (clients) {
+ Iterator i = clients.iterator();
+ while (i.hasNext()) {
+ Receiver r = (Receiver)i.next();
+ try {
+ r.dispatchMessage(m);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+ }
+ }
+
+ public void register(Receiver r) {
+ synchronized(clients) {
+ clients.add(r);
+ }
+ }
+
+ public void unregister(Receiver r) {
+ synchronized (clients) {
+ clients.remove(r);
+ }
+ }
+
+ void handleLine(String s) {
+ System.out.println("S: " + s);
+
+ String[] bits = decodeLine(s);
+
+ /*
+ * Flattering child you shall know me,
+ * see why in shadow I hide.
+ * Look at your face in the mirror,
+ * I am there inside!
+ */
+ String meth = bits[0].toUpperCase() + "_handler";
+ Class[] args = { String[].class };
+
+ try {
+ Method m = this.getClass().getDeclaredMethod(meth, args);
+ m.invoke(this, new Object[] { bits });
+ } catch (NoSuchMethodException e) {}
+ catch (SecurityException e) {
+ System.err.println("Security exception while reflecting,
shouldn't happen");
+ e.printStackTrace();
+ }
+ catch (IllegalAccessException e) {
+ System.err.println("Access exception while reflecting, shouldn't
happen");
+ e.printStackTrace();
+ }
+ catch (IllegalArgumentException e) {
+ System.err.println("Argument exception while reflecting,
shouldn't happen");
+ e.printStackTrace();
+ }
+ catch (InvocationTargetException ie) {
+ ie.getTargetException().printStackTrace();
+ }
+ catch (Throwable t) {
+ System.err.println("WTF, some other kind of exception while
reflecting:");
+ t.printStackTrace();
+ }
+ }
+
+ void sendLine(String[] args) {
+ if (current_writer == null) {
+ new Exception("Warn: sendLine with null writer").printStackTrace();
+ return;
+ }
+ current_writer.println(encodeLine(args));
+ }
+
+ void HAVER_handler(String[] args) {
+ synchronized (lock) {
+ // XXX what if this fails
+ sendLine(new String[] { "IDENT", uid });
+ state = ST_IDENT;
+ }
+ }
+
+ void HELLO_handler(String[] args) {
+ synchronized (lock) {
+ state = ST_READY;
+ }
+ dispatch(new ConnectMessage());
+ }
+
+ void JOIN_handler(String[] args) {
+ String chan = args[1];
+ String who = args[2];
+ boolean me = who.equals(uid);
+
+ dispatch(new JoinedChannel(who, chan, me));
+ }
+
+ public void join(String channel) {
+ sendLine(new String[] { "JOIN", channel });
+ }
+
+ void PART_handler(String[] args) {
+ String chan = args[1];
+ String who = args[2];
+ boolean me = who.equals(uid);
+
+ dispatch(new PartedChannel(who, chan, me));
+ }
+
+ public void part(String channel) {
+ sendLine(new String[] { "PART", channel });
+ }
+
+ void PING_handler(String[] args) {
+ String[] response = { "PONG", args[1] };
+ sendLine(response);
+ }
+
+ void IN_handler(String[] args) {
+ String channel = args[1];
+ String sender = args[2];
+ String[] mesg = new String[args.length - 3];
+ System.arraycopy(mesg, 0, args, 3, args.length - 3);
+
+ dispatch(new PublicChat(sender, channel, mesg));
+ }
+
+ void FROM_handler(String[] args) {
+ String sender = args[1];
+ String[] mesg = new String[args.length - 2];
+ System.arraycopy(mesg, 0, args, 2, args.length - 2);
+
+ dispatch(new PrivateChat(sender, mesg));
+ }
+
+ public void sendPublicMessage(String destination, String[] args) {
+ String[] mesg = new String[args.length + 2];
+ mesg[0] = "IN";
+ mesg[1] = destination;
+ System.arraycopy(mesg, 2, args, 0, args.length);
+ sendLine(mesg);
+ }
+
+ public void sendPrivateMessage(String destination, String[] args) {
+ String[] mesg = new String[args.length + 2];
+ mesg[0] = "TO";
+ mesg[1] = destination;
+ System.arraycopy(mesg, 2, args, 0, args.length);
+ sendLine(mesg);
+ }
+}
Copied: trunk/clients/javer3/Javer3/src/javer3/client/ObjectQueue.java (from
rev 920, trunk/clients/javer3/Javer3/src/javer3/ObjectQueue.java)
Copied: trunk/clients/javer3/Javer3/src/javer3/client/Receiver.java (from rev
921, trunk/clients/javer3/Javer3/src/javer3/Receiver.java)
===================================================================
--- trunk/clients/javer3/Javer3/src/javer3/Receiver.java 2005-11-14
22:01:32 UTC (rev 921)
+++ trunk/clients/javer3/Javer3/src/javer3/client/Receiver.java 2005-11-15
00:37:48 UTC (rev 922)
@@ -0,0 +1,21 @@
+/*
+ * Receiver.java
+ *
+ * Created on November 14, 2005, 12:21 AM
+ *
+ * To change this template, choose Tools | Options and locate the template
under
+ * the Source Creation and Management node. Right-click the template and choose
+ * Open. You can then make changes to the template in the Source Editor.
+ */
+
+package javer3;
+
+import javer3.client.message.Message;
+
+/**
+ *
+ * @author bdonlan
+ */
+public interface Receiver {
+ public void dispatchMessage(Message m);
+}
Copied: trunk/clients/javer3/Javer3/src/javer3/client/message (from rev 921,
trunk/clients/javer3/Javer3/src/javer3/message)
Modified:
trunk/clients/javer3/Javer3/src/javer3/client/message/ConnectFailed.java
===================================================================
--- trunk/clients/javer3/Javer3/src/javer3/message/ConnectFailed.java
2005-11-14 22:01:32 UTC (rev 921)
+++ trunk/clients/javer3/Javer3/src/javer3/client/message/ConnectFailed.java
2005-11-15 00:37:48 UTC (rev 922)
@@ -1,6 +1,6 @@
-package javer3.message;
-import javer3.*;
+package javer3.client.message;
+import javer3.client.*;
public class ConnectFailed extends Message {
}
Modified:
trunk/clients/javer3/Javer3/src/javer3/client/message/ConnectIOException.java
===================================================================
--- trunk/clients/javer3/Javer3/src/javer3/message/ConnectIOException.java
2005-11-14 22:01:32 UTC (rev 921)
+++
trunk/clients/javer3/Javer3/src/javer3/client/message/ConnectIOException.java
2005-11-15 00:37:48 UTC (rev 922)
@@ -1,6 +1,6 @@
-package javer3.message;
-import javer3.*;
+package javer3.client.message;
+import javer3.client.*;
import java.io.IOException;
public class ConnectIOException extends ConnectFailed {
Modified:
trunk/clients/javer3/Javer3/src/javer3/client/message/ConnectMessage.java
===================================================================
--- trunk/clients/javer3/Javer3/src/javer3/message/ConnectMessage.java
2005-11-14 22:01:32 UTC (rev 921)
+++ trunk/clients/javer3/Javer3/src/javer3/client/message/ConnectMessage.java
2005-11-15 00:37:48 UTC (rev 922)
@@ -1,6 +1,6 @@
-package javer3.message;
-import javer3.*;
+package javer3.client.message;
+import javer3.client.*;
public class ConnectMessage extends Message {
}
\ No newline at end of file
Modified:
trunk/clients/javer3/Javer3/src/javer3/client/message/ConnectRejected.java
===================================================================
--- trunk/clients/javer3/Javer3/src/javer3/message/ConnectRejected.java
2005-11-14 22:01:32 UTC (rev 921)
+++ trunk/clients/javer3/Javer3/src/javer3/client/message/ConnectRejected.java
2005-11-15 00:37:48 UTC (rev 922)
@@ -1,6 +1,6 @@
-package javer3.message;
-import javer3.*;
+package javer3.client.message;
+import javer3.client.*;
public class ConnectRejected extends ConnectFailed {
private String _type;
Modified:
trunk/clients/javer3/Javer3/src/javer3/client/message/DisconnectMessage.java
===================================================================
--- trunk/clients/javer3/Javer3/src/javer3/message/DisconnectMessage.java
2005-11-14 22:01:32 UTC (rev 921)
+++
trunk/clients/javer3/Javer3/src/javer3/client/message/DisconnectMessage.java
2005-11-15 00:37:48 UTC (rev 922)
@@ -1,6 +1,6 @@
-package javer3.message;
-import javer3.*;
+package javer3.client.message;
+import javer3.client.*;
public class DisconnectMessage extends Message {
}
Modified:
trunk/clients/javer3/Javer3/src/javer3/client/message/ExceptionDisconnect.java
===================================================================
--- trunk/clients/javer3/Javer3/src/javer3/message/ExceptionDisconnect.java
2005-11-14 22:01:32 UTC (rev 921)
+++
trunk/clients/javer3/Javer3/src/javer3/client/message/ExceptionDisconnect.java
2005-11-15 00:37:48 UTC (rev 922)
@@ -1,6 +1,6 @@
-package javer3.message;
-import javer3.*;
+package javer3.client.message;
+import javer3.client.*;
import java.io.IOException;
public class ExceptionDisconnect extends DisconnectMessage {
Modified:
trunk/clients/javer3/Javer3/src/javer3/client/message/GracefulDisconnect.java
===================================================================
--- trunk/clients/javer3/Javer3/src/javer3/message/GracefulDisconnect.java
2005-11-14 22:01:32 UTC (rev 921)
+++
trunk/clients/javer3/Javer3/src/javer3/client/message/GracefulDisconnect.java
2005-11-15 00:37:48 UTC (rev 922)
@@ -1,6 +1,6 @@
-package javer3.message;
-import javer3.*;
+package javer3.client.message;
+import javer3.client.*;
public class GracefulDisconnect extends DisconnectMessage {
}
Modified:
trunk/clients/javer3/Javer3/src/javer3/client/message/JoinedChannel.java
===================================================================
--- trunk/clients/javer3/Javer3/src/javer3/message/JoinedChannel.java
2005-11-14 22:01:32 UTC (rev 921)
+++ trunk/clients/javer3/Javer3/src/javer3/client/message/JoinedChannel.java
2005-11-15 00:37:48 UTC (rev 922)
@@ -1,5 +1,5 @@
-package javer3.message;
-import javer3.*;
+package javer3.client.message;
+import javer3.client.*;
public class JoinedChannel extends Message {
String who, where;
Modified: trunk/clients/javer3/Javer3/src/javer3/client/message/Message.java
===================================================================
--- trunk/clients/javer3/Javer3/src/javer3/message/Message.java 2005-11-14
22:01:32 UTC (rev 921)
+++ trunk/clients/javer3/Javer3/src/javer3/client/message/Message.java
2005-11-15 00:37:48 UTC (rev 922)
@@ -8,9 +8,9 @@
* Open. You can then make changes to the template in the Source Editor.
*/
-package javer3.message;
+package javer3.client.message;
import java.io.IOException;
-import javer3.*;
+import javer3.client.*;
/**
*
Modified:
trunk/clients/javer3/Javer3/src/javer3/client/message/PartedChannel.java
===================================================================
--- trunk/clients/javer3/Javer3/src/javer3/message/PartedChannel.java
2005-11-14 22:01:32 UTC (rev 921)
+++ trunk/clients/javer3/Javer3/src/javer3/client/message/PartedChannel.java
2005-11-15 00:37:48 UTC (rev 922)
@@ -1,5 +1,5 @@
-package javer3.message;
-import javer3.*;
+package javer3.client.message;
+import javer3.client.*;
public class PartedChannel extends Message {
String who, where;
Modified: trunk/clients/javer3/Javer3/src/javer3/client/message/PrivateChat.java
===================================================================
--- trunk/clients/javer3/Javer3/src/javer3/message/PrivateChat.java
2005-11-14 22:01:32 UTC (rev 921)
+++ trunk/clients/javer3/Javer3/src/javer3/client/message/PrivateChat.java
2005-11-15 00:37:48 UTC (rev 922)
@@ -1,5 +1,5 @@
-package javer3.message;
-import javer3.*;
+package javer3.client.message;
+import javer3.client.*;
public class PrivateChat extends Message {
String who;
Modified: trunk/clients/javer3/Javer3/src/javer3/client/message/PublicChat.java
===================================================================
--- trunk/clients/javer3/Javer3/src/javer3/message/PublicChat.java
2005-11-14 22:01:32 UTC (rev 921)
+++ trunk/clients/javer3/Javer3/src/javer3/client/message/PublicChat.java
2005-11-15 00:37:48 UTC (rev 922)
@@ -1,5 +1,5 @@
-package javer3.message;
-import javer3.*;
+package javer3.client.message;
+import javer3.client.*;
public class PublicChat extends Message {
String who, where;
Modified:
trunk/clients/javer3/Javer3/src/javer3/client/message/ServerDisconnect.java
===================================================================
--- trunk/clients/javer3/Javer3/src/javer3/message/ServerDisconnect.java
2005-11-14 22:01:32 UTC (rev 921)
+++ trunk/clients/javer3/Javer3/src/javer3/client/message/ServerDisconnect.java
2005-11-15 00:37:48 UTC (rev 922)
@@ -1,6 +1,6 @@
-package javer3.message;
-import javer3.*;
+package javer3.client.message;
+import javer3.client.*;
public class ServerDisconnect extends DisconnectMessage {
private String _type, _detail;