net.kano.joscar.snaccmd.conn
Class ServiceRequest

java.lang.Object
  extended bySnacCommand
      extended byConnCommand
          extended byServiceRequest

public class ServiceRequest
extends ConnCommand

A command sent to request an OSCAR server that supports a particular SNAC family. Normally responded-to with a ServiceRedirect.

See Also:
ServiceRedirect
Source of this SNAC:
AIM client
SNAC command type:
Family 0x01, command 0x04

Field Summary
 
Fields inherited from class ConnCommand
CMD_CLIENT_READY, CMD_CLIENT_VERS, CMD_ENCINFOACK, CMD_EXTRA_ACK, CMD_MIGRATE_PLS, CMD_MY_INFO_REQ, CMD_NOOP, CMD_PAUSE, CMD_PAUSE_ACK, CMD_RATE_ACK, CMD_RATE_CHG, CMD_RATE_INFO, CMD_RATE_REQ, CMD_RESUME, CMD_SERV_VERS, CMD_SERVER_READY, CMD_SERVICE_REDIR, CMD_SERVICE_REQ, CMD_SET_IDLE, CMD_SETENCINFO, CMD_SETEXTRAINFO, CMD_UPDATE, CMD_WARNED, CMD_YOUR_INFO, FAMILY_CONN, FAMILY_INFO
 
Fields inherited from class SnacCommand
SNACFLAG_DEFAULT
 
Constructor Summary
  ServiceRequest(int snacFamily)
          Creates a new service request command requesting the given SNAC family.
  ServiceRequest(int snacFamily, MiniRoomInfo roomInfo)
          Creates a new service request command requesting the given SNAC family and providing the given chat room information block.
  ServiceRequest(MiniRoomInfo roomInfo)
          Creates a new service request for the ChatCommand.FAMILY_CHAT family with the given chat room information block.
protected ServiceRequest(SnacPacket packet)
          Generates a new service request command from the given incoming SNAC packet.
 
Method Summary
 int getRequestedFamily()
          Returns the SNAC family requested in this service request.
 MiniRoomInfo getRoomInfo()
          Returns the chat room information block sent with this request, or null if none was sent.
 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
 

Constructor Detail

ServiceRequest

protected ServiceRequest(SnacPacket packet)
Generates a new service request command from the given incoming SNAC packet.

Parameters:
packet - the incoming service request packet

ServiceRequest

public ServiceRequest(int snacFamily)
Creates a new service request command requesting the given SNAC family.

Parameters:
snacFamily - the SNAC family to request

ServiceRequest

public ServiceRequest(MiniRoomInfo roomInfo)
Creates a new service request for the ChatCommand.FAMILY_CHAT family with the given chat room information block. Joining a chat room is simply a service request. See JoinRoomCmd and RoomResponse for details.

Using this constructor is equivalent to using new ServiceRequest(ChatCommand.FAMILY_CHAT, roomInfo).

Parameters:
roomInfo - the room information block for the room being joined

ServiceRequest

public ServiceRequest(int snacFamily,
                      MiniRoomInfo roomInfo)
Creates a new service request command requesting the given SNAC family and providing the given chat room information block. While snacFamily should normally be ChatCommand.FAMILY_CHAT if a room information block is sent, if you really want to you can make it whatever you want.

Parameters:
snacFamily - the SNAC family being requested
roomInfo - a chat room information block representing the room being joined
Method Detail

getRequestedFamily

public final int getRequestedFamily()
Returns the SNAC family requested in this service request.

Returns:
the requested SNAC family

getRoomInfo

public final MiniRoomInfo getRoomInfo()
Returns the chat room information block sent with this request, or null if none was sent.

Returns:
the associated chat room information block

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