net.kano.joscar.snaccmd.loc
Class GetInfoCmd

java.lang.Object
  extended bySnacCommand
      extended byLocCommand
          extended byGetInfoCmd

public class GetInfoCmd
extends LocCommand

A SNAC command used by newer clients to request information about a buddy. This command is generally recommended over OldGetInfoCmd because it is normally not as heavily rate limited and because it allows one to retrieve a buddy's away message and user profile in a single command. This command is also the only known way to retrieve a buddy's security information.

Source of this SNAC:
AIM client
SNAC command type:
Family 0x02, command 0x15

Field Summary
static long FLAG_AWAYMSG
          A flag indicating that the user's away message is being requested.
static long FLAG_CERT
          A flag indicating that the user's security information is being requested.
static long FLAG_INFO
          A flag indicating that the user's user profile ("info") is being requested.
 
Fields inherited from class LocCommand
CMD_DIR_INFO, CMD_GET_DIR, CMD_INTEREST_ACK, CMD_NEW_GET_INFO, CMD_OLD_GET_INFO, CMD_RIGHTS_REQ, CMD_RIGHTS_RESP, CMD_SET_DIR, CMD_SET_DIR_ACK, CMD_SET_INFO, CMD_SET_INTERESTS, CMD_USER_INFO, FAMILY_INFO, FAMILY_LOC
 
Fields inherited from class SnacCommand
SNACFLAG_DEFAULT
 
Constructor Summary
  GetInfoCmd(long flags, java.lang.String sn)
          Creates a new outgoing get-user-info command with the given flags for the given screenname.
protected GetInfoCmd(SnacPacket packet)
          Creates a new get-user-info command from the given incoming get-user-info SNAC packet.
 
Method Summary
 long getFlags()
          Returns the request type flags sent in this command.
 java.lang.String getScreenname()
          Returns the screenname of the user whose information is being requested.
 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

FLAG_INFO

public static final long FLAG_INFO
A flag indicating that the user's user profile ("info") is being requested.

See Also:
Constant Field Values

FLAG_AWAYMSG

public static final long FLAG_AWAYMSG
A flag indicating that the user's away message is being requested.

See Also:
Constant Field Values

FLAG_CERT

public static final long FLAG_CERT
A flag indicating that the user's security information is being requested.

See Also:
Constant Field Values
Constructor Detail

GetInfoCmd

protected GetInfoCmd(SnacPacket packet)
Creates a new get-user-info command from the given incoming get-user-info SNAC packet.

Parameters:
packet - an incoming get-user-info SNAC packet

GetInfoCmd

public GetInfoCmd(long flags,
                  java.lang.String sn)
Creates a new outgoing get-user-info command with the given flags for the given screenname. Flags can be combined using bitwise operations, as follows:
void getInfoAndAwayMessage(String sn) {
    send(new GetInfoCmd(GetInfoCmd.FLAG_AWAYMSG
           | GetInfoCmd.FLAG_INFO, sn));
}
void getAwayMessage(String sn) {
    send(new GetInfoCmd(GetInfoCmd.FLAG_AWAYMSG, sn));
}
void getSecurityInfo(String sn) {
    send(new GetInfoCmd(GetInfoCmd.FLAG_CERT, sn));
}

Parameters:
flags - a set of bit flags, normally a bitwise combination of the FLAG_* constants defined in this class
sn - the screenname of the user whose information is being requested
Method Detail

getFlags

public final long getFlags()
Returns the request type flags sent in this command. This will normally be a bitwise combination of the FLAGS_* constants defined in this class. To check for the presence of a certain flag, one could use code such as the following:
if ((getInfoCmd.getFlags()
        & GetInfoCmd.FLAG_AWAYMSG) != 0) {
    System.out.println("user requested away message for "
            + getInfoCmd.getScreenname());
}

Returns:
the request type flags sent in this command

getScreenname

public final java.lang.String getScreenname()
Returns the screenname of the user whose information is being requested.

Returns:
the screenname of the user whose information is being requested

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