Smack

org.jivesoftware.smack
Class ChatManager

java.lang.Object
  extended by org.jivesoftware.smack.ChatManager

public class ChatManager
extends Object

The chat manager keeps track of references to all current chats. It will not hold any references in memory on its own so it is neccesary to keep a reference to the chat object itself. To be made aware of new chats, register a listener by calling addChatListener(ChatManagerListener).

Author:
Alexander Wenckus

Method Summary
 void addChatListener(ChatManagerListener listener)
          Register a new listener with the ChatManager to recieve events related to chats.
 void addOutgoingMessageInterceptor(PacketInterceptor packetInterceptor)
          Adds an interceptor which intercepts any messages sent through chats.
 void addOutgoingMessageInterceptor(PacketInterceptor packetInterceptor, PacketFilter filter)
           
 Chat createChat(String userJID, MessageListener listener)
          Creates a new chat and returns it.
 Chat createChat(String userJID, String thread, MessageListener listener)
          Creates a new chat using the specified thread ID, then returns it.
 Collection<ChatManagerListener> getChatListeners()
          Returns an unmodifiable collection of all chat listeners currently registered with this manager.
 Chat getThreadChat(String thread)
           
 void removeChatListener(ChatManagerListener listener)
          Removes a listener, it will no longer be notified of new events related to chats.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createChat

public Chat createChat(String userJID,
                       MessageListener listener)
Creates a new chat and returns it.

Parameters:
userJID - the user this chat is with.
listener - the listener which will listen for new messages from this chat.
Returns:
the created chat.

createChat

public Chat createChat(String userJID,
                       String thread,
                       MessageListener listener)
Creates a new chat using the specified thread ID, then returns it.

Parameters:
userJID - the jid of the user this chat is with
thread - the thread of the created chat.
listener - the listener to add to the chat
Returns:
the created chat.

getThreadChat

public Chat getThreadChat(String thread)

addChatListener

public void addChatListener(ChatManagerListener listener)
Register a new listener with the ChatManager to recieve events related to chats.

Parameters:
listener - the listener.

removeChatListener

public void removeChatListener(ChatManagerListener listener)
Removes a listener, it will no longer be notified of new events related to chats.

Parameters:
listener - the listener that is being removed

getChatListeners

public Collection<ChatManagerListener> getChatListeners()
Returns an unmodifiable collection of all chat listeners currently registered with this manager.

Returns:
an unmodifiable collection of all chat listeners currently registered with this manager.

addOutgoingMessageInterceptor

public void addOutgoingMessageInterceptor(PacketInterceptor packetInterceptor)
Adds an interceptor which intercepts any messages sent through chats.

Parameters:
packetInterceptor - the interceptor.

addOutgoingMessageInterceptor

public void addOutgoingMessageInterceptor(PacketInterceptor packetInterceptor,
                                          PacketFilter filter)

Smack

Copyright © 2003-2007 Jive Software.