net.kano.joscar.ssiitem
Class VisibilityItem

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

public class VisibilityItem
extends AbstractItemObj

An SSI item object representing a set of "visibility settings." The difference between the types of data stored in this type of item and those stored in PrivacyItem is very fine; in fact, in this author's opinion, they should be combined.

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 long MASK_SHOW_IDLE_TIME
          A visibility settings flag indicating that the user's idle time should be visible to other AIM users.
static long MASK_SHOW_TYPING
          A visibility settings flag indicating that the user's typing status should be visible to other users.
 
Constructor Summary
VisibilityItem(int id, long flags)
          Creates a new visibility settings item object with the given SSI item ID and the given set of visibility flags.
VisibilityItem(int id, long flags, TlvChain extraTlvs)
          Creates a new visibility settings item object with the given SSI item ID and the given set of visibility flags.
VisibilityItem(SsiItem item)
          Creates a new visibility settings item object generated from from the data in the given SSI item block.
VisibilityItem(VisibilityItem other)
          Creates a new visibility settings item object with the same properties as the given item object.
 
Method Summary
 int getId()
          Returns the SSI item ID of this visibility settings item.
 long getVisFlags()
          Returns the set of visibility flags.
 void setVisFlags(long flags)
          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

MASK_SHOW_IDLE_TIME

public static final long MASK_SHOW_IDLE_TIME
A visibility settings flag indicating that the user's idle time should be visible to other AIM users.

See Also:
Constant Field Values

MASK_SHOW_TYPING

public static final long MASK_SHOW_TYPING
A visibility settings flag indicating that the user's typing status should be visible to other users.

See Also:
SendTypingNotification, Constant Field Values
Constructor Detail

VisibilityItem

public VisibilityItem(SsiItem item)
Creates a new visibility settings item object generated from from the data in the given SSI item block.

Parameters:
item - a visibility settings SSI item

VisibilityItem

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

Parameters:
other - a visibility settings item object to copy

VisibilityItem

public VisibilityItem(int id,
                      long flags)
Creates a new visibility settings item object with the given SSI item ID and the given set of visibility flags.

Parameters:
id - the SSI item ID for this item
flags - the set of visibility flags, like MASK_SHOW_IDLE_TIME | MASK_SHOW_TYPING

VisibilityItem

public VisibilityItem(int id,
                      long flags,
                      TlvChain extraTlvs)
Creates a new visibility settings item object with the given SSI item ID and the given set of visibility flags.

Parameters:
id - the SSI item ID for this item
flags - the set of visibility flags, like MASK_SHOW_IDLE_TIME | MASK_SHOW_TYPING
extraTlvs - a list of extra TLV's to store in this item
Method Detail

getId

public final int getId()
Returns the SSI item ID of this visibility settings item.

Returns:
this item's SSI item ID

getVisFlags

public final long getVisFlags()
Returns the set of visibility flags. Normally a bitwise combination of any of MASK_SHOW_IDLE_TIME and MASK_SHOW_TYPING. To check for a specific flag, you could use code resembling the following:
if ((visItem.getVisFlags() & VisibilityItem.MASK_SHOW_TYPING) {
    System.out.println("We should send typing notifications to buddies!");
}
 

Returns:
the set of visibility flags stored in this item

setVisFlags

public final void setVisFlags(long flags)
Sets the user's visibility flags. See getVisFlags() for details on this value's meaning.

Parameters:
flags - this item's new visibility flags, like MASK_SHOW_IDLE_TIME | MASK_SHOW_TYPING

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