net.kano.joscar.snaccmd.ssi
Class SsiDataCmd

java.lang.Object
  extended bySnacCommand
      extended bySsiCommand
          extended bySsiDataCmd

public class SsiDataCmd
extends SsiCommand

A SNAC command containing the user's server-stored information. Normally sent in respose to either of SsiDataCheck and SsiDataRequest. Note that this command is sent multiple times, spreading out the user's SSI items over multiple commands. To check for this, check to see whether getLastModDate() is 0: if it is, there are more SsiDataCmds to come.

See Also:
SsiDataCheck, SsiDataRequest
Source of this SNAC:
AIM server
SNAC command type:
Family 0x13, command 0x06

Field Summary
static int VERSION_DEFAULT
          A default SSI data version; the version number used by WinAIM.
 
Fields inherited from class SsiCommand
CMD_ACTIVATE, CMD_CREATE_ITEMS, CMD_DATA_CHECK, CMD_DATA_REQ, CMD_DELETE_ITEMS, CMD_MOD_ACK, CMD_MODIFY_ITEMS, CMD_POST_MOD, CMD_PRE_MOD, CMD_RIGHTS, CMD_RIGHTS_REQ, CMD_SSI_DATA, CMD_UNCHANGED, FAMILY_INFO, FAMILY_SSI
 
Fields inherited from class SnacCommand
SNACFLAG_DEFAULT
 
Constructor Summary
  SsiDataCmd(int version, SsiItem[] items, long lastmod)
          Creates a new outgoing SSI data command with the given properties.
protected SsiDataCmd(SnacPacket packet)
          Generates a new SSI data command from the given incoming SNAC packet.
  SsiDataCmd(SsiItem[] items, long lastmod)
          Creates a new outgoing SSI data command with the given properties and an SSI version of VERSION_DEFAULT.
 
Method Summary
 SsiItem[] getItems()
          Returns the user's SSI items, as sent in this command.
 long getLastModDate()
          Returns the last modification date of the user's SSI data, or 0 if more SSI data packets are to follow this one.
 int getSsiVersion()
          Returns the SSI version being used.
 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

VERSION_DEFAULT

public static final int VERSION_DEFAULT
A default SSI data version; the version number used by WinAIM.

See Also:
Constant Field Values
Constructor Detail

SsiDataCmd

protected SsiDataCmd(SnacPacket packet)
Generates a new SSI data command from the given incoming SNAC packet.

Parameters:
packet - an incoming SSI data packet

SsiDataCmd

public SsiDataCmd(SsiItem[] items,
                  long lastmod)
Creates a new outgoing SSI data command with the given properties and an SSI version of VERSION_DEFAULT.

Parameters:
items - a list of the user's SSI items
lastmod - the last modification date of the user's SSI data, in seconds since the unix epoch

SsiDataCmd

public SsiDataCmd(int version,
                  SsiItem[] items,
                  long lastmod)
Creates a new outgoing SSI data command with the given properties.

Parameters:
version - the SSI version being used, normally VERSION_DEFAULT
items - a list of the user's SSI items
lastmod - the last modification date of the user's SSI data, in seconds since the unix epoch, or 0 to indicate that this is not the last of a series of SSI data packets
Method Detail

getSsiVersion

public final int getSsiVersion()
Returns the SSI version being used. This is normally VERSION_DEFAULT.

Returns:
the SSI version being used

getItems

public final SsiItem[] getItems()
Returns the user's SSI items, as sent in this command. Note that this may not be all of the user's SSI items, as this command is sometimes sent multiple times, spreading the user's SSI items over multiple packets. If there are more SSI data commands to follow this one, getLastModDate() will return 0.

Returns:
the items in this user's server-stored information

getLastModDate

public final long getLastModDate()
Returns the last modification date of the user's SSI data, or 0 if more SSI data packets are to follow this one.

Returns:
the last modification date of the user's SSI data, in seconds since the unix epoch

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