f00f.net.irc.martyr.commands
Class QuitCommand

java.lang.Object
  extended by f00f.net.irc.martyr.commands.AbstractInCommand
      extended by f00f.net.irc.martyr.commands.AbstractCommand
          extended by f00f.net.irc.martyr.commands.QuitCommand
All Implemented Interfaces:
Command, InCommand, OutCommand

public class QuitCommand
extends AbstractCommand

Defines QUIT command. The QUIT command asks the irc server to disconnect us, and we can optionally give a reason. The QUIT command is also received by us if someone on a channel we are on quits.

What should be done to signal to the framework that the disconnection that should come from the server is legit, and we shouldn't try to re-connecet? For now it will be assumed that the user of the framework will signal all the appropriate classes that a legit disconnection will happen (ie AutoRegister which will try to re-connect otherwise).


Field Summary
 
Fields inherited from class f00f.net.irc.martyr.commands.AbstractInCommand
attributes
 
Constructor Summary
QuitCommand()
          For use as a factory
QuitCommand(FullNick user, java.lang.String reason)
          For use as an incoming command.
QuitCommand(java.lang.String reason)
          For use as an outgoing command.
 
Method Summary
 java.lang.String getIrcIdentifier()
          Returns the string IRC uses to identify this command.
 java.lang.String getReason()
           
 FullNick getUser()
           
 boolean isOurQuit(ClientState state)
          Returns true if we are the ones quitting.
 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.
 java.lang.String renderParams()
          Renders the parameters of this command.
 boolean updateClientState(ClientState state)
          If we are quitting, we won't be worrying about our client state.
 
Methods inherited from class f00f.net.irc.martyr.commands.AbstractCommand
render
 
Methods inherited from class f00f.net.irc.martyr.commands.AbstractInCommand
getAttribute, getAttributeKeys, getIntParameter, getParameter, getSourceString, getState, selfRegister, setAttribute, setSourceString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QuitCommand

public QuitCommand()
For use as a factory


QuitCommand

public QuitCommand(FullNick user,
                   java.lang.String reason)
For use as an incoming command.

Parameters:
user - User that has quit
reason - Specified reason for quitting

QuitCommand

public QuitCommand(java.lang.String reason)
For use as an outgoing command.

Parameters:
reason - Specified reason for quitting
Method Detail

parse

public InCommand parse(java.lang.String prefix,
                       java.lang.String identifier,
                       java.lang.String params)
Description copied from class: AbstractInCommand
Parses a string and produces a formed command object, if it can. Should return null if it cannot form the command object.

Specified by:
parse in interface InCommand
Specified by:
parse in class AbstractInCommand
Parameters:
prefix - Prefix of the command
identifier - ID of the command
params - Parameters of the command
Returns:
InCommand instance for parsed command

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.

Returns:
The IRC identifier string

renderParams

public java.lang.String renderParams()
Description copied from class: AbstractCommand
Renders the parameters of this command.

Specified by:
renderParams in class AbstractCommand
Returns:
String of rendered parameters

getReason

public java.lang.String getReason()

getUser

public FullNick getUser()

isOurQuit

public boolean isOurQuit(ClientState state)
Returns true if we are the ones quitting.

Parameters:
state - Client state we are checking against
Returns:
True or false if the quit is us quitting

updateClientState

public boolean updateClientState(ClientState state)
If we are quitting, we won't be worrying about our client state. If someone else is leaving, then remove them from all the groups they are in.

Specified by:
updateClientState in interface InCommand
Overrides:
updateClientState in class AbstractInCommand
Parameters:
state - Client state to be updated
Returns:
True or false if changes were made


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