From 1426964334c5ca787fff17cbeeb2b8c7630db7fa Mon Sep 17 00:00:00 2001 From: Alex Wenckus Date: Wed, 17 Jan 2007 17:35:45 +0000 Subject: [PATCH] Add service discovery feature for chat state git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@6710 b35dd754-fafc-0310-a699-88a17e54d16e --- source/org/jivesoftware/smackx/ChatStateManager.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/org/jivesoftware/smackx/ChatStateManager.java b/source/org/jivesoftware/smackx/ChatStateManager.java index 9811b8f91..72e7c2333 100644 --- a/source/org/jivesoftware/smackx/ChatStateManager.java +++ b/source/org/jivesoftware/smackx/ChatStateManager.java @@ -31,7 +31,6 @@ import org.jivesoftware.smackx.packet.ChatStateExtension; import java.util.Map; import java.util.WeakHashMap; -import java.util.Collection; /** * Handles chat state for all chats on a particular XMPPConnection. This class manages both the @@ -83,6 +82,9 @@ public class ChatStateManager { connection.getChatManager().addOutgoingMessageInterceptor(outgoingInterceptor, filter); connection.getChatManager().addChatListener(incomingInterceptor); + + ServiceDiscoveryManager.getInstanceFor(connection) + .addFeature("http://jabber.org/protocol/chatstates"); } /** @@ -104,8 +106,7 @@ public class ChatStateManager { } private void fireNewChatState(Chat chat, ChatState state) { - Collection listeners = chat.getListeners(); - for (MessageListener listener : listeners) { + for (MessageListener listener : chat.getListeners()) { if (listener instanceof ChatStateListener) { ((ChatStateListener) listener).stateChanged(chat, state); }