com.valhalla.jbother.jabber
Class BuddyStatus

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable
          extended by com.valhalla.jbother.jabber.BuddyStatus
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map
Direct Known Subclasses:
MUCBuddyStatus

public class BuddyStatus
extends java.util.Hashtable

Tracks a users different presences and resources

Version:
1.1
Author:
Adam Olsen, Andrey Zakirov
See Also:
Serialized Form

Field Summary
protected  boolean askForDelivered
           
protected  boolean askForDisplayed
           
protected  boolean askForOffline
           
protected  java.lang.String composingId
           
protected  ConversationPanel conversation
           
protected  boolean encrypting
           
protected  org.jivesoftware.smack.RosterEntry entry
           
protected  boolean hasSignedOn
           
protected  java.lang.String name
           
protected  java.util.Hashtable notDisplayedMessages
           
protected  java.util.Hashtable presences
           
protected  java.lang.String pubKeyId
           
protected  boolean removed
           
protected  java.lang.String resources
           
protected  java.util.ResourceBundle sources
           
protected  java.util.Properties statusMessages
           
protected  java.lang.String tempGroup
           
protected  java.lang.String userId
           
protected  java.lang.String versionInfo
           
 
Constructor Summary
BuddyStatus(java.lang.String buddyId)
          Sets up the buddy container
 
Method Summary
 void addNotDisplayedID(java.lang.String packetID, java.lang.String from)
           
 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
 java.lang.String getAddress()
           
 java.lang.String getComposingID()
           
 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
 java.lang.String getPubKey()
          Gets Public Key ID
 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()
           
 boolean isAskForDelivered()
           
 void isAskForDelivered(boolean variant)
           
 boolean isAskForDisplayed()
           
 void isAskForDisplayed(boolean variant)
           
 boolean isAskForOffline()
           
 void isAskForOffline(boolean variant)
           
 boolean isEncrypting()
          Gets the encryption status
 void isEncrypting(boolean variant)
          Sets the encryption status
 void newPubKey()
          Creates Public Key ID
 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 sendNotDisplayedID()
           
 void setComposingID(java.lang.String id)
           
 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 setPubKey(java.lang.String Id)
          Sets Public Key ID
 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
 

Field Detail

sources

protected java.util.ResourceBundle sources

userId

protected java.lang.String userId

conversation

protected ConversationPanel conversation

name

protected java.lang.String name

removed

protected boolean removed

hasSignedOn

protected boolean hasSignedOn

resources

protected java.lang.String resources

presences

protected java.util.Hashtable presences

statusMessages

protected java.util.Properties statusMessages

tempGroup

protected java.lang.String tempGroup

versionInfo

protected java.lang.String versionInfo

composingId

protected java.lang.String composingId

encrypting

protected boolean encrypting

askForDelivered

protected boolean askForDelivered

askForDisplayed

protected boolean askForDisplayed

askForOffline

protected boolean askForOffline

notDisplayedMessages

protected java.util.Hashtable notDisplayedMessages

pubKeyId

protected java.lang.String pubKeyId

entry

protected org.jivesoftware.smack.RosterEntry entry
Constructor Detail

BuddyStatus

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

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

setComposingID

public void setComposingID(java.lang.String id)

getComposingID

public java.lang.String getComposingID()

addNotDisplayedID

public void addNotDisplayedID(java.lang.String packetID,
                              java.lang.String from)

sendNotDisplayedID

public void sendNotDisplayedID()

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

getAddress

public java.lang.String getAddress()

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

isEncrypting

public boolean isEncrypting()
Gets the encryption status

Returns:
encryption status

isEncrypting

public void isEncrypting(boolean variant)
Sets the encryption status

Parameters:
variant - encryption status

isAskForDelivered

public boolean isAskForDelivered()

isAskForDelivered

public void isAskForDelivered(boolean variant)

isAskForDisplayed

public boolean isAskForDisplayed()

isAskForDisplayed

public void isAskForDisplayed(boolean variant)

isAskForOffline

public boolean isAskForOffline()

isAskForOffline

public void isAskForOffline(boolean variant)

getPubKey

public java.lang.String getPubKey()
Gets Public Key ID

Returns:
public key ID

setPubKey

public void setPubKey(java.lang.String Id)
Sets Public Key ID

Parameters:
ID - public key ID

newPubKey

public void newPubKey()
Creates Public Key ID