net.kano.joscar.snaccmd.rooms
Class RoomResponse

java.lang.Object
  extended bySnacCommand
      extended byRoomCommand
          extended byRoomResponse

public class RoomResponse
extends RoomCommand

A SNAC command used to respond to every possible request or query made in the chat room navigation family.

Normally this command only contains either a room information block or a maximum room value & a set of exchange information blocks.

This command is normally sent in response to each of JoinRoomCmd, ExchangeInfoReq, RoomRightsRequest, and RoomInfoReq.

Source of this SNAC:
AIM server
SNAC command type:
Family 0x0d, command 0x09

Field Summary
 
Fields inherited from class RoomCommand
CMD_EXCH_INFO_REQ, CMD_JOIN_ROOM, CMD_MORE_ROOM_INFO, CMD_RIGHTS_REQ, CMD_ROOM_RESPONSE, FAMILY_INFO, FAMILY_ROOM
 
Fields inherited from class SnacCommand
SNACFLAG_DEFAULT
 
Constructor Summary
  RoomResponse(FullRoomInfo roomInfo)
          Creates a new outgoing room information response only containing the given room information block.
  RoomResponse(int maxRooms, ExchangeInfo[] exchangeInfos)
          Creates a new outgoing room information response containing only the given maximum number of rooms and list of exchange information blocks.
  RoomResponse(int maxRooms, ExchangeInfo[] exchangeInfos, FullRoomInfo roomInfo)
          Creates a new outgoing room information response with the given maximum number of rooms, exchange information blocks, and chat room information block.
protected RoomResponse(SnacPacket packet)
          Generates a chat room navigation response command from the given incoming SNAC command.
 
Method Summary
 ExchangeInfo[] getExchangeInfos()
          Returns the set of chat exchange information blocks that was sent in this response, or null if this field was not sent.
 int getMaxRooms()
          Returns the maximum number of rooms in which a user can simultaneously reside.
 FullRoomInfo getRoomInfo()
          Returns the room information block sent in this response, or null if none was sent.
 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
 

Constructor Detail

RoomResponse

protected RoomResponse(SnacPacket packet)
Generates a chat room navigation response command from the given incoming SNAC command.

Parameters:
packet - an incoming chat room navigation family response

RoomResponse

public RoomResponse(FullRoomInfo roomInfo)
Creates a new outgoing room information response only containing the given room information block.

Parameters:
roomInfo - the room information block to send in this response

RoomResponse

public RoomResponse(int maxRooms,
                    ExchangeInfo[] exchangeInfos)
Creates a new outgoing room information response containing only the given maximum number of rooms and list of exchange information blocks.

Parameters:
maxRooms - the maximum number of rooms in which a user can simultaneously reside
exchangeInfos - a list of exchange information blocks

RoomResponse

public RoomResponse(int maxRooms,
                    ExchangeInfo[] exchangeInfos,
                    FullRoomInfo roomInfo)
Creates a new outgoing room information response with the given maximum number of rooms, exchange information blocks, and chat room information block.

Parameters:
maxRooms - the maximum number of rooms in which a user can simultaneously reside
exchangeInfos - a list of exchange information blocks
roomInfo - a room information block
Method Detail

getMaxRooms

public final int getMaxRooms()
Returns the maximum number of rooms in which a user can simultaneously reside. Note that this will be -1 if this value was not sent.

Returns:
the maximum number of rooms in which a user can reside at one time

getExchangeInfos

public final ExchangeInfo[] getExchangeInfos()
Returns the set of chat exchange information blocks that was sent in this response, or null if this field was not sent.

Returns:
the list of chat exchange information blocks sent in this response

getRoomInfo

public final FullRoomInfo getRoomInfo()
Returns the room information block sent in this response, or null if none was sent.

Returns:
the room information block sent in this response

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