mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-12-28 13:38:00 +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:
parent
8e750912a7
commit
1426964334
1 changed files with 4 additions and 3 deletions
|
@ -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<MessageListener> listeners = chat.getListeners();
|
||||
for (MessageListener listener : listeners) {
|
||||
for (MessageListener listener : chat.getListeners()) {
|
||||
if (listener instanceof ChatStateListener) {
|
||||
((ChatStateListener) listener).stateChanged(chat, state);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue