net.kano.joscar.snaccmd.icbm
Class WarnCmd

java.lang.Object
  extended bySnacCommand
      extended byIcbmCommand
          extended byWarnCmd

public class WarnCmd
extends IcbmCommand

A SNAC command used to "warn" another user.

See Also:
WarningNotification
Source of this SNAC:
AIM client
SNAC command type:
Family 0x04, command 0x08

Field Summary
static int CODE_ANONYMOUS
          An anonymity code indicating that this warning should be anonymous.
static int CODE_NOT_ANONYMOUS
          An anonymity code indicating that this warning should not be anonymous.
 
Fields inherited from class IcbmCommand
CMD_ICBM, CMD_MISSED, CMD_MSG_ACK, CMD_PARAM_INFO, CMD_PARAM_INFO_REQ, CMD_RECV_TYPING, CMD_RV_RESPONSE, CMD_SEND_ICBM, CMD_SEND_TYPING, CMD_SET_PARAM_INFO, CMD_WARN, FAMILY_ICBM, FAMILY_INFO
 
Fields inherited from class SnacCommand
SNACFLAG_DEFAULT
 
Constructor Summary
protected WarnCmd(SnacPacket packet)
          Generates a warn-user ocmmand from the given incoming SNAC packet.
  WarnCmd(java.lang.String warnee)
          Creates a new warning command to warn the given user non-anonymously.
  WarnCmd(java.lang.String warnee, boolean anonymous)
          Creates a new warning command to warn the given user, anonymously if anonymous is true.
  WarnCmd(java.lang.String warnee, int anonymityCode)
          Creates a new warning command to warn the given user with the given "anonymity code."
 
Method Summary
 int getAnonymityCode()
          Returns the "anonymity code" of this warning command.
 java.lang.String getWarnee()
          Returns the screenname of the user to be warned.
 boolean isAnonymous()
          Returns whether this warning was intended to be "anonymous."
 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
 

Field Detail

CODE_ANONYMOUS

public static final int CODE_ANONYMOUS
An anonymity code indicating that this warning should be anonymous.

See Also:
Constant Field Values

CODE_NOT_ANONYMOUS

public static final int CODE_NOT_ANONYMOUS
An anonymity code indicating that this warning should not be anonymous.

See Also:
Constant Field Values
Constructor Detail

WarnCmd

protected WarnCmd(SnacPacket packet)
Generates a warn-user ocmmand from the given incoming SNAC packet.

Parameters:
packet - an incoming warn-user packet

WarnCmd

public WarnCmd(java.lang.String warnee)
Creates a new warning command to warn the given user non-anonymously. Using this constructor is equvalent to using new WarnCmd(warnee, false).

Parameters:
warnee - the screenname of the user to warn

WarnCmd

public WarnCmd(java.lang.String warnee,
               boolean anonymous)
Creates a new warning command to warn the given user, anonymously if anonymous is true.

Parameters:
warnee - the screenname of the user to warn
anonymous - whether or not this warning should be "anonymous"

WarnCmd

public WarnCmd(java.lang.String warnee,
               int anonymityCode)
Creates a new warning command to warn the given user with the given "anonymity code." The anonymity code should normally be one of CODE_ANONYMOUS and CODE_NOT_ANONYMOUS.

Parameters:
warnee - the screenname of the user to warn
anonymityCode - a code indicating whether or not the warning should be anonymous
Method Detail

isAnonymous

public final boolean isAnonymous()
Returns whether this warning was intended to be "anonymous."

Returns:
whether this warning is anonymous

getAnonymityCode

public final int getAnonymityCode()
Returns the "anonymity code" of this warning command. Normally one of CODE_ANONYMOUS and CODE_NOT_ANONYMOUS.

Returns:
the anonymity code of this warning command

getWarnee

public final java.lang.String getWarnee()
Returns the screenname of the user to be warned.

Returns:
the screenname of the user being warned

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