net.kano.joscar.rvcmd.icon
Class SendBuddyIconRvCmd

java.lang.Object
  extended byRvCommand
      extended byAbstractRvCmd
          extended byAbstractRequestRvCmd
              extended bySendBuddyIconRvCmd

public class SendBuddyIconRvCmd
extends AbstractRequestRvCmd

A rendezvous command used to send one's "buddy icon" to another user. Note that while this method of distributing one's icon should be supported for backwards compability, it is becoming obsolete with the coming of the buddy icon service.

Note that while it may seem odd, one's buddy icon is sent in its entirety over the SNAC connection in an (this) rendezvous command.


Field Summary
static java.lang.String ICONIDSTRING_DEFAULT
          An "icon ID string" used by WinAIM by default.
 
Fields inherited from class AbstractRequestRvCmd
FPRESENT_DEFAULT, REQTYPE_INITIALREQUEST, REQTYPE_REDIRECT
 
Fields inherited from class RvCommand
RVSTATUS_ACCEPT, RVSTATUS_DENY, RVSTATUS_REQUEST
 
Constructor Summary
SendBuddyIconRvCmd(OldIconHashInfo hash, LiveWritable iconDataWriter)
          Creates a new outgoing buddy icon send command with the given icon hash and the given icon data writer.
SendBuddyIconRvCmd(OldIconHashInfo hash, LiveWritable iconDataWriter, java.lang.String iconIdString)
          Creates a new outgoing buddy icon send command with the given icon hash icon data writer, and "ID string."
SendBuddyIconRvCmd(RecvRvIcbm icbm)
          Creates a new send-buddy-icon command from the given incoming send-buddy-icon RV ICBM.
 
Method Summary
 ByteBlock getIconData()
          Returns the block of buddy icon data sent in this command.
 OldIconHashInfo getIconHash()
          Returns the "old-format icon hash block" sent in this command.
 java.lang.String getIconIdString()
          Returns the "icon ID string" sent with the associated icon, if any.
 java.lang.String toString()
           
protected  void writeRvTlvs(java.io.OutputStream out)
          Writes this RV command's list of rendezvous TLV's to the given stream.
protected  void writeServiceData(java.io.OutputStream out)
          Writes this RV command's "service data block."
 
Methods inherited from class AbstractRequestRvCmd
getRequestType, isFPresent, writeHeaderRvTlvs
 
Methods inherited from class AbstractRvCmd
getRvTlvs, getServiceData, hasServiceData, writeRvData
 
Methods inherited from class RvCommand
getCapabilityBlock, getRvStatus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ICONIDSTRING_DEFAULT

public static final java.lang.String ICONIDSTRING_DEFAULT
An "icon ID string" used by WinAIM by default.

See Also:
Constant Field Values
Constructor Detail

SendBuddyIconRvCmd

public SendBuddyIconRvCmd(RecvRvIcbm icbm)
Creates a new send-buddy-icon command from the given incoming send-buddy-icon RV ICBM.

Parameters:
icbm - an incoming send-buddy-icon RV ICBM command

SendBuddyIconRvCmd

public SendBuddyIconRvCmd(OldIconHashInfo hash,
                          LiveWritable iconDataWriter)
Creates a new outgoing buddy icon send command with the given icon hash and the given icon data writer. The given icon data writer will be used (via its write method) to write the buddy icon to the OSCAR connection upon sending this command. The "ID string" of the icon will be set to ICONIDSTRING_DEFAULT.

Using this constructor is equivalent to using new SendBuddyIconRvCmd(hash, iconDataWriter, ICONIDSTRING_DEFAULT).

Parameters:
hash - an object representing a "hash" of the icon being sent
iconDataWriter - an object containing the raw buddy icon data
See Also:
FileWritable

SendBuddyIconRvCmd

public SendBuddyIconRvCmd(OldIconHashInfo hash,
                          LiveWritable iconDataWriter,
                          java.lang.String iconIdString)
Creates a new outgoing buddy icon send command with the given icon hash icon data writer, and "ID string." The given icon data writer will be used (via its write method) to write the buddy icon to the OSCAR connection upon sending this command.

Parameters:
hash - an object representing a "hash" of the icon being sent
iconDataWriter - an object containing the raw buddy icon data
iconIdString - an "ID string" for this icon, like ICONIDSTRING_DEFAULT
Method Detail

getIconHash

public final OldIconHashInfo getIconHash()
Returns the "old-format icon hash block" sent in this command. This block normally describes the associated buddy icon. Note that this method will return null if no icon hash block is present in this command.

Returns:
an icon hash block describing the icon being sent, or null if none is present

getIconData

public final ByteBlock getIconData()
Returns the block of buddy icon data sent in this command. Note that this value will be null if this is an outgoing command.

Returns:
the raw buddy icon data sent in this command, or null if none was sent or if this is an outgoing command

getIconIdString

public final java.lang.String getIconIdString()
Returns the "icon ID string" sent with the associated icon, if any. This value does not seem to affect anything in WinAIM or iChat. This will normally be a short string such as "AVT1picture.id".

Returns:
the associated icon's "ID string," or null if none was sent

writeRvTlvs

protected void writeRvTlvs(java.io.OutputStream out)
                    throws java.io.IOException
Description copied from class: AbstractRvCmd
Writes this RV command's list of rendezvous TLV's to the given stream.

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

writeServiceData

protected void writeServiceData(java.io.OutputStream out)
                         throws java.io.IOException
Description copied from class: AbstractRvCmd
Writes this RV command's "service data block." A service data block's format changes from rendezvous to rendezvous, but generally provides information specific to the type of rendezvous being sent. For example, in a file transfer request, the file's name and size (among other fields) are sent in the service block. This method will never be called if AbstractRvCmd.hasServiceData() returns false. The default implementation of this method does not write any data to the stream.

Overrides:
writeServiceData in class AbstractRvCmd
Parameters:
out - the stream to which to write
Throws:
java.io.IOException - if an I/O error occurs

toString

public java.lang.String toString()