f00f.net.irc.martyr.dcc
Class ChatRequestCommand

java.lang.Object
  extended by f00f.net.irc.martyr.dcc.ChatRequestCommand
All Implemented Interfaces:
Command, OutCommand

public class ChatRequestCommand
extends java.lang.Object
implements OutCommand

ChatRequestCommand sets up a socket to listen for a dcc connection and then sends a request to chat to the indicated party. Still experimental.


Field Summary
static int SO_TIMEOUT
          Defaults to 30 minutes
 
Constructor Summary
ChatRequestCommand(java.net.InetAddress local, java.lang.String toWhom, DccChatHandler handler, int timeout)
           
ChatRequestCommand(IRCConnection conn, java.lang.String toWhom, DccChatHandler handler)
           
 
Method Summary
 java.lang.String getIrcIdentifier()
          Returns the string IRC uses to identify this command.
 java.lang.String render()
          Forms a string appropriate to send to the server, if required.
protected  void startHandlerThread(java.net.ServerSocket ss, DccChatHandler handler)
          Called by the constructor, this method starts the thread that waits for connections and starts the handler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SO_TIMEOUT

public static final int SO_TIMEOUT
Defaults to 30 minutes

See Also:
Constant Field Values
Constructor Detail

ChatRequestCommand

public ChatRequestCommand(IRCConnection conn,
                          java.lang.String toWhom,
                          DccChatHandler handler)
                   throws java.io.IOException
Parameters:
conn - requred to discover the local address.
toWhom - Who the chat request will be sent to
handler - DccChatHandler that will handle thet communication
Throws:
java.io.IOException - if unable to establish connection

ChatRequestCommand

public ChatRequestCommand(java.net.InetAddress local,
                          java.lang.String toWhom,
                          DccChatHandler handler,
                          int timeout)
                   throws java.io.IOException
Throws:
java.io.IOException
Method Detail

startHandlerThread

protected void startHandlerThread(java.net.ServerSocket ss,
                                  DccChatHandler handler)
Called by the constructor, this method starts the thread that waits for connections and starts the handler. Subclasses can override this method if they want to do something before calling super.startHandlerThread.

Parameters:
ss - Socket on our end that will listen for a dcc chat
handler - Handler that will handle incoming requests

getIrcIdentifier

public java.lang.String getIrcIdentifier()
Description copied from interface: Command
Returns the string IRC uses to identify this command. Examples: NICK, PING, KILL, 332. Not strictly required for OutCommands as the irc identifier is expected to be part of the reder() result.

Specified by:
getIrcIdentifier in interface Command
Returns:
The IRC identifier string

render

public java.lang.String render()
Description copied from interface: OutCommand
Forms a string appropriate to send to the server, if required. Some commands will have no such string, as they are received and not sent. The string returned is sent to the server verbatim.

Specified by:
render in interface OutCommand
Returns:
Rendered string


Copyright © 2000-2007 Ben Damm, Daniel Henninger, et al.