net.kano.joscar.snaccmd
Class FullRoomInfo

java.lang.Object
  extended byAbstractChatInfo
      extended byFullRoomInfo
All Implemented Interfaces:
LiveWritable

public final class FullRoomInfo
extends AbstractChatInfo
implements LiveWritable

A data structure containing details about an OSCAR chat room. These details include the exchange on which the room resides, and possibly a "cookie" to be passed to a service request to join the room.


Field Summary
static int INSTANCE_LAST
          Represents the "last instance" of a given room.
 
Fields inherited from class AbstractChatInfo
MASK_CAN_PEEK, MASK_INSTANCING_ALLOWED, MASK_NAV_ONLY, MASK_WARNABLE, PERM_CAN_CREATE_EXCHANGE, PERM_CAN_CREATE_ROOM, PERM_CANNOT_CREATE_ANYTHING, TYPE_FULL, TYPE_INSTANCE_INFO, TYPE_NAV_INSTANCE_INFO, TYPE_NAV_SHORT_DESC, TYPE_SHORT
 
Constructor Summary
protected FullRoomInfo(ByteBlock block)
          Generates a room info object from the given block.
  FullRoomInfo(int exchange, java.lang.String name)
          Creates a chat room information object with the given properties.
  FullRoomInfo(int exchange, java.lang.String name, java.lang.String charset1, java.lang.String language1)
          Creates a chat room information object with the given properties.
  FullRoomInfo(int exchange, java.lang.String name, java.lang.String charset1, java.lang.String language1, java.lang.String contentType)
          Creates a chat room information object with the given properties.
 
Method Summary
 java.lang.String getCookie()
          The service request cookie associated with this room.
 int getExchange()
          Returns the number of the exchange on which this room resides.
 int getInstance()
          Returns the "instance" of the chat room.
 java.lang.String getRoomName()
          The full name of the chat room.
 int getType()
          Returns the type of room information block that this object represents.
static FullRoomInfo readRoomInfo(ByteBlock block)
          Reads a room information block from the given data block.
 java.lang.String toString()
           
 void write(java.io.OutputStream out)
          Writes a representation of this object to the given stream.
 
Methods inherited from class AbstractChatInfo
getBaseTlvCount, getCharset1, getCharset2, getContentType, getCreatePerms, getCreationDate, getFlags, getLanguage1, getLanguage2, getMaxMsgLen, getMaxOccupancy, getName, getSomething, readBaseInfo, writeBaseInfo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INSTANCE_LAST

public static final int INSTANCE_LAST
Represents the "last instance" of a given room. It is recommended to use this as the "instance" field when joining a room; as of this writing, I am unsure of what happens if you do not. If someone wants to test this for me I'd be grateful :)

See Also:
Constant Field Values
Constructor Detail

FullRoomInfo

protected FullRoomInfo(ByteBlock block)
Generates a room info object from the given block.

Parameters:
block - the block of data containing a room info object

FullRoomInfo

public FullRoomInfo(int exchange,
                    java.lang.String name)
Creates a chat room information object with the given properties. The associated charset is set to "us-ascii" and the language is set to the JVM's current default language. Using this constructor is equivalent to using new FullRoomInfo(exchange, name, "us-ascii", Locale.getDefault().getLanguage()).

Parameters:
exchange - the exchange on which the chat room resides
name - the name of the chat room

FullRoomInfo

public FullRoomInfo(int exchange,
                    java.lang.String name,
                    java.lang.String charset1,
                    java.lang.String language1)
Creates a chat room information object with the given properties. This constructor is useful for passing to JoinRoomCmds.

Parameters:
exchange - the exchange on which the chat room resides
name - the name of the chat room
charset1 - the charset associated with the given room
language1 - the language associated with the given room, normally a two-letter language code like "en" (for English)

FullRoomInfo

public FullRoomInfo(int exchange,
                    java.lang.String name,
                    java.lang.String charset1,
                    java.lang.String language1,
                    java.lang.String contentType)
Creates a chat room information object with the given properties. This constructor is useful for passing to JoinRoomCmds.

Parameters:
exchange - the exchange on which the chat room resides
name - the name of the chat room
charset1 - the charset associated with the given room
language1 - the language associated with the given room, normally a two-letter language code like "en" (for English)
contentType - a content type string, like ChatMsg.CONTENTTYPE_DEFAULT
Method Detail

readRoomInfo

public static FullRoomInfo readRoomInfo(ByteBlock block)
Reads a room information block from the given data block.

Parameters:
block - the data block from which to read the room information
Returns:
a room information block read from the given data block

getExchange

public final int getExchange()
Returns the number of the exchange on which this room resides.

Returns:
this room's associated exchange number

getCookie

public final java.lang.String getCookie()
The service request cookie associated with this room. Only sent when a full room info object is a part of a response to a JoinRoomCmd.

Returns:
a cookie to use when joining this room

getInstance

public final int getInstance()
Returns the "instance" of the chat room. As of this writing I am unsure of the significance of this value.

Returns:
the chat room's "instance" value

getType

public final int getType()
Returns the type of room information block that this object represents. Is normally one of AbstractChatInfo.TYPE_SHORT, AbstractChatInfo.TYPE_FULL, AbstractChatInfo.TYPE_NAV_INSTANCE_INFO, AbstractChatInfo.TYPE_NAV_SHORT_DESC, and AbstractChatInfo.TYPE_INSTANCE_INFO.

Returns:
the type of room information block that this object represents

getRoomName

public final java.lang.String getRoomName()
The full name of the chat room.

Returns:
the chat room's name

write

public void write(java.io.OutputStream out)
           throws java.io.IOException
Description copied from interface: LiveWritable
Writes a representation of this object to the given stream.

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

toString

public java.lang.String toString()
Overrides:
toString in class AbstractChatInfo