1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-12-23 21:17:58 +01:00

Add service discovery feature for chat state

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@6710 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Alex Wenckus 2007-01-17 17:35:45 +00:00 committed by alex
parent 8e750912a7
commit 1426964334

View file

@ -31,7 +31,6 @@ import org.jivesoftware.smackx.packet.ChatStateExtension;
import java.util.Map; import java.util.Map;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import java.util.Collection;
/** /**
* Handles chat state for all chats on a particular XMPPConnection. This class manages both the * 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, connection.getChatManager().addOutgoingMessageInterceptor(outgoingInterceptor,
filter); filter);
connection.getChatManager().addChatListener(incomingInterceptor); 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) { private void fireNewChatState(Chat chat, ChatState state) {
Collection<MessageListener> listeners = chat.getListeners(); for (MessageListener listener : chat.getListeners()) {
for (MessageListener listener : listeners) {
if (listener instanceof ChatStateListener) { if (listener instanceof ChatStateListener) {
((ChatStateListener) listener).stateChanged(chat, state); ((ChatStateListener) listener).stateChanged(chat, state);
} }