net.kano.joscar.snaccmd
Class SnacFamilyInfoFactory

java.lang.Object
  extended bySnacFamilyInfoFactory

public final class SnacFamilyInfoFactory
extends java.lang.Object

Provides a means of generating a list of SnacFamilyInfo values that are compatible with the default implementations of SnacCommands in joscar. Note that this only provides a default set of SnacFamilyInfos and you are free to send whatever list of SnacFamilyInfos you please in ClientVersionsCmds and ClientReadyCmds; however, with different SNAC family versions often comes changes to the protocol, changes that the default SnacCommand implementations provided by joscar may not be able to handle.


Method Summary
static SnacFamilyInfo[] getDefaultFamilyInfos(int[] supportedFamilies)
          Returns a list of SNAC family version information objects given a list of supported families.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getDefaultFamilyInfos

public static SnacFamilyInfo[] getDefaultFamilyInfos(int[] supportedFamilies)
Returns a list of SNAC family version information objects given a list of supported families. See above for details. For each SNAC family code in the given list of supported families which is also supported by joscar, a single SnacFamilyInfo is returned, in the order that the supported family list was given.

A typical use of this method would be as follows:
void handleServerReadyCmd(ServerReadyCmd serverReadyCmd) {
    int[] families = serverReadyCmd.getSnacFamilies();
    SnacFamilyInfo[] familyInfos = SnacFamilyInfoFactory.getDefaultFamilyInfos(
            families);
    ClientVersionsCmd out = new ClientVersionsCmd(familyInfos);
     // ... send command ...
}
 

Parameters:
supportedFamilies - a list of supported families for which family information objects should be returned
Returns:
a list of SNAC family info objects corresponding to supported SNAC families in the given list of families