net.kano.joscar.ssiitem
Class PrivacyItem

java.lang.Object
  extended byAbstractItemObj
      extended byPrivacyItem
All Implemented Interfaces:
SsiItemObj

public class PrivacyItem
extends AbstractItemObj

An SSI item object containing various privacy-related settings.

Note that this class is only used to store data and that changes to this object are not reflected on the server without sending the changes to the server with a ModifyItemsCmd.


Field Summary
static int MODE_ALLOW_ALL
          A privacy mode under which the block list is ignored and thus no users are blocked.
static int MODE_ALLOW_BUDDIES
          A privacy mode under which all users not on one's buddy list are blocked.
static int MODE_ALLOW_PERMITS
          A privacy mode under which all users not on the "allow list" are blocked.
static int MODE_BLOCK_ALL
          A privacy mode under which all users are blocked.
static int MODE_BLOCK_DENIES
          A privacy mode under which only users on the block list are blocked.
static long VISMASK_HIDE_WIRELESS
          A visibility flag indicating that the fact that the user is or is not using a wireless/mobile device (cell phone) should be hidden from other users.
 
Constructor Summary
PrivacyItem(int id, int mode, long visibleMask)
          Creates a new privacy settings item object with the given properties and a visible class mask of FullUserInfo.MASK_ALL.
PrivacyItem(int id, int mode, long classMask, long visibleMask)
          Creates a new privacy settings item object with the given properties.
PrivacyItem(int id, int mode, long classMask, long visibleMask, TlvChain extraTlvs)
          Creates a new privacy settings item object with the given properties.
PrivacyItem(PrivacyItem other)
          Creates a new privacy settings item object with the same properties as the given object.
PrivacyItem(SsiItem item)
          Creates a new privacy settings item object generated from the given SSI item.
 
Method Summary
 long getClassMask()
          Returns this object's "visible class mask."
 int getId()
          Returns the item ID of this privacy settings item object.
 int getPrivacyMode()
          Returns this privacy settings object's (and, consequently, the user's) privacy mode.
 long getVisibleMask()
          Returns this object's "visibility settings mask."
 void setClassMask(long classMask)
          Sets the user's "visible class mask."
 void setPrivacyMode(int privacyMode)
          Sets this item's privacy mode code.
 void setVisibleMask(long visibleMask)
          Sets the user's "visibility flags."
 SsiItem toSsiItem()
          Returns an SsiItem that represents this item object.
 java.lang.String toString()
           
 
Methods inherited from class AbstractItemObj
addExtraTlvs, copyExtraTlvs, generateItem, generateSsiItems, getExtraTlvs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MODE_ALLOW_ALL

public static final int MODE_ALLOW_ALL
A privacy mode under which the block list is ignored and thus no users are blocked.

See Also:
Constant Field Values

MODE_BLOCK_ALL

public static final int MODE_BLOCK_ALL
A privacy mode under which all users are blocked.

See Also:
Constant Field Values

MODE_ALLOW_PERMITS

public static final int MODE_ALLOW_PERMITS
A privacy mode under which all users not on the "allow list" are blocked.

See Also:
Constant Field Values

MODE_BLOCK_DENIES

public static final int MODE_BLOCK_DENIES
A privacy mode under which only users on the block list are blocked.

See Also:
Constant Field Values

MODE_ALLOW_BUDDIES

public static final int MODE_ALLOW_BUDDIES
A privacy mode under which all users not on one's buddy list are blocked.

See Also:
Constant Field Values

VISMASK_HIDE_WIRELESS

public static final long VISMASK_HIDE_WIRELESS
A visibility flag indicating that the fact that the user is or is not using a wireless/mobile device (cell phone) should be hidden from other users.

See Also:
Constant Field Values
Constructor Detail

PrivacyItem

public PrivacyItem(SsiItem item)
Creates a new privacy settings item object generated from the given SSI item.

Parameters:
item - a privacy settings SSI item

PrivacyItem

public PrivacyItem(PrivacyItem other)
Creates a new privacy settings item object with the same properties as the given object.

Parameters:
other - a privacy settings item object to copy

PrivacyItem

public PrivacyItem(int id,
                   int mode,
                   long visibleMask)
Creates a new privacy settings item object with the given properties and a visible class mask of FullUserInfo.MASK_ALL.

Parameters:
id - the unique privacy item ID for this item
mode - the "privacy mode," like MODE_ALLOW_BUDDIES
visibleMask - a "visibility mask," like VISMASK_HIDE_WIRELESS

PrivacyItem

public PrivacyItem(int id,
                   int mode,
                   long classMask,
                   long visibleMask)
Creates a new privacy settings item object with the given properties.

Parameters:
id - the unique privacy item ID for this item
mode - the "privacy mode," like MODE_ALLOW_BUDDIES
classMask - a "class mask," like FullUserInfo.MASK_FREE | FullUserInfo.MASK_WIRELESS or (preferably) FullUserInfo.MASK_ALL
visibleMask - a "visibility mask," like VISMASK_HIDE_WIRELESS

PrivacyItem

public PrivacyItem(int id,
                   int mode,
                   long classMask,
                   long visibleMask,
                   TlvChain extraTlvs)
Creates a new privacy settings item object with the given properties.

Parameters:
id - the unique privacy item ID for this item
mode - the "privacy mode," like MODE_ALLOW_BUDDIES
classMask - a "class mask," like FullUserInfo.MASK_FREE | FullUserInfo.MASK_WIRELESS or (preferably) FullUserInfo.MASK_ALL
visibleMask - a "visibility mask," like VISMASK_HIDE_WIRELESS
extraTlvs - a list of extra TLV's to store in this item
Method Detail

getId

public final int getId()
Returns the item ID of this privacy settings item object.

Returns:
this privacy settings item object's item ID

getPrivacyMode

public final int getPrivacyMode()
Returns this privacy settings object's (and, consequently, the user's) privacy mode. Normally one of MODE_ALLOW_ALL, MODE_BLOCK_ALL, MODE_ALLOW_PERMITS, MODE_BLOCK_DENIES, and MODE_ALLOW_BUDDIES. This value will be -1 if no privacy mode code is stored in this item.

Returns:
the user's privacy mode, or -1 if none is stored in this item

getClassMask

public final long getClassMask()
Returns this object's "visible class mask." Normally a bitwise combination of any of the FullUserInfo.MASK_* constants.

To check for a specific class mask, you can use code resembling the following:
if ((privacyItem.getClassMask() & FullUserInfo.MASK_WIRELESS) != 0) {
    System.out.println("We are visible to wireless AIM users");
}
 
NOTE that this value might be -1, meaning that any bit mask will match. Always check for -1 before performing bitwise operations on this value.

A "visible class mask" describes, essentially, which users are blocked. WinAIM always sets this to allow all user classes (FullUserInfo.MASK_ALL), but if you really wanted to you could set yourself to be only visible to, for example, users who were either away or using AIM on a cell phone (using FullUserInfo.MASK_AWAY | FullUserInfo.MASK_WIRELESS).

Returns:
the user's "visible class mask," or -1 if no class mask is stored in this item

getVisibleMask

public final long getVisibleMask()
Returns this object's "visibility settings mask." Normally a bitwise combination of VISMASK_HIDE_WIRELESS. Well, okay, so it can't be a bitwise combination of one value. But in the future other flags could be added, so it's best to use bitwise comparisons on this value.

To check for a specific flag, you can use code resembling the following:
if ((privacyItem.getVisibleMask() & PrivacyItem.VISMASK_HIDE_WIRELESS) != 0) {
    System.out.println("No one knows if we are on a cell phone or not!");
}
 
NOTE that this value might be -1, meaning that any bit mask will match. Always check for -1 before performing bitwise operations on this value.

Returns:
the user's "visibility settings flags," or -1 if no visibility settings mask is stored in this item

setPrivacyMode

public final void setPrivacyMode(int privacyMode)
Sets this item's privacy mode code. privacyMode should normally be one of MODE_ALLOW_ALL, MODE_BLOCK_ALL, MODE_ALLOW_PERMITS, MODE_BLOCK_DENIES, and MODE_ALLOW_BUDDIES. privacyMode can be -1 to erase the privacy mode stored in this item.

Parameters:
privacyMode - a privacy mode code, or -1 to erase any privacy mode stored in this item

setClassMask

public final void setClassMask(long classMask)
Sets the user's "visible class mask." See above for details on what this means. classMask should normally be a bitwise combination of any of the FullUserInfo.MASK_* constants. classMask can also be -1 to erase the visible class mask stored in this item.

Parameters:
classMask - a new "visible class mask" to store in this privacy settings item, or -1 to erase any visible class mask stored in this item

setVisibleMask

public final void setVisibleMask(long visibleMask)
Sets the user's "visibility flags." See above for details on what this means as well as its normal values.

Parameters:
visibleMask - a new set of "visibility flags" to store in this privacy settings item

toSsiItem

public SsiItem toSsiItem()
Description copied from interface: SsiItemObj
Returns an SsiItem that represents this item object.

Returns:
an SsiItem that represents this item object

toString

public java.lang.String toString()