Implement remaining client commands, organize into packages
This commit is contained in:
		
					parent
					
						
							
								2e40faff34
							
						
					
				
			
			
				commit
				
					
						d73fb78686
					
				
			
		
					 49 changed files with 515 additions and 47 deletions
				
			
		
							
								
								
									
										13
									
								
								TODO.md
									
										
									
									
									
								
							
							
						
						
									
										13
									
								
								TODO.md
									
										
									
									
									
								
							|  | @ -3,13 +3,12 @@ | ||||||
| ## Client commands | ## Client commands | ||||||
| 
 | 
 | ||||||
| - [x] toc_chat_join | - [x] toc_chat_join | ||||||
| - [ ] toc_chat_send | - [x] toc_chat_send | ||||||
| - [ ] toc_chat_whisper | - [x] toc_chat_whisper | ||||||
| - [ ] toc_chat_whisper | - [x] toc_chat_evil | ||||||
| - [ ] toc_chat_evil | - [x] toc_chat_invite | ||||||
| - [ ] toc_chat_invite | - [x] toc_chat_leave | ||||||
| - [ ] toc_chat_leave | - [x] toc_chat_accept | ||||||
| - [ ] toc_chat_accept |  | ||||||
| 
 | 
 | ||||||
| ## Server commands | ## Server commands | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -25,6 +25,10 @@ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim; | ||||||
| 
 | 
 | ||||||
|  | import com.wilko.jaim.commands.*; | ||||||
|  | import com.wilko.jaim.flap.*; | ||||||
|  | import com.wilko.jaim.responses.*; | ||||||
|  | 
 | ||||||
| import java.io.IOException; | import java.io.IOException; | ||||||
| import java.io.InputStream; | import java.io.InputStream; | ||||||
| import java.io.InterruptedIOException; | import java.io.InterruptedIOException; | ||||||
|  | @ -504,6 +508,100 @@ public class JaimConnection implements java.lang.Runnable { | ||||||
| 
 | 
 | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Sends a whisper to a user in a chat room | ||||||
|  |      * @param roomID     The ID of the room | ||||||
|  |      * @param screenname The screenname to whisper to | ||||||
|  |      * @param message    The message | ||||||
|  |      */ | ||||||
|  |     public void sentChatWhisper(String roomID, String screenname, String message) { | ||||||
|  |         try { | ||||||
|  |             TocChatWhisperCommand whisperCommand = new TocChatWhisperCommand(roomID, screenname, message); | ||||||
|  |             sendTocCommand(whisperCommand); | ||||||
|  |         } catch (IOException ignore) { | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Accept a chat invite | ||||||
|  |      * @param roomID The ID of the room | ||||||
|  |      */ | ||||||
|  | 
 | ||||||
|  |     public void acceptChat(String roomID) { | ||||||
|  |         try { | ||||||
|  |             TocChatAcceptCommand acceptCommand = new TocChatAcceptCommand(roomID); | ||||||
|  |             sendTocCommand(acceptCommand); | ||||||
|  |         } catch (IOException ignore) { | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Evil/warn someone inside a chat room | ||||||
|  |      * @param roomID    The ID of the room | ||||||
|  |      * @param screenname  The screenname to evil/warn | ||||||
|  |      * @param anonymous Stay anonymous? | ||||||
|  |      */ | ||||||
|  |     public void sendChatEvil(String roomID, String screenname, Boolean anonymous) { | ||||||
|  |         try { | ||||||
|  |             TocChatEvilCommand evilCommand = new TocChatEvilCommand(roomID, screenname, anonymous); | ||||||
|  |             sendTocCommand(evilCommand); | ||||||
|  |         } catch (IOException ignore) { | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Evil/warn someone inside a chat room | ||||||
|  |      * @param roomID    The ID of the room | ||||||
|  |      * @param screenname  The screenname to evil/warn | ||||||
|  |      */ | ||||||
|  |     public void sendChatEvil(String roomID, String screenname) { | ||||||
|  |         sendChatEvil(roomID, screenname, false); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Send an invitation to a chat room | ||||||
|  |      * @param roomID  The ID of the room | ||||||
|  |      * @param message The message to be sent with the invite | ||||||
|  |      * @param buddies An array of screennames to invite | ||||||
|  |      */ | ||||||
|  |     public void sendChatInvite(String roomID, String message, String[] buddies) { | ||||||
|  |         try { | ||||||
|  |             TocChatInviteCommand inviteCommand = new TocChatInviteCommand(roomID, message, buddies); | ||||||
|  |             sendTocCommand(inviteCommand); | ||||||
|  |         } catch (IOException ignore) { | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Send a message in a chat room | ||||||
|  |      * @param roomID  The ID of the room | ||||||
|  |      * @param message The message to send | ||||||
|  |      */ | ||||||
|  |     public void sendChatMessage(String roomID, String message) { | ||||||
|  |         try { | ||||||
|  |             TocChatSendCommand sendCommand = new TocChatSendCommand(roomID, message); | ||||||
|  |             sendTocCommand(sendCommand); | ||||||
|  |         } catch (IOException ignore) { | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Leave a chat room | ||||||
|  |      * @param roomID The ID of the room | ||||||
|  |      */ | ||||||
|  |     public void leaveChat(String roomID) { | ||||||
|  |         try { | ||||||
|  |             TocChatLeaveCommand leaveCommand = new TocChatLeaveCommand(roomID); | ||||||
|  |             sendTocCommand(leaveCommand); | ||||||
|  |         } catch (IOException ignore) { | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Join a chat room | ||||||
|  |      * @param exchange The exchange to use | ||||||
|  |      * @param roomName The name of the room | ||||||
|  |      */ | ||||||
|     public void joinChat(int exchange, String roomName) { |     public void joinChat(int exchange, String roomName) { | ||||||
|         try { |         try { | ||||||
|             TocChatJoinCommand joinCommand = new TocChatJoinCommand(exchange, roomName); |             TocChatJoinCommand joinCommand = new TocChatJoinCommand(exchange, roomName); | ||||||
|  | @ -512,6 +610,10 @@ public class JaimConnection implements java.lang.Runnable { | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Join a chat room | ||||||
|  |      * @param roomName The name of the room | ||||||
|  |      */ | ||||||
|     public void joinChat(String roomName) { |     public void joinChat(String roomName) { | ||||||
|         joinChat(4, roomName); |         joinChat(4, roomName); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -19,6 +19,8 @@ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim; | ||||||
| 
 | 
 | ||||||
|  | import com.wilko.jaim.responses.TocResponse; | ||||||
|  | 
 | ||||||
| /** | /** | ||||||
|  * The JaimEvent object is delivered to all registered {@link JaimEventListener} |  * The JaimEvent object is delivered to all registered {@link JaimEventListener} | ||||||
|  * |  * | ||||||
|  |  | ||||||
|  | @ -25,6 +25,8 @@ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim; | ||||||
| 
 | 
 | ||||||
|  | import com.wilko.jaim.responses.TocResponse; | ||||||
|  | 
 | ||||||
| /** | /** | ||||||
|  * A JaimEventListener receives JaimEvents from the JaimConnection class. |  * A JaimEventListener receives JaimEvents from the JaimConnection class. | ||||||
|  * A {@link JaimEvent} contains a {@link TocResponse} object. |  * A {@link JaimEvent} contains a {@link TocResponse} object. | ||||||
|  |  | ||||||
|  | @ -23,7 +23,9 @@ | ||||||
|  * Created on 4 May 2002, 13:57 |  * Created on 4 May 2002, 13:57 | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.commands; | ||||||
|  | 
 | ||||||
|  | import com.wilko.jaim.Utils; | ||||||
| 
 | 
 | ||||||
| import java.util.Vector; | import java.util.Vector; | ||||||
| 
 | 
 | ||||||
|  | @ -23,7 +23,9 @@ | ||||||
|  * Created on 4 May 2002, 13:57 |  * Created on 4 May 2002, 13:57 | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.commands; | ||||||
|  | 
 | ||||||
|  | import com.wilko.jaim.Utils; | ||||||
| 
 | 
 | ||||||
| import java.util.Vector; | import java.util.Vector; | ||||||
| 
 | 
 | ||||||
|  | @ -23,7 +23,9 @@ | ||||||
|  * Created on 11 Oct 2002, 15:20 |  * Created on 11 Oct 2002, 15:20 | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.commands; | ||||||
|  | 
 | ||||||
|  | import com.wilko.jaim.Utils; | ||||||
| 
 | 
 | ||||||
| import java.util.Vector; | import java.util.Vector; | ||||||
| 
 | 
 | ||||||
							
								
								
									
										51
									
								
								src/com/wilko/jaim/commands/TocChatAcceptCommand.java
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								src/com/wilko/jaim/commands/TocChatAcceptCommand.java
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,51 @@ | ||||||
|  | /* | ||||||
|  |  *   (C) 2002 Paul Wilkinson  wilko@users.sourceforge.net | ||||||
|  |  * | ||||||
|  |  *   This program is free software; you can redistribute it and/or modify | ||||||
|  |  *   it under the terms of the GNU General Public License as published by | ||||||
|  |  *   the Free Software Foundation; either version 2 of the License, or | ||||||
|  |  *   (at your option) any later version. | ||||||
|  |  * | ||||||
|  |  *   This program is distributed in the hope that it will be useful, | ||||||
|  |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  |  *   GNU General Public License for more details. | ||||||
|  |  * | ||||||
|  |  *   You should have received a copy of the GNU General Public License | ||||||
|  |  *   along with this program; if not, write to the Free Software | ||||||
|  |  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA | ||||||
|  |  * | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | /* | ||||||
|  |  * TocIMCommand.java | ||||||
|  |  * | ||||||
|  |  * Created on 4 May 2002, 15:18 | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | package com.wilko.jaim.commands; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * @author paulw | ||||||
|  |  * @version $Revision: 1.4 $ | ||||||
|  |  */ | ||||||
|  | public class TocChatAcceptCommand extends TocCommand { | ||||||
|  | 
 | ||||||
|  |     private final String roomID; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Creates new TocIMCommand | ||||||
|  |      */ | ||||||
|  |     public TocChatAcceptCommand(String roomID) { | ||||||
|  |         this.roomID = roomID; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public String toString() { | ||||||
|  |         return ("toc_chat_accept " + roomID); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public byte[] getBytes() { | ||||||
|  |         return (this.toString().getBytes()); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | } | ||||||
							
								
								
									
										55
									
								
								src/com/wilko/jaim/commands/TocChatEvilCommand.java
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								src/com/wilko/jaim/commands/TocChatEvilCommand.java
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,55 @@ | ||||||
|  | /* | ||||||
|  |  *   (C) 2002 Paul Wilkinson  wilko@users.sourceforge.net | ||||||
|  |  * | ||||||
|  |  *   This program is free software; you can redistribute it and/or modify | ||||||
|  |  *   it under the terms of the GNU General Public License as published by | ||||||
|  |  *   the Free Software Foundation; either version 2 of the License, or | ||||||
|  |  *   (at your option) any later version. | ||||||
|  |  * | ||||||
|  |  *   This program is distributed in the hope that it will be useful, | ||||||
|  |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  |  *   GNU General Public License for more details. | ||||||
|  |  * | ||||||
|  |  *   You should have received a copy of the GNU General Public License | ||||||
|  |  *   along with this program; if not, write to the Free Software | ||||||
|  |  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA | ||||||
|  |  * | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | /* | ||||||
|  |  * TocIMCommand.java | ||||||
|  |  * | ||||||
|  |  * Created on 4 May 2002, 15:18 | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | package com.wilko.jaim.commands; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * @author paulw | ||||||
|  |  * @version $Revision: 1.4 $ | ||||||
|  |  */ | ||||||
|  | public class TocChatEvilCommand extends TocCommand { | ||||||
|  | 
 | ||||||
|  |     private final String roomID; | ||||||
|  |     private final String screenname; | ||||||
|  |     private final Boolean anonymous; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Creates new TocIMCommand | ||||||
|  |      */ | ||||||
|  |     public TocChatEvilCommand(String roomID, String screenname, Boolean anonymous) { | ||||||
|  |         this.roomID = roomID; | ||||||
|  |         this.screenname = screenname; | ||||||
|  |         this.anonymous = anonymous; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public String toString() { | ||||||
|  |         return ("toc_chat_evil " + roomID + " " + screenname + " " + (anonymous ? "anon" : "norm")); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public byte[] getBytes() { | ||||||
|  |         return (this.toString().getBytes()); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | } | ||||||
							
								
								
									
										55
									
								
								src/com/wilko/jaim/commands/TocChatInviteCommand.java
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								src/com/wilko/jaim/commands/TocChatInviteCommand.java
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,55 @@ | ||||||
|  | /* | ||||||
|  |  *   (C) 2002 Paul Wilkinson  wilko@users.sourceforge.net | ||||||
|  |  * | ||||||
|  |  *   This program is free software; you can redistribute it and/or modify | ||||||
|  |  *   it under the terms of the GNU General Public License as published by | ||||||
|  |  *   the Free Software Foundation; either version 2 of the License, or | ||||||
|  |  *   (at your option) any later version. | ||||||
|  |  * | ||||||
|  |  *   This program is distributed in the hope that it will be useful, | ||||||
|  |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  |  *   GNU General Public License for more details. | ||||||
|  |  * | ||||||
|  |  *   You should have received a copy of the GNU General Public License | ||||||
|  |  *   along with this program; if not, write to the Free Software | ||||||
|  |  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA | ||||||
|  |  * | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | /* | ||||||
|  |  * TocIMCommand.java | ||||||
|  |  * | ||||||
|  |  * Created on 4 May 2002, 15:18 | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | package com.wilko.jaim.commands; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * @author paulw | ||||||
|  |  * @version $Revision: 1.4 $ | ||||||
|  |  */ | ||||||
|  | public class TocChatInviteCommand extends TocCommand { | ||||||
|  | 
 | ||||||
|  |     private final String roomID; | ||||||
|  |     private final String message; | ||||||
|  |     private final String[] buddies; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Creates new TocIMCommand | ||||||
|  |      */ | ||||||
|  |     public TocChatInviteCommand(String roomID, String message, String[] buddies) { | ||||||
|  |         this.roomID = roomID; | ||||||
|  |         this.message = message; | ||||||
|  |         this.buddies = buddies; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public String toString() { | ||||||
|  |         return ("toc_chat_invite " + roomID + " \"" + message + "\" " + String.join(" ", buddies)); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public byte[] getBytes() { | ||||||
|  |         return (this.toString().getBytes()); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  | @ -23,7 +23,7 @@ | ||||||
|  * Created on 4 May 2002, 15:18 |  * Created on 4 May 2002, 15:18 | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.commands; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * @author paulw |  * @author paulw | ||||||
							
								
								
									
										51
									
								
								src/com/wilko/jaim/commands/TocChatLeaveCommand.java
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								src/com/wilko/jaim/commands/TocChatLeaveCommand.java
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,51 @@ | ||||||
|  | /* | ||||||
|  |  *   (C) 2002 Paul Wilkinson  wilko@users.sourceforge.net | ||||||
|  |  * | ||||||
|  |  *   This program is free software; you can redistribute it and/or modify | ||||||
|  |  *   it under the terms of the GNU General Public License as published by | ||||||
|  |  *   the Free Software Foundation; either version 2 of the License, or | ||||||
|  |  *   (at your option) any later version. | ||||||
|  |  * | ||||||
|  |  *   This program is distributed in the hope that it will be useful, | ||||||
|  |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  |  *   GNU General Public License for more details. | ||||||
|  |  * | ||||||
|  |  *   You should have received a copy of the GNU General Public License | ||||||
|  |  *   along with this program; if not, write to the Free Software | ||||||
|  |  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA | ||||||
|  |  * | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | /* | ||||||
|  |  * TocIMCommand.java | ||||||
|  |  * | ||||||
|  |  * Created on 4 May 2002, 15:18 | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | package com.wilko.jaim.commands; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * @author paulw | ||||||
|  |  * @version $Revision: 1.4 $ | ||||||
|  |  */ | ||||||
|  | public class TocChatLeaveCommand extends TocCommand { | ||||||
|  | 
 | ||||||
|  |     private final String roomID; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Creates new TocIMCommand | ||||||
|  |      */ | ||||||
|  |     public TocChatLeaveCommand(String roomID) { | ||||||
|  |         this.roomID = roomID; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public String toString() { | ||||||
|  |         return ("toc_chat_leave " + roomID); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public byte[] getBytes() { | ||||||
|  |         return (this.toString().getBytes()); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | } | ||||||
							
								
								
									
										53
									
								
								src/com/wilko/jaim/commands/TocChatSendCommand.java
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								src/com/wilko/jaim/commands/TocChatSendCommand.java
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,53 @@ | ||||||
|  | /* | ||||||
|  |  *   (C) 2002 Paul Wilkinson  wilko@users.sourceforge.net | ||||||
|  |  * | ||||||
|  |  *   This program is free software; you can redistribute it and/or modify | ||||||
|  |  *   it under the terms of the GNU General Public License as published by | ||||||
|  |  *   the Free Software Foundation; either version 2 of the License, or | ||||||
|  |  *   (at your option) any later version. | ||||||
|  |  * | ||||||
|  |  *   This program is distributed in the hope that it will be useful, | ||||||
|  |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  |  *   GNU General Public License for more details. | ||||||
|  |  * | ||||||
|  |  *   You should have received a copy of the GNU General Public License | ||||||
|  |  *   along with this program; if not, write to the Free Software | ||||||
|  |  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA | ||||||
|  |  * | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | /* | ||||||
|  |  * TocIMCommand.java | ||||||
|  |  * | ||||||
|  |  * Created on 4 May 2002, 15:18 | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | package com.wilko.jaim.commands; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * @author paulw | ||||||
|  |  * @version $Revision: 1.4 $ | ||||||
|  |  */ | ||||||
|  | public class TocChatSendCommand extends TocCommand { | ||||||
|  | 
 | ||||||
|  |     private final String roomID; | ||||||
|  |     private final String message; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Creates new TocIMCommand | ||||||
|  |      */ | ||||||
|  |     public TocChatSendCommand(String roomID, String message) { | ||||||
|  |         this.roomID = roomID; | ||||||
|  |         this.message = message; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public String toString() { | ||||||
|  |         return ("toc_chat_send " + roomID + " \"" + message + "\""); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public byte[] getBytes() { | ||||||
|  |         return (this.toString().getBytes()); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | } | ||||||
							
								
								
									
										55
									
								
								src/com/wilko/jaim/commands/TocChatWhisperCommand.java
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								src/com/wilko/jaim/commands/TocChatWhisperCommand.java
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,55 @@ | ||||||
|  | /* | ||||||
|  |  *   (C) 2002 Paul Wilkinson  wilko@users.sourceforge.net | ||||||
|  |  * | ||||||
|  |  *   This program is free software; you can redistribute it and/or modify | ||||||
|  |  *   it under the terms of the GNU General Public License as published by | ||||||
|  |  *   the Free Software Foundation; either version 2 of the License, or | ||||||
|  |  *   (at your option) any later version. | ||||||
|  |  * | ||||||
|  |  *   This program is distributed in the hope that it will be useful, | ||||||
|  |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  |  *   GNU General Public License for more details. | ||||||
|  |  * | ||||||
|  |  *   You should have received a copy of the GNU General Public License | ||||||
|  |  *   along with this program; if not, write to the Free Software | ||||||
|  |  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA | ||||||
|  |  * | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | /* | ||||||
|  |  * TocIMCommand.java | ||||||
|  |  * | ||||||
|  |  * Created on 4 May 2002, 15:18 | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | package com.wilko.jaim.commands; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * @author paulw | ||||||
|  |  * @version $Revision: 1.4 $ | ||||||
|  |  */ | ||||||
|  | public class TocChatWhisperCommand extends TocCommand { | ||||||
|  | 
 | ||||||
|  |     private final String roomID; | ||||||
|  |     private final String screenname; | ||||||
|  |     private final String message; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Creates new TocIMCommand | ||||||
|  |      */ | ||||||
|  |     public TocChatWhisperCommand(String roomID, String screenname, String message) { | ||||||
|  |         this.roomID = roomID; | ||||||
|  |         this.screenname = screenname; | ||||||
|  |         this.message = message; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public String toString() { | ||||||
|  |         return ("toc_chat_whisper " + roomID + " " + screenname + " \"" + message + "\""); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public byte[] getBytes() { | ||||||
|  |         return (this.toString().getBytes()); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  | @ -23,7 +23,7 @@ | ||||||
|  * Created on 4 May 2002, 11:19 |  * Created on 4 May 2002, 11:19 | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.commands; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * @author paulw |  * @author paulw | ||||||
|  | @ -23,7 +23,9 @@ | ||||||
|  * Created on 6 May 2002, 09:05 |  * Created on 6 May 2002, 09:05 | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.commands; | ||||||
|  | 
 | ||||||
|  | import com.wilko.jaim.Utils; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * @author paulw |  * @author paulw | ||||||
|  | @ -36,7 +36,9 @@ | ||||||
|  * |  * | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.commands; | ||||||
|  | 
 | ||||||
|  | import com.wilko.jaim.Utils; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * @author paulw |  * @author paulw | ||||||
|  | @ -23,7 +23,9 @@ | ||||||
|  * Created on 4 May 2002, 15:18 |  * Created on 4 May 2002, 15:18 | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.commands; | ||||||
|  | 
 | ||||||
|  | import com.wilko.jaim.Utils; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * @author paulw |  * @author paulw | ||||||
|  | @ -23,7 +23,7 @@ | ||||||
|  * Created on 4 May 2002, 13:35 |  * Created on 4 May 2002, 13:35 | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.commands; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * @author paulw |  * @author paulw | ||||||
|  | @ -23,7 +23,9 @@ | ||||||
|  * Created on July 17, 2002, 9:02 PM |  * Created on July 17, 2002, 9:02 PM | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.commands; | ||||||
|  | 
 | ||||||
|  | import com.wilko.jaim.Utils; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * @author paulw |  * @author paulw | ||||||
|  | @ -23,7 +23,10 @@ | ||||||
|  * Created on October 11, 2002, 9:08 AM |  * Created on October 11, 2002, 9:08 AM | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.commands; | ||||||
|  | 
 | ||||||
|  | import com.wilko.jaim.Buddy; | ||||||
|  | import com.wilko.jaim.Group; | ||||||
| 
 | 
 | ||||||
| import java.util.Enumeration; | import java.util.Enumeration; | ||||||
| 
 | 
 | ||||||
|  | @ -22,7 +22,7 @@ | ||||||
|  * Created on July 17, 2002, 9:21 PM |  * Created on July 17, 2002, 9:21 PM | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.commands; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * @author paulw |  * @author paulw | ||||||
|  | @ -23,7 +23,9 @@ | ||||||
|  * Created on July 17, 2002, 9:02 PM |  * Created on July 17, 2002, 9:02 PM | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.commands; | ||||||
|  | 
 | ||||||
|  | import com.wilko.jaim.Utils; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * @author paulw |  * @author paulw | ||||||
|  | @ -23,7 +23,9 @@ | ||||||
|  * Created on 4 May 2002, 11:20 |  * Created on 4 May 2002, 11:20 | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.commands; | ||||||
|  | 
 | ||||||
|  | import com.wilko.jaim.Utils; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * @author paulw |  * @author paulw | ||||||
|  | @ -23,7 +23,7 @@ | ||||||
|  * Created on 3 May 2002, 14:54 |  * Created on 3 May 2002, 14:54 | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.flap; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * @author paulw |  * @author paulw | ||||||
|  | @ -22,7 +22,7 @@ | ||||||
|  * Created on 3 May 2002, 14:54 |  * Created on 3 May 2002, 14:54 | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.flap; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * @author paulw |  * @author paulw | ||||||
|  | @ -23,7 +23,7 @@ | ||||||
|  * Created on 3 May 2002, 14:51 |  * Created on 3 May 2002, 14:51 | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.flap; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * @author paulw |  * @author paulw | ||||||
|  | @ -23,7 +23,7 @@ | ||||||
|  * Created on 3 May 2002, 15:05 |  * Created on 3 May 2002, 15:05 | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.flap; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * @author paulw |  * @author paulw | ||||||
|  | @ -23,7 +23,7 @@ | ||||||
|  * Created on 3 May 2002, 15:04 |  * Created on 3 May 2002, 15:04 | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.flap; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * @author paulw |  * @author paulw | ||||||
|  | @ -23,7 +23,7 @@ | ||||||
|  * Created on 3 May 2002, 15:52 |  * Created on 3 May 2002, 15:52 | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.flap; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * @author paulw |  * @author paulw | ||||||
|  | @ -23,7 +23,7 @@ | ||||||
|  * Created on 3 May 2002, 14:54 |  * Created on 3 May 2002, 14:54 | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.flap; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * @author paulw |  * @author paulw | ||||||
|  | @ -23,7 +23,7 @@ | ||||||
|  * Created on 3 May 2002, 14:54 |  * Created on 3 May 2002, 14:54 | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.flap; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * @author paulw |  * @author paulw | ||||||
|  | @ -23,7 +23,7 @@ | ||||||
|  * Created on 3 May 2002, 14:54 |  * Created on 3 May 2002, 14:54 | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.flap; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * @author paulw |  * @author paulw | ||||||
|  | @ -23,7 +23,9 @@ | ||||||
|  * Created on 5 May 2002, 21:19 |  * Created on 5 May 2002, 21:19 | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.responses; | ||||||
|  | 
 | ||||||
|  | import com.wilko.jaim.JaimEventListener; | ||||||
| 
 | 
 | ||||||
| import java.util.Date; | import java.util.Date; | ||||||
| import java.util.StringTokenizer; | import java.util.StringTokenizer; | ||||||
|  | @ -23,7 +23,9 @@ | ||||||
|  * Created on 5 May 2002, 21:19 |  * Created on 5 May 2002, 21:19 | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.responses; | ||||||
|  | 
 | ||||||
|  | import com.wilko.jaim.JaimEventListener; | ||||||
| 
 | 
 | ||||||
| import java.util.StringTokenizer; | import java.util.StringTokenizer; | ||||||
| 
 | 
 | ||||||
|  | @ -21,7 +21,9 @@ | ||||||
|  * ConfigTocResponse.java |  * ConfigTocResponse.java | ||||||
|  * Created on 1, October 2002 |  * Created on 1, October 2002 | ||||||
|  */ |  */ | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.responses; | ||||||
|  | 
 | ||||||
|  | import com.wilko.jaim.*; | ||||||
| 
 | 
 | ||||||
| import java.util.*; | import java.util.*; | ||||||
| 
 | 
 | ||||||
|  | @ -165,7 +167,7 @@ public class ConfigTocResponse extends TocResponse implements TocResponseHandler | ||||||
|      * Return an existing Buddy with the specified name or return a new buddy if the name is not known |      * Return an existing Buddy with the specified name or return a new buddy if the name is not known | ||||||
|      * The buddy is added to the buddies hash if it is a new buddy |      * The buddy is added to the buddies hash if it is a new buddy | ||||||
|      * |      * | ||||||
|      * @param The name of the buddy we are looking for |      * @param buddyName The name of the buddy we are looking for | ||||||
|      * @return The buddy object |      * @return The buddy object | ||||||
|      */ |      */ | ||||||
| 
 | 
 | ||||||
|  | @ -23,7 +23,7 @@ | ||||||
|  * Created on November 2, 2002, 2:52 PM |  * Created on November 2, 2002, 2:52 PM | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.responses; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * This is a "pseudo" TOC response - it is delivered to JaimLib clients to indicate that the connection to the server has been lost. |  * This is a "pseudo" TOC response - it is delivered to JaimLib clients to indicate that the connection to the server has been lost. | ||||||
|  | @ -23,7 +23,9 @@ | ||||||
|  * Created on 4 May 2002, 14:52 |  * Created on 4 May 2002, 14:52 | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.responses; | ||||||
|  | 
 | ||||||
|  | import com.wilko.jaim.JaimEventListener; | ||||||
| 
 | 
 | ||||||
| import java.util.MissingResourceException; | import java.util.MissingResourceException; | ||||||
| 
 | 
 | ||||||
|  | @ -23,7 +23,9 @@ | ||||||
|  * Created on 6 May 2002, 16:49 |  * Created on 6 May 2002, 16:49 | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.responses; | ||||||
|  | 
 | ||||||
|  | import com.wilko.jaim.JaimEventListener; | ||||||
| 
 | 
 | ||||||
| import java.util.StringTokenizer; | import java.util.StringTokenizer; | ||||||
| 
 | 
 | ||||||
|  | @ -23,7 +23,9 @@ | ||||||
|  * Created on 4 May 2002, 12:07 |  * Created on 4 May 2002, 12:07 | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.responses; | ||||||
|  | 
 | ||||||
|  | import com.wilko.jaim.JaimConnection; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * A GenericTocResponse is used internally in the Response parsing and processing logic of {@link JaimConnection} |  * A GenericTocResponse is used internally in the Response parsing and processing logic of {@link JaimConnection} | ||||||
|  | @ -23,7 +23,9 @@ | ||||||
|  * Created on 4 May 2002, 14:38 |  * Created on 4 May 2002, 14:38 | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.responses; | ||||||
|  | 
 | ||||||
|  | import com.wilko.jaim.JaimEventListener; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * This response is delivered to a {@link JaimEventListener } when a GOTO response is received from TOC |  * This response is delivered to a {@link JaimEventListener } when a GOTO response is received from TOC | ||||||
|  | @ -23,7 +23,10 @@ | ||||||
|  * Created on 4 May 2002, 14:38 |  * Created on 4 May 2002, 14:38 | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.responses; | ||||||
|  | 
 | ||||||
|  | import com.wilko.jaim.JaimEventListener; | ||||||
|  | import com.wilko.jaim.Utils; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * This response is delivered to a {@link JaimEventListener } when an instant message is received |  * This response is delivered to a {@link JaimEventListener } when an instant message is received | ||||||
|  | @ -23,7 +23,7 @@ | ||||||
|  * Created on November 2, 2002, 2:52 PM |  * Created on November 2, 2002, 2:52 PM | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.responses; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * This is a "pseudo" TOC response - it is delivered to JaimLib clients to indicate that login processing has been completed successfully. |  * This is a "pseudo" TOC response - it is delivered to JaimLib clients to indicate that login processing has been completed successfully. | ||||||
|  | @ -23,7 +23,9 @@ | ||||||
|  * Created on 6 May 2002, 17:21 |  * Created on 6 May 2002, 17:21 | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.responses; | ||||||
|  | 
 | ||||||
|  | import com.wilko.jaim.JaimConnection; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * The NicTocResponse is used internally to manage the TOC signon process.  It is not delivered to clients of {@link JaimConnection} |  * The NicTocResponse is used internally to manage the TOC signon process.  It is not delivered to clients of {@link JaimConnection} | ||||||
|  | @ -23,7 +23,9 @@ | ||||||
|  * Created on 4 May 2002, 13:29 |  * Created on 4 May 2002, 13:29 | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.responses; | ||||||
|  | 
 | ||||||
|  | import com.wilko.jaim.JaimConnection; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * The SignOnTocResponse is used internally to manage the TOC signon process.  It is not delivered to clients of {@link JaimConnection} |  * The SignOnTocResponse is used internally to manage the TOC signon process.  It is not delivered to clients of {@link JaimConnection} | ||||||
|  | @ -23,7 +23,7 @@ | ||||||
|  * Created on 4 May 2002, 11:19 |  * Created on 4 May 2002, 11:19 | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.responses; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * @author paulw |  * @author paulw | ||||||
|  | @ -23,7 +23,7 @@ | ||||||
|  * Created on 4 May 2002, 12:05 |  * Created on 4 May 2002, 12:05 | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.responses; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * @author paulw |  * @author paulw | ||||||
|  | @ -48,7 +48,7 @@ public abstract class TocResponseFactory { | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     static TocResponse createResponse(byte[] b) { |     public static TocResponse createResponse(byte[] b) { | ||||||
|         TocResponse tr = null; |         TocResponse tr = null; | ||||||
|         String strversion = new String(b); |         String strversion = new String(b); | ||||||
|         int colonpos = strversion.indexOf(':'); |         int colonpos = strversion.indexOf(':'); | ||||||
|  | @ -17,7 +17,7 @@ | ||||||
|  * |  * | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.wilko.jaim; | package com.wilko.jaim.responses; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * @author paulw |  * @author paulw | ||||||
|  | @ -26,6 +26,7 @@ | ||||||
| package com.wilko.jaimtest; | package com.wilko.jaimtest; | ||||||
| 
 | 
 | ||||||
| import com.wilko.jaim.*; | import com.wilko.jaim.*; | ||||||
|  | import com.wilko.jaim.responses.*; | ||||||
| 
 | 
 | ||||||
| import java.io.IOException; | import java.io.IOException; | ||||||
| import java.io.InputStream; | import java.io.InputStream; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Frankie B
				Frankie B