f00f.net.irc.martyr
Interface Command

All Known Implementing Classes:
GenericCommand, ModeCommand, RawCommand

public interface Command

Defines what a command is. Errors and replies are commands, in fact, pretty much anything the server can send to us, or anything we can send to the server is a command.

See Also:
GenericCommand, GenericError, GenericReply

Method Summary
 java.lang.String getSourceString()
          Allows a third party to receive a copy of the raw string.
 State getState()
          Some commands, when received by the server, can only occur in one state.
 Command parse(java.lang.String prefix, java.lang.String identifier, java.lang.String params)
          Parses a string and produces a formed command object, if it can.
 java.lang.String render()
          Forms a string appropriate to send to the server, if required.
 void selfRegister(CommandRegister commandRegister)
          Every command should know how to register itself (or not) with the command parsing engine.
 void setSourceString(java.lang.String str)
          Gives the command a copy of the raw string from the server.
 boolean updateClientState(ClientState state)
          Asks the command to ensure that information it knows about the state the server thinks the client is in matches what we have.
 

Method Detail

getState

public State getState()
Some commands, when received by the server, can only occur in one state. Thus, when this command is received, the protocol should assume that it is in that state, and a state change may be triggered. A command can use the 'unknown' state to indicate it can be received in any state (for example, ping).

selfRegister

public void selfRegister(CommandRegister commandRegister)
Every command should know how to register itself (or not) with the command parsing engine.

render

public java.lang.String render()
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.

parse

public Command parse(java.lang.String prefix,
                     java.lang.String identifier,
                     java.lang.String params)
Parses a string and produces a formed command object, if it can. Should return null if it cannot form the command object. The identifier is usually ignored, except in the special case where commands can be identified by multiple identifiers. In that case, the behaviour of the command may change in sublte ways.

setSourceString

public void setSourceString(java.lang.String str)
Gives the command a copy of the raw string from the server. Called by IRCConnection after the command is parsed.

getSourceString

public java.lang.String getSourceString()
Allows a third party to receive a copy of the raw string.

updateClientState

public boolean updateClientState(ClientState state)
Asks the command to ensure that information it knows about the state the server thinks the client is in matches what we have. Returns true if state changes were made.


Copyright ? 2000,2001, f00f networks. All Rights Reserved.