net.kano.joscar.snaccmd
Class AbstractChatInfo

java.lang.Object
  extended byAbstractChatInfo
Direct Known Subclasses:
ExchangeInfo, FullRoomInfo

public abstract class AbstractChatInfo
extends java.lang.Object

Provides a base class for "chat information," which can be sent in two very similar forms. The first form is chat exchange information and the second is chat room information.


Field Summary
static int MASK_CAN_PEEK
          A mask indicating that one is allowed to view the member list of a chat room without first joining it.
static int MASK_INSTANCING_ALLOWED
          At the time of this writing, I am unsure of what this value means.
static int MASK_NAV_ONLY
          At the time of this writing, I am unsure of what this value means.
static int MASK_WARNABLE
          At the time of this writing, I am unsure of what this value means.
static int PERM_CAN_CREATE_EXCHANGE
          A value indicating that creating new exchanges is allowed.
static int PERM_CAN_CREATE_ROOM
          A value indicating that creating rooms is allowed on the given exchange.
static int PERM_CANNOT_CREATE_ANYTHING
          A value indicating that creating rooms is not allowed on the given exchange.
static int TYPE_FULL
          A value indicating that this block is a "full" information block.
static int TYPE_INSTANCE_INFO
          A value indicating that this block consists of information about an "instance" of a chat room.
static int TYPE_NAV_INSTANCE_INFO
          At the time of this writing, I am unsure of what this value means.
static int TYPE_NAV_SHORT_DESC
          At the time of this writing, I am unsure of what this value means.
static int TYPE_SHORT
          A value indicating that this block is a "short" information block.
 
Constructor Summary
protected AbstractChatInfo()
          Creates an empty chat information object.
protected AbstractChatInfo(int flags, java.util.Date creation, int maxMsgLen, int maxOccupancy, java.lang.String name, short createPerms, java.lang.String charset1, java.lang.String language1, java.lang.String charset2, java.lang.String language2, java.lang.String contentType)
          Creates a chat information block with the given properties.
protected AbstractChatInfo(java.lang.String name)
          Creates a chat information block with the given chat room name and no other properties.
protected AbstractChatInfo(java.lang.String name, java.lang.String charset1, java.lang.String language1)
          Creates a chat information block with the given properties and a content type of ChatMsg.CONTENTTYPE_DEFAULT.
protected AbstractChatInfo(java.lang.String name, java.lang.String charset1, java.lang.String language1, java.lang.String contentType)
          Creates a chat information block with the given properties.
 
Method Summary
protected  int getBaseTlvCount()
          Returns the number of TLV's that will be or have been written with a call to writeBaseInfo.
 java.lang.String getCharset1()
          Returns the first of the two charset values.
 java.lang.String getCharset2()
          Returns the second of the two charset values.
 java.lang.String getContentType()
          Returns the content type string contained in this chat information block.
 short getCreatePerms()
          Returns this chat information block's associated "creation permission" value.
 java.util.Date getCreationDate()
          Returns the date at which the associated chat room or exchange was created.
 int getFlags()
          Returns this chat information block's "flags."
 java.lang.String getLanguage1()
          Returns the first of the two language code values.
 java.lang.String getLanguage2()
          Returns the second of the two language code values.
 int getMaxMsgLen()
          Returns the maximum length of a message sent in the associated chat room or rooms on the associated exchange.
 int getMaxOccupancy()
          Returns the maximum number of members of the associated chat room or of rooms on the associated exchange.
 java.lang.String getName()
          Returns the name of the associated chat room.
 int getSomething()
          Returns a code of some sort.
protected  void readBaseInfo(TlvChain chain)
          Reads AbstractChatInfo fields such as flags, maximum message length, and room name, from the given TLV chain.
 java.lang.String toString()
           
protected  void writeBaseInfo(java.io.OutputStream out)
          Writes a chain of TLV's containing the AbstractChatInfo fields, presumably to an OSCAR connection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_SHORT

public static final int TYPE_SHORT
A value indicating that this block is a "short" information block. At the time of this writing I am not sure which fields a "short" chat information block has.

See Also:
Constant Field Values

TYPE_FULL

public static final int TYPE_FULL
A value indicating that this block is a "full" information block. At the time of this writing I am not sure which fields a "full" chat information block has.

See Also:
Constant Field Values

TYPE_INSTANCE_INFO

public static final int TYPE_INSTANCE_INFO
A value indicating that this block consists of information about an "instance" of a chat room.

See Also:
Constant Field Values

TYPE_NAV_SHORT_DESC

public static final int TYPE_NAV_SHORT_DESC
At the time of this writing, I am unsure of what this value means.

See Also:
Constant Field Values

TYPE_NAV_INSTANCE_INFO

public static final int TYPE_NAV_INSTANCE_INFO
At the time of this writing, I am unsure of what this value means.

See Also:
Constant Field Values

PERM_CANNOT_CREATE_ANYTHING

public static final int PERM_CANNOT_CREATE_ANYTHING
A value indicating that creating rooms is not allowed on the given exchange.

See Also:
Constant Field Values

PERM_CAN_CREATE_ROOM

public static final int PERM_CAN_CREATE_ROOM
A value indicating that creating rooms is allowed on the given exchange.

See Also:
Constant Field Values

PERM_CAN_CREATE_EXCHANGE

public static final int PERM_CAN_CREATE_EXCHANGE
A value indicating that creating new exchanges is allowed.

See Also:
Constant Field Values

MASK_WARNABLE

public static final int MASK_WARNABLE
At the time of this writing, I am unsure of what this value means.

See Also:
Constant Field Values

MASK_NAV_ONLY

public static final int MASK_NAV_ONLY
At the time of this writing, I am unsure of what this value means.

See Also:
Constant Field Values

MASK_INSTANCING_ALLOWED

public static final int MASK_INSTANCING_ALLOWED
At the time of this writing, I am unsure of what this value means.

See Also:
Constant Field Values

MASK_CAN_PEEK

public static final int MASK_CAN_PEEK
A mask indicating that one is allowed to view the member list of a chat room without first joining it.

See Also:
Constant Field Values
Constructor Detail

AbstractChatInfo

protected AbstractChatInfo()
Creates an empty chat information object.


AbstractChatInfo

protected AbstractChatInfo(java.lang.String name,
                           java.lang.String charset1,
                           java.lang.String language1)
Creates a chat information block with the given properties and a content type of ChatMsg.CONTENTTYPE_DEFAULT.

Parameters:
name - the name of the chat room
charset1 - the room's associated charset
language1 - the room's associatd language code

AbstractChatInfo

protected AbstractChatInfo(java.lang.String name,
                           java.lang.String charset1,
                           java.lang.String language1,
                           java.lang.String contentType)
Creates a chat information block with the given properties.

Parameters:
name - the name of the chat room
charset1 - the room's associated charset
language1 - the room's associatd language code
contentType - a content type string, like ChatMsg.CONTENTTYPE_DEFAULT or ChatMsg.CONTENTTYPE_SECURE

AbstractChatInfo

protected AbstractChatInfo(java.lang.String name)
Creates a chat information block with the given chat room name and no other properties.

Parameters:
name - the name of the chat room

AbstractChatInfo

protected AbstractChatInfo(int flags,
                           java.util.Date creation,
                           int maxMsgLen,
                           int maxOccupancy,
                           java.lang.String name,
                           short createPerms,
                           java.lang.String charset1,
                           java.lang.String language1,
                           java.lang.String charset2,
                           java.lang.String language2,
                           java.lang.String contentType)
Creates a chat information block with the given properties.

Parameters:
flags - the block's associated "flags," such as MASK_CAN_PEEK, or -1 for none
creation - the room's creation date, or null for none
maxMsgLen - the maximum message length in a room, or -1 for none
maxOccupancy - the maximum number of members of a room, or -1 for none
name - the name of the room, or null for none
createPerms - the "creation permissions" of the room, such as PERM_CANNOT_CREATE_ANYTHING, or -1 for none
charset1 - the charset name to place in the first charset block, or null for none
language1 - the language code (such as "en") to place in the first language block, or null for none
charset2 - the charset name to place in the second charset block, or null for none
language2 - the language code (such as "en") to place in the second language block, or null for none
contentType - the "content type" of the chat room, like ChatMsg.CONTENTTYPE_DEFAULT or ChatMsg.CONTENTTYPE_SECURE
Method Detail

readBaseInfo

protected final void readBaseInfo(TlvChain chain)
Reads AbstractChatInfo fields such as flags, maximum message length, and room name, from the given TLV chain.

Parameters:
chain - the TLV chain from which to read

getBaseTlvCount

protected final int getBaseTlvCount()
Returns the number of TLV's that will be or have been written with a call to writeBaseInfo.

Returns:
the number of TLV's written by writeBaseInfo

writeBaseInfo

protected final void writeBaseInfo(java.io.OutputStream out)
                            throws java.io.IOException
Writes a chain of TLV's containing the AbstractChatInfo fields, presumably to an OSCAR connection.

Parameters:
out -
Throws:
java.io.IOException

getFlags

public final int getFlags()
Returns this chat information block's "flags." This will be a bit mask possibly comprised of any of MASK_CAN_PEEK, MASK_INSTANCING_ALLOWED, MASK_NAV_ONLY, and MASK_WARNABLE.

Returns:
the "flags" bit mask of this chat information block

getCreationDate

public final java.util.Date getCreationDate()
Returns the date at which the associated chat room or exchange was created.

Returns:
the creation date of the associated chat room or exchange

getMaxMsgLen

public final int getMaxMsgLen()
Returns the maximum length of a message sent in the associated chat room or rooms on the associated exchange.

Returns:
the associated maximum chat message length

getMaxOccupancy

public final int getMaxOccupancy()
Returns the maximum number of members of the associated chat room or of rooms on the associated exchange.

Returns:
the associated maximum chat room capacity

getName

public final java.lang.String getName()
Returns the name of the associated chat room.

Returns:
the name of the associated chat room

getCreatePerms

public final short getCreatePerms()
Returns this chat information block's associated "creation permission" value. This should be one of PERM_CANNOT_CREATE_ANYTHING, PERM_CAN_CREATE_ROOM, and PERM_CAN_CREATE_EXCHANGE.

Returns:
the creation permissions of the associated exchange

getCharset1

public final java.lang.String getCharset1()
Returns the first of the two charset values. Note that normally only one of this and getCharset2() is non-null.

Returns:
the first charset of this chat information block

getLanguage1

public final java.lang.String getLanguage1()
Returns the first of the two language code values. Note that normally only one of this and getLanguage2() is non-null. This is normally a two-character string such as "en" (for English).

Returns:
the first language code of this chat information block

getCharset2

public final java.lang.String getCharset2()
Returns the second of the two charset values. Note that normally only one of this and getCharset1() is non-null.

Returns:
the second charset of this chat information block

getLanguage2

public final java.lang.String getLanguage2()
Returns the second of the two language code values. Note that normally only one of this and getLanguage1() is non-null. This is normally a two-character string such as "en" (for English).

Returns:
the second language code of this chat information block

getContentType

public final java.lang.String getContentType()
Returns the content type string contained in this chat information block. Note that this will normally be ChatMsg.CONTENTTYPE_DEFAULT for normal chat rooms and ChatMsg.CONTENTTYPE_SECURE for secure chat rooms. The returned value may also be null if no content type string was sent in this chat information block.

Returns:
the content type string contained in this chat information block

getSomething

public final int getSomething()
Returns a code of some sort. As of this writing I am unsure of the significance of this value. Note that this value will be -1 if no such value was included in this chat information block.

Returns:
some sort of code

toString

public java.lang.String toString()