net.kano.joscar.snaccmd.icbm
Class TypingCmd

java.lang.Object
  extended bySnacCommand
      extended byIcbmCommand
          extended byTypingCmd
Direct Known Subclasses:
RecvTypingNotification, SendTypingNotification

public abstract class TypingCmd
extends IcbmCommand

A base class for the two typing-notification commands in this package. These commands are SendTypingNotification and RecvTypingNotification.


Field Summary
static int CODE_DEFAULT
          The default value for the code field.
static int NULLS_DEFAULT
          The default value for the nulls field.
static int STATE_NO_TEXT
          A typing state indicating that the user has not typed anything, or that he or she erased all of what he or she was typing.
static int STATE_PAUSED
          A typing state indicating that the user typed text, but then stopped.
static int STATE_TYPING
          A typing state indicating that the user is typing.
 
Fields inherited from class IcbmCommand
CMD_ICBM, CMD_MISSED, CMD_MSG_ACK, CMD_PARAM_INFO, CMD_PARAM_INFO_REQ, CMD_RECV_TYPING, CMD_RV_RESPONSE, CMD_SEND_ICBM, CMD_SEND_TYPING, CMD_SET_PARAM_INFO, CMD_WARN, FAMILY_ICBM, FAMILY_INFO
 
Fields inherited from class SnacCommand
SNACFLAG_DEFAULT
 
Constructor Summary
protected TypingCmd(int command, long nulls, int code, java.lang.String sn, int typingState)
          Creates a new typing notification command with the given properties.
protected TypingCmd(int command, SnacPacket packet)
          Generates a new typing-notification command from the given incoming SNAC packet and with the given SNAC command subtype.
protected TypingCmd(int command, java.lang.String sn, int typingState)
          Creates a new typing notification command with the given SNAC command subtype to/from the given screenname with the given typing state.
 
Method Summary
 int getCode()
          Returns the value of some sort of code sent in the typing command.
 long getNullBlockValue()
          Returns the value of the first eight bytes of the typing notification command.
 java.lang.String getScreenname()
          Returns the screenname of the user who is typing, if this is an incoming typing notification; otherwise, returns the screenname of the user to whom the user is typing.
 int getTypingState()
          Returns the "typing state" sent in this command.
 java.lang.String toString()
           
 void writeData(java.io.OutputStream out)
          Writes this command's SNAC data block to the given stream.
 
Methods inherited from class SnacCommand
getCommand, getFamily, getFlag1, getFlag2
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NULLS_DEFAULT

public static final int NULLS_DEFAULT
The default value for the nulls field.

See Also:
Constant Field Values

CODE_DEFAULT

public static final int CODE_DEFAULT
The default value for the code field.

See Also:
Constant Field Values

STATE_TYPING

public static final int STATE_TYPING
A typing state indicating that the user is typing.

See Also:
Constant Field Values

STATE_PAUSED

public static final int STATE_PAUSED
A typing state indicating that the user typed text, but then stopped.

See Also:
Constant Field Values

STATE_NO_TEXT

public static final int STATE_NO_TEXT
A typing state indicating that the user has not typed anything, or that he or she erased all of what he or she was typing.

See Also:
Constant Field Values
Constructor Detail

TypingCmd

protected TypingCmd(int command,
                    SnacPacket packet)
Generates a new typing-notification command from the given incoming SNAC packet and with the given SNAC command subtype.

Parameters:
command - the SNAC command subtype of this command
packet - an incoming typing-notification command

TypingCmd

protected TypingCmd(int command,
                    java.lang.String sn,
                    int typingState)
Creates a new typing notification command with the given SNAC command subtype to/from the given screenname with the given typing state. The nulls and code fields are set to their defaults, NULLS_DEFAULT and CODE_DEFAULT, respectively. Using this constructor is equivalent to using new TypingCmd(command, TypingCmd.NULLS_DEFAULT, TypingCmd.CODE_DEFAULT, sn, typingState).

Parameters:
command - the SNAC command subtype of this command
sn - the screenname to or from which this typing notification goes or comes, respectively
typingState - the typing state, like STATE_NO_TEXT

TypingCmd

protected TypingCmd(int command,
                    long nulls,
                    int code,
                    java.lang.String sn,
                    int typingState)
Creates a new typing notification command with the given properties.

Parameters:
command - the SNAC command subtype of this command
nulls - a value for the first eight bytes of the typing notification command (normally just NULLS_DEFAULT, 0)
code - some sort of code, normally CODE_DEFAULT
sn - the screenname of the source or destination of this command, depending on context
typingState - the typing state, like STATE_PAUSED
Method Detail

getNullBlockValue

public final long getNullBlockValue()
Returns the value of the first eight bytes of the typing notification command. This value is normally NULLS_DEFAULT, which is 0 and can probably be ignored.

Returns:
the value of the first eight bytes of the typing notification command

getCode

public final int getCode()
Returns the value of some sort of code sent in the typing command. This is normally CODE_DEFAULT, and can probably be ignored.

Returns:
some sort of code associated with this typing notification

getScreenname

public final java.lang.String getScreenname()
Returns the screenname of the user who is typing, if this is an incoming typing notification; otherwise, returns the screenname of the user to whom the user is typing.

Returns:
the screenname sent in this typing notification

getTypingState

public final int getTypingState()
Returns the "typing state" sent in this command. Normally one of STATE_NO_TEXT, STATE_TYPING, or STATE_PAUSED.

Returns:
this typing notification command's "typing state"

writeData

public void writeData(java.io.OutputStream out)
               throws java.io.IOException
Description copied from class: SnacCommand
Writes this command's SNAC data block to the given stream. The SNAC data block is the data after the first ten bytes of a SNAC packet.

Specified by:
writeData in class SnacCommand
Parameters:
out - the stream to which to write the SNAC data
Throws:
java.io.IOException - if an I/O error occurs

toString

public java.lang.String toString()