org.walluck.oscar.handlers
Class LocateHandler

java.lang.Object
  extended by org.walluck.oscar.handlers.SNACHandler
      extended by org.walluck.oscar.handlers.LocateHandler

public class LocateHandler
extends SNACHandler

Family 0x0002 - Information.

The functions here are responsible for requesting and parsing information-gathering SNAC's. Or something like that.

Since:
1.0
Version:
1.0
Author:
David Walluck
See Also:
SNACHandler

Constructor Summary
LocateHandler()
          Family 0x0002.
 
Method Summary
 void getInfo(AIMSession sess, AIMConnection conn, String sn, int info)
          Subtype 0x0005 - Request info of another AIM user.
 void getInfo2(AIMSession sess, AIMConnection conn, String sn, int info)
          Send a new userinfo request.
 void handleSNAC(AIMSession sess, SNACHandler handler, AIMFrame frame, SNAC snac, AIMInputStream buffer)
          Handles incoming SNAC's.
 void reqLocateRights(AIMSession sess, AIMConnection conn)
          Subtype 0x0002 - Request location service rights.
 void setDirectoryInfo(AIMSession sess, AIMConnection conn, ODirInfo info, int privacy)
          Subtype 0x0009 - Set directory profile data.
 void setProfile(AIMSession sess, AIMConnection conn, String profileEncoding, String profile, String awayMsgEncoding, String awayMsg, int caps, byte[] encodedCertificate)
          Subtype 0x0004 - Gives BOS your profile.
 void setUserInterests(AIMSession sess, AIMConnection conn, ArrayList interests, int privacy)
          Subtype 0x000f - Set user interests.
 
Methods inherited from class org.walluck.oscar.handlers.SNACHandler
getFamily, getVersion, setFamily, setVersion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocateHandler

public LocateHandler()
Family 0x0002.

Method Detail

reqLocateRights

public void reqLocateRights(AIMSession sess,
                            AIMConnection conn)
                     throws IOException
Subtype 0x0002 - Request location service rights.

Parameters:
sess - the oscar session
conn - the bos connection for this session
Throws:
IOException - if an error occurs

setProfile

public void setProfile(AIMSession sess,
                       AIMConnection conn,
                       String profileEncoding,
                       String profile,
                       String awayMsgEncoding,
                       String awayMsg,
                       int caps,
                       byte[] encodedCertificate)
                throws IOException
Subtype 0x0004 - Gives BOS your profile.

profileEncoding and awayMsgEncoding must be set if profile or awayMsg are set, respectively, and their value may or may not be restricted to a few choices. I am currently aware of:

 us-ascii         Just that
 unicode-2-0      UCS2-BE
 

FIXME: This will not work with non-ASCII strings, which assumes that the string length can be used to calculated the bytes.

Parameters:
sess - the oscar session
conn - the bos connection for this session
profileEncoding - the profile encoding
profile - the profile message
awayMsgEncoding - the away message encoding
awayMsg - the away message if any
caps - your capabilities
encodedCertificate - the encoded certificate
Throws:
IOException - if an error occurs

getInfo

public void getInfo(AIMSession sess,
                    AIMConnection conn,
                    String sn,
                    int info)
             throws IOException
Subtype 0x0005 - Request info of another AIM user.

Parameters:
sess - the oscar session
conn - the bos connection for this session
sn - the screenname
info - the type of info to request
Throws:
IOException - if an error occurs
See Also:
AIMConstants

getInfo2

public void getInfo2(AIMSession sess,
                     AIMConnection conn,
                     String sn,
                     int info)
              throws IOException
Send a new userinfo request.

This is the way AIM 5.2 and up gets userinfo.

Parameters:
sess - the oscar session
conn - the bos connection for this session
sn - the screenname
info - the type of info to request
Throws:
IOException - if an error occurs

setDirectoryInfo

public void setDirectoryInfo(AIMSession sess,
                             AIMConnection conn,
                             ODirInfo info,
                             int privacy)
                      throws IOException
Subtype 0x0009 - Set directory profile data.

This is not the same as setProfile!

Parameters:
sess - the oscar session
conn - the bos connection for this session
info - directory info
privacy - privacy value: set to 1 to allow searching, or 0 to disallow searching.
Throws:
IOException - if an error occurs

setUserInterests

public void setUserInterests(AIMSession sess,
                             AIMConnection conn,
                             ArrayList interests,
                             int privacy)
                      throws IOException
Subtype 0x000f - Set user interests.

There is a hard limit of 5 interests in the API, but the actual limit may be a soft (client) limit.

Parameters:
sess - the oscar session
conn - the bos connection for this session
interests - a vector of interests (5 max)
privacy - privacy value
Throws:
IOException - if an error occurs

handleSNAC

public void handleSNAC(AIMSession sess,
                       SNACHandler handler,
                       AIMFrame frame,
                       SNAC snac,
                       AIMInputStream buffer)
                throws IOException
Handles incoming SNAC's.

Specified by:
handleSNAC in class SNACHandler
Parameters:
sess - the oscar session
handler - the handler
frame - the incoming frame
snac - the incoming SNAC
buffer - the incoming buffer
Throws:
IOException - if an error occurs