net.kano.joscar.snaccmd.chat
Class AbstractChatMsgIcbm

java.lang.Object
  extended bySnacCommand
      extended byAbstractIcbm
          extended byAbstractChatMsgIcbm
Direct Known Subclasses:
RecvChatMsgIcbm, SendChatMsgIcbm

public abstract class AbstractChatMsgIcbm
extends AbstractIcbm

A base class for chat-message ICBM commands, both incoming and outgoing.


Field Summary
 
Fields inherited from class AbstractIcbm
CHANNEL_CHAT, CHANNEL_IM, CHANNEL_RV
 
Fields inherited from class SnacCommand
SNACFLAG_DEFAULT
 
Constructor Summary
protected AbstractChatMsgIcbm(int command, long messageId, ChatMsg chatMsg)
          Creates a new outgoing chat ICBM with the given properties.
protected AbstractChatMsgIcbm(int command, SnacPacket packet)
          Creates a new chat ICBM with the given SNAC command subtype and with properties read from the given incoming packet.
 
Method Summary
protected  TlvChain getChatTlvs()
          Returns the extra command-specific TLV's sent in this chat message.
 ChatMsg getMessage()
          Returns this ICBM's embedded chat message.
protected  void writeChannelData(java.io.OutputStream out)
          Writes the channel-specific data for this ICBM command to the given output stream.
protected abstract  void writeChatTlvs(java.io.OutputStream out)
          Writes the extra command-type-specific TLV's to be sent with this ICBM to the given stream.
 
Methods inherited from class AbstractIcbm
getChannel, getChannelData, getIcbmChannel, getIcbmMessageId, toString, writeData
 
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
 

Constructor Detail

AbstractChatMsgIcbm

protected AbstractChatMsgIcbm(int command,
                              SnacPacket packet)
Creates a new chat ICBM with the given SNAC command subtype and with properties read from the given incoming packet.

Parameters:
command - the SNAC command subtype of this command
packet - a chat ICBM packet

AbstractChatMsgIcbm

protected AbstractChatMsgIcbm(int command,
                              long messageId,
                              ChatMsg chatMsg)
Creates a new outgoing chat ICBM with the given properties.

Parameters:
command - this ICBM's SNAC command subtype
messageId - a (normally unique) ICBM message ID
chatMsg - the message to send to the channel
Method Detail

getMessage

public final ChatMsg getMessage()
Returns this ICBM's embedded chat message.

Returns:
the chat message in this ICBM

getChatTlvs

protected final TlvChain getChatTlvs()
Returns the extra command-specific TLV's sent in this chat message. Will be null if this message was not read from an incoming stream.

Returns:
this ICBM's command-type-specific TLV's

writeChannelData

protected void writeChannelData(java.io.OutputStream out)
                         throws java.io.IOException
Description copied from class: AbstractIcbm
Writes the channel-specific data for this ICBM command to the given output stream.

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

writeChatTlvs

protected abstract void writeChatTlvs(java.io.OutputStream out)
                               throws java.io.IOException
Writes the extra command-type-specific TLV's to be sent with this ICBM to the given stream.

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