f00f.net.irc.martyr
Interface InCommand

All Superinterfaces:
Command
All Known Implementing Classes:
AbstractCommand, AbstractInCommand, AbstractWhoisReply, ActionCtcp, AlreadyRegisteredError, AwayReply, CannotSendToChanError, CantKillServerError, ChannelBannedError, ChannelCreationReply, ChannelInviteOnlyError, ChannelLimitError, ChannelModeCommand, ChannelWrongKeyError, ChanOPrivsNeededError, CtcpMessage, CtcpNotice, ErroneusNicknameError, FileErrorError, GenericError, GenericJoinError, GenericReply, GenericStringReply, InviteCommand, IsonCommand, JoinCommand, KeySetError, KickCommand, ListEndReply, ListReply, ListStartReply, LoadTooHighError, LUserClientReply, LUserMeReply, LUserOpReply, MessageCommand, ModeCommand, ModeReply, NamesEndReply, NamesReply, NeedMoreParamsError, NickCollisionError, NickCommand, NickInUseError, NoAdminInfoError, NoLoginError, NoMotdError, NoNicknameGivenError, NoOperHostError, NoOriginError, NoPermForHostError, NoPrivilegesError, NoRecipientError, NoSuchChannelError, NoSuchNickError, NoSuchServerError, NoTextToSendError, NoticeCommand, NotOnChannelError, NoTopLevelError, NotRegisteredError, NowAwayReply, PartCommand, PasswdMismatchError, PingCommand, PongCommand, QuitCommand, SummonDisabledError, TooManyChannelsError, TooManyTargetsError, TopicCommand, TopicInfoReply, UModeUnknownFlagError, UnAwayReply, UnknownCommand, UnknownCommandError, UnknownError, UnknownModeError, UnknownReply, UserModeCommand, UserNotInChannelError, UserOnChannelError, UsersDisabledError, UsersDontMatchError, WasNoSuchNickError, WelcomeCommand, WhoisChannelsReply, WhoisEndReply, WhoisIdleReply, WhoisServerReply, WhoisUserReply, WildTopLevelError, YoureBannedCreepError

public interface InCommand
extends Command

Defines commands that come from the server. Errors and replies are incoming commands.

See Also:
GenericError, GenericReply

Method Summary
 java.lang.String getAttribute(java.lang.String key)
          Returns the attribute, or null if the attribute does not exist, or is not defined.
 java.util.Iterator getAttributeKeys()
          Returns an iterator of String objects over the attribute names for this command.
 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.
 InCommand 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.
 void selfRegister(CommandRegister commandRegister)
          Every incoming command should know how to register itself with the command register.
 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.
 
Methods inherited from interface f00f.net.irc.martyr.Command
getIrcIdentifier
 

Method Detail

getState

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).

Returns:
State associated with command

selfRegister

void selfRegister(CommandRegister commandRegister)
Every incoming command should know how to register itself with the command register.

Parameters:
commandRegister - Command register we want to register with

parse

InCommand 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.

Parameters:
prefix - Prefix of the command
identifier - ID of the command
params - Parameters of the command
Returns:
InCommand instance for parsed command

setSourceString

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.

Parameters:
str - Sets the source string to be parsed

getSourceString

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

Returns:
The original source string from the server

updateClientState

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.

Parameters:
state - Client state to be updated
Returns:
True or false if changes were made

getAttributeKeys

java.util.Iterator getAttributeKeys()
Returns an iterator of String objects over the attribute names for this command. Warning: Still new, support for this is not yet widespread. Should return all possible attribute keys, not just those that have a value in the current context.

Returns:
Iterator of attribute keys

getAttribute

java.lang.String getAttribute(java.lang.String key)
Returns the attribute, or null if the attribute does not exist, or is not defined.

Parameters:
key - Attribute to get value of
Returns:
Attribute value or null if attribute doesn't exist


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