net.kano.joscar.snaccmd.search
Class SearchBuddiesCmd

java.lang.Object
  extended bySnacCommand
      extended bySearchCommand
          extended bySearchBuddiesCmd

public class SearchBuddiesCmd
extends SearchCommand

A SNAC command used to search for buddies by directory information, email address, or chat interests. Normally responded-to with a SearchResultsCmd.

See Also:
SearchResultsCmd
Source of this SNAC:
AIM client
SNAC command type:
Family 0x0f, command 0x02

Field Summary
static int TYPE_BY_DIRINFO
          A search type indicating a search based on directory information.
static int TYPE_BY_EMAIL_OR_INTEREST
          A search type indicating a search based on email address or a chat interests.
 
Fields inherited from class SearchCommand
CMD_INTERESTS, CMD_INTERESTS_REQ, CMD_RESULTS, CMD_SEARCH, FAMILY_INFO, FAMILY_SEARCH
 
Fields inherited from class SnacCommand
SNACFLAG_DEFAULT
 
Constructor Summary
  SearchBuddiesCmd(int type, java.lang.String email, java.lang.String interest, DirInfo dirInfo)
          Creates a new outgoing buddy search command with the given properties.
protected SearchBuddiesCmd(SnacPacket packet)
          Generates a new buddy search command from the given incoming SNAC packet.
 
Method Summary
static SearchBuddiesCmd createSearchByDirInfoCmd(DirInfo dirInfo)
          Creates a new outgoing buddy search command for buddies matching the given (non-null) fields in the given block of directory information.
static SearchBuddiesCmd createSearchByEmailCmd(java.lang.String email)
          Creates a new outgoing buddy search command for buddies with the given email address.
static SearchBuddiesCmd createSearchByInterestCmd(java.lang.String interest)
          Creates a new outgoing buddy search command for buddies with the given chat interest.
 DirInfo getDirInfo()
          Returns the set of directory information being searched for, if any.
 java.lang.String getEmail()
          Returns the email address being searched for, if any.
 java.lang.String getInterest()
          Returns the chat interest being searched for, if any.
 int getSearchType()
          Returns the type of search being performed.
 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

TYPE_BY_DIRINFO

public static final int TYPE_BY_DIRINFO
A search type indicating a search based on directory information.

See Also:
Constant Field Values

TYPE_BY_EMAIL_OR_INTEREST

public static final int TYPE_BY_EMAIL_OR_INTEREST
A search type indicating a search based on email address or a chat interests.

See Also:
Constant Field Values
Constructor Detail

SearchBuddiesCmd

protected SearchBuddiesCmd(SnacPacket packet)
Generates a new buddy search command from the given incoming SNAC packet.

Parameters:
packet - an incoming buddy search packet

SearchBuddiesCmd

public SearchBuddiesCmd(int type,
                        java.lang.String email,
                        java.lang.String interest,
                        DirInfo dirInfo)
Creates a new outgoing buddy search command with the given properties. Note that, normally, only one of email, interest, and dirInfo should be non-null, as AOL's servers only allow you to perform a search based on one of the three fields. See createSearchByEmailCmd(java.lang.String), createSearchByInterestCmd(java.lang.String), and createSearchByDirInfoCmd(net.kano.joscar.snaccmd.DirInfo) for more intuitive factory methods.

Parameters:
type - the type of search to perform, like TYPE_BY_DIRINFO
email - an email address to search for, or null for none
interest - a chat interest to search for, or null for none
dirInfo - a set of directory information to search for, or null for none
Method Detail

createSearchByEmailCmd

public static SearchBuddiesCmd createSearchByEmailCmd(java.lang.String email)
Creates a new outgoing buddy search command for buddies with the given email address.

Parameters:
email - the email address to search for
Returns:
a new outgoing buddy search command for buddies with the given email address

createSearchByInterestCmd

public static SearchBuddiesCmd createSearchByInterestCmd(java.lang.String interest)
Creates a new outgoing buddy search command for buddies with the given chat interest.

Parameters:
interest - the name of the chat interest to search for, like "Travel"
Returns:
a new outgoing buddy search command for buddies with the given chat interest

createSearchByDirInfoCmd

public static SearchBuddiesCmd createSearchByDirInfoCmd(DirInfo dirInfo)
Creates a new outgoing buddy search command for buddies matching the given (non-null) fields in the given block of directory information. Note that as few as one or as many as all of the fields of the given directory information block can be filled in; these will be the only ones used in the search.

Parameters:
dirInfo - the directory information whose matches should be found
Returns:
a new outgoing buddy search command for buddies matching the given set of directory information

getSearchType

public final int getSearchType()
Returns the type of search being performed. Normally one of TYPE_BY_DIRINFO and TYPE_BY_EMAIL_OR_INTEREST.

Returns:
the type of search being performed

getEmail

public final java.lang.String getEmail()
Returns the email address being searched for, if any.

Returns:
the email address being searched for

getInterest

public final java.lang.String getInterest()
Returns the chat interest being searched for, if any.

Returns:
the chat interest being searched for

getDirInfo

public final DirInfo getDirInfo()
Returns the set of directory information being searched for, if any.

Returns:
the set of directory information being searched for

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