com.valhalla.jbother.jabber
Class BuddyStatus

java.lang.Object
  extended byjava.util.Dictionary
      extended byjava.util.Hashtable
          extended bycom.valhalla.jbother.jabber.BuddyStatus
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable

public class BuddyStatus
extends java.util.Hashtable

Tracks a users different presences and resources

Version:
1.0
Author:
Adam Olsen
See Also:
Serialized Form

Constructor Summary
BuddyStatus(java.lang.String buddyId)
          Sets up the buddy container
 
Method Summary
 void addResource(java.lang.String resource, int priority, org.jivesoftware.smack.packet.Presence.Mode mode, java.lang.String statusMessage)
          Adds a resource to the tracker
 ConversationPanel getConversation()
          Gets the conversation window for this buddy
 java.lang.String getGroup()
          Gets the group the user is in in the Roster
 boolean getHasSignedOn()
           
 java.lang.String getHighestResource()
          Gets the resource with the higest priority
 java.lang.String getName()
           
 org.jivesoftware.smack.packet.Presence.Mode getPresence(java.lang.String resource)
          Gets the presence mode of the highest priority
 boolean getRemoved()
           
 org.jivesoftware.smack.RosterEntry getRosterEntry()
          Gets the roster entry for this user
 java.lang.String getStatusMessage(java.lang.String resource)
          Gets the status message of the highest resource
 java.lang.String getTempGroup()
          Returns the temporary group
 java.lang.String getUser()
           
 java.lang.String getVersionInfo()
           
 void removeResource(java.lang.String resource)
          Stops tracking a resource
 void resetBuddy()
          Resets the buddy so that it appears as though they never signed on
 void setConversation(ConversationPanel window)
          Sets the ConversationPanel for this buddy
 void setHasSignedOn(boolean on)
          Whether or not the user has signed on
 void setName(java.lang.String name)
           
 void setRemoved(boolean removed)
           
 void setTempGroup(java.lang.String group)
          Sets a temporary group name (if the user is displayed before the group actually changes on the server)
 void setUser(java.lang.String buddyId)
           
 void setVersionInfo(java.lang.String info)
          Sets the users jabber:iq:version information
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BuddyStatus

public BuddyStatus(java.lang.String buddyId)
Sets up the buddy container

Parameters:
buddyId - the buddy/user to track
Method Detail

getHighestResource

public java.lang.String getHighestResource()
Gets the resource with the higest priority

Returns:
the resource with the highest priority, or null if the user is offline

resetBuddy

public void resetBuddy()
Resets the buddy so that it appears as though they never signed on


addResource

public void addResource(java.lang.String resource,
                        int priority,
                        org.jivesoftware.smack.packet.Presence.Mode mode,
                        java.lang.String statusMessage)
Adds a resource to the tracker

Parameters:
resource - the resource name
priority - the priority level of this resource
mode - the current presence mode
statusMessage - the status message if there is one

getStatusMessage

public java.lang.String getStatusMessage(java.lang.String resource)
Gets the status message of the highest resource

Returns:
the status message of the highest resource, or an empty string if there is no status message

removeResource

public void removeResource(java.lang.String resource)
Stops tracking a resource

Parameters:
resource - the resource to remove

getPresence

public org.jivesoftware.smack.packet.Presence.Mode getPresence(java.lang.String resource)
Gets the presence mode of the highest priority

Returns:
the presence mode of the highest priority or null if the user is offline

setTempGroup

public void setTempGroup(java.lang.String group)
Sets a temporary group name (if the user is displayed before the group actually changes on the server)

Parameters:
group - the temporary group to use

getTempGroup

public java.lang.String getTempGroup()
Returns the temporary group

Returns:
the temp group

getGroup

public java.lang.String getGroup()
Gets the group the user is in in the Roster

Returns:
the group the user is in

getRosterEntry

public org.jivesoftware.smack.RosterEntry getRosterEntry()
Gets the roster entry for this user

Returns:
the RosterEntry for this user

setVersionInfo

public void setVersionInfo(java.lang.String info)
Sets the users jabber:iq:version information

Parameters:
info - the users jabber:iq:version information

getVersionInfo

public java.lang.String getVersionInfo()
Returns:
the users jabber:iq:version information

setHasSignedOn

public void setHasSignedOn(boolean on)
Whether or not the user has signed on

Parameters:
on - set to true if the user has signed on

getHasSignedOn

public boolean getHasSignedOn()
Returns:
true if the user has signed on

setRemoved

public void setRemoved(boolean removed)
Parameters:
removed - set to true if this user has been removed from the roster

getRemoved

public boolean getRemoved()
Returns:
true if the user has been removed from the roster

getName

public java.lang.String getName()
Returns:
the users alias

setName

public void setName(java.lang.String name)
Parameters:
name - the buddy's alias

setUser

public void setUser(java.lang.String buddyId)
Parameters:
buddyId - the userId

getUser

public java.lang.String getUser()
Returns:
the JID for this Buddy

setConversation

public void setConversation(ConversationPanel window)
Sets the ConversationPanel for this buddy

Parameters:
window - the conversation for this buddy

getConversation

public ConversationPanel getConversation()
Gets the conversation window for this buddy

Returns:
the conversation for this buddy