net.kano.joscar.snaccmd.icbm
Class ParamInfo

java.lang.Object
  extended byParamInfo
All Implemented Interfaces:
LiveWritable, Writable

public class ParamInfo
extends java.lang.Object
implements Writable

A data structure containing various settings related to instant messaging.


Field Summary
static long FLAG_CHANMSGS_ALLOWED
          A bit mask indicating something.
static long FLAG_MISSEDCALLS_ALLOWED
          A bit mask indicating that receiving MissedMessagesCmds is supported.
static long FLAG_TYPING_NOTIFICATION
          A bit mask indicating that receiving RecvTypingNotifications is supported.
static int MAXCHAN_DEFAULT
          The value of "max channel" that the client must send when setting parameter information.
 
Constructor Summary
ParamInfo(int maxChannel, long flags, int maxMsgLen, int maxSenderWarning, int maxReceiverWarning, long minMsgInterval)
          Creates a new outgoing parameter information block with the given properties.
ParamInfo(long flags, int maxMsgLen, int maxSenderWarning, int maxReceiverWarning, long minMsgInterval)
          Creates a new outgoing parameter information block with the given properties and a "max channel" of MAXCHAN_DEFAULT.
 
Method Summary
 long getFlags()
          Returns the "flags" associated with this parameter information block.
 int getMaxChannel()
          Returns the maximum ICBM channel supported on this connection.
 int getMaxMsgLen()
          Returns the maximum length, in bytes, of an IM that can be sent to or from the client.
 int getMaxReceiverWarning()
          Returns the maximum warning level necessary for receiving IM's by the client or those sent by the client to another user, as a percentage times 10.
 int getMaxSenderWarning()
          Returns the maximum warning level necessary for sending IM's to or from the client, as a percentage times 10.
 long getMinMsgInterval()
          Returns the minimum time interval, in milliseconds, between any two messages sent or recieved by the client.
 long getWritableLength()
          Returns the length of the data that was or will be written in a call to write.
protected static ParamInfo readParamInfo(ByteBlock block)
          Returns an ICBM parameter information block read from the given block of binary data.
 java.lang.String toString()
           
 void write(java.io.OutputStream out)
          Writes a representation of this object to the given stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAXCHAN_DEFAULT

public static final int MAXCHAN_DEFAULT
The value of "max channel" that the client must send when setting parameter information.

See Also:
Constant Field Values

FLAG_CHANMSGS_ALLOWED

public static final long FLAG_CHANMSGS_ALLOWED
A bit mask indicating something. I'm not sure what this does, but it is normally on by default (that is, when AOL's AIM servers send a ParamInfoCmd, this bit is set.

See Also:
Constant Field Values

FLAG_MISSEDCALLS_ALLOWED

public static final long FLAG_MISSEDCALLS_ALLOWED
A bit mask indicating that receiving MissedMessagesCmds is supported.

See Also:
Constant Field Values

FLAG_TYPING_NOTIFICATION

public static final long FLAG_TYPING_NOTIFICATION
A bit mask indicating that receiving RecvTypingNotifications is supported.

See Also:
Constant Field Values
Constructor Detail

ParamInfo

public ParamInfo(long flags,
                 int maxMsgLen,
                 int maxSenderWarning,
                 int maxReceiverWarning,
                 long minMsgInterval)
Creates a new outgoing parameter information block with the given properties and a "max channel" of MAXCHAN_DEFAULT. Normally MAXCHAN_DEFAULT is required for setting parameter information as a client.

The value of the flags argument can be constructed as such:
new ParamInfo(ParamInfo.FLAGS_MISSEDCALLS_ALLOWED
        | ParamInfo.FLAGS_TYPING_NOTIFICATION
        | ParamInfo.FLAGS_CHANMSGS_ALLOWED, ...);
 

Parameters:
flags - a set of flags, like FLAG_TYPING_NOTIFICATION (WinAIM uses FLAGS_MISSEDCALLS_ALLOWED | FLAGS_TYPING_NOTIFICATION | FLAGS_CHANMSGS_ALLOWED)
maxMsgLen - the maximum length of an IM that can be sent from or to the client (WinAIM uses 8000)
maxSenderWarning - the maximum warning level of either the client or those sending messages to the client, as a percentage times ten (WinAIM uses 999, for 99.9%)
maxReceiverWarning - the maximum warning level of either the client or those to whom the client is sending messages, as a percentage times ten (WinAIM uses 999, for 99.9%)
minMsgInterval - the minimum time interval necessary for sending messages to or from the client, in milliseconds (WinAIM uses 0)

ParamInfo

public ParamInfo(int maxChannel,
                 long flags,
                 int maxMsgLen,
                 int maxSenderWarning,
                 int maxReceiverWarning,
                 long minMsgInterval)
Creates a new outgoing parameter information block with the given properties.

The value of the flags argument can be constructed as such:
     new ParamInfo(ParamInfo.FLAGS_MISSEDCALLS_ALLOWED
     | ParamInfo.FLAGS_TYPING_NOTIFICATION
     | ParamInfo.FLAGS_CHANMSGS_ALLOWED, ...);
 

Parameters:
maxChannel - the highest ICBM channel supported on this connection; note that this normally must be 0 when setting ICBM parameters as a client
flags - a set of flags, like FLAG_TYPING_NOTIFICATION (WinAIM uses FLAGS_MISSEDCALLS_ALLOWED | FLAGS_TYPING_NOTIFICATION | FLAGS_CHANMSGS_ALLOWED)
maxMsgLen - the maximum length of an IM that can be sent from or to the client (WinAIM uses 8000)
maxSenderWarning - the maximum warning level of either the client or those sending messages to the client, as a percentage times ten (WinAIM uses 999, for 99.9%)
maxReceiverWarning - the maximum warning level of either the client or those to whom the client is sending messages, as a percentage times ten (WinAIM uses 999, for 99.9%)
minMsgInterval - the minimum time interval necessary for sending messages to or from the client, in milliseconds (WinAIM uses 0)
Method Detail

readParamInfo

protected static ParamInfo readParamInfo(ByteBlock block)
Returns an ICBM parameter information block read from the given block of binary data.

Parameters:
block - the block of data containing ICBM parameter information
Returns:
an ICBM parameter information block read from the given data block

getMaxChannel

public final int getMaxChannel()
Returns the maximum ICBM channel supported on this connection. This is normally 2 when coming from a server, 0 when coming from a client.

Returns:
the maximum ICBM channel supported

getFlags

public final long getFlags()
Returns the "flags" associated with this parameter information block. This is normally a bitwise combination of FLAG_CHANMSGS_ALLOWED, FLAG_MISSEDCALLS_ALLOWED, and FLAG_TYPING_NOTIFICATION. The presence of these values can be accessed as such:
if ((paramInfo.getFlags() & ParamInfo.FLAG_TYPING_NOTIFICATION) != 0) {
    System.out.println("Typing notification is supported!");
}
 

Returns:
the ICBM parameter information flags

getMaxMsgLen

public final int getMaxMsgLen()
Returns the maximum length, in bytes, of an IM that can be sent to or from the client.

Returns:
the maximum length of an instant message to or from the client

getMaxSenderWarning

public final int getMaxSenderWarning()
Returns the maximum warning level necessary for sending IM's to or from the client, as a percentage times 10. This defaults to 999, for 99.9%.

Returns:
the maximum warning level necessary for sending IM's to or from the client

getMaxReceiverWarning

public final int getMaxReceiverWarning()
Returns the maximum warning level necessary for receiving IM's by the client or those sent by the client to another user, as a percentage times 10. This defaults to 999, for 99.9%.

Returns:
the maximum warning level necessary for receiving IM's by the client and receiving IM's sent by the client to another user

getMinMsgInterval

public final long getMinMsgInterval()
Returns the minimum time interval, in milliseconds, between any two messages sent or recieved by the client.

Returns:
the minimum message interval

getWritableLength

public long getWritableLength()
Description copied from interface: Writable
Returns the length of the data that was or will be written in a call to write. The value returned by this method must not change after its first invocation.

Specified by:
getWritableLength in interface Writable
Returns:
the length of the data to be written by write

write

public void write(java.io.OutputStream out)
           throws java.io.IOException
Description copied from interface: Writable
Writes a representation of this object to the given stream. The length of the data written by this function must match any value previously returned by getWritableLength.

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

toString

public java.lang.String toString()