Smack

org.jivesoftware.smackx
Class ChatStateManager

java.lang.Object
  extended by org.jivesoftware.smackx.ChatStateManager

public class ChatStateManager
extends java.lang.Object

Handles chat state for all chats on a particular Connection. This class manages both the packet extensions and the disco response neccesary for compliance with XEP-0085. NOTE: getInstance(org.jivesoftware.smack.Connection) needs to be called in order for the listeners to be registered appropriately with the connection. If this does not occur you will not receive the update notifications.

Author:
Alexander Wenckus
See Also:
ChatState, ChatStateExtension

Method Summary
 boolean equals(java.lang.Object o)
           
static ChatStateManager getInstance(Connection connection)
          Returns the ChatStateManager related to the Connection and it will create one if it does not yet exist.
 int hashCode()
           
 void setCurrentState(ChatState newState, Chat chat)
          Sets the current state of the provided chat.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ChatStateManager getInstance(Connection connection)
Returns the ChatStateManager related to the Connection and it will create one if it does not yet exist.

Parameters:
connection - the connection to return the ChatStateManager
Returns:
the ChatStateManager related the the connection.

setCurrentState

public void setCurrentState(ChatState newState,
                            Chat chat)
                     throws XMPPException
Sets the current state of the provided chat. This method will send an empty bodied Message packet with the state attached as a PacketExtension, if and only if the new chat state is different than the last state.

Parameters:
newState - the new state of the chat
chat - the chat.
Throws:
XMPPException - when there is an error sending the message packet.

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

Smack

Copyright © 2003-2007 Jive Software.