1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-22 14:22:05 +01:00

Pass down Message stanza in ChatStateListener

Fixes SMACK-704.
This commit is contained in:
Florian Schmaus 2016-01-23 13:55:09 +01:00
parent 85e818cffb
commit 0761fe0dec
2 changed files with 6 additions and 4 deletions

View file

@ -19,6 +19,7 @@ package org.jivesoftware.smackx.chatstates;
import org.jivesoftware.smack.chat.Chat; import org.jivesoftware.smack.chat.Chat;
import org.jivesoftware.smack.chat.ChatMessageListener; import org.jivesoftware.smack.chat.ChatMessageListener;
import org.jivesoftware.smack.packet.Message;
/** /**
* Events for when the state of a user in a chat changes. * Events for when the state of a user in a chat changes.
@ -32,6 +33,7 @@ public interface ChatStateListener extends ChatMessageListener {
* *
* @param chat the chat in which the state has changed. * @param chat the chat in which the state has changed.
* @param state the new state of the participant. * @param state the new state of the participant.
* @message the message carrying the chat state.
*/ */
void stateChanged(Chat chat, ChatState state); void stateChanged(Chat chat, ChatState state, Message message);
} }

View file

@ -142,10 +142,10 @@ public final class ChatStateManager extends Manager {
return false; return false;
} }
private static void fireNewChatState(Chat chat, ChatState state) { private static void fireNewChatState(Chat chat, ChatState state, Message message) {
for (ChatMessageListener listener : chat.getListeners()) { for (ChatMessageListener listener : chat.getListeners()) {
if (listener instanceof ChatStateListener) { if (listener instanceof ChatStateListener) {
((ChatStateListener) listener).stateChanged(chat, state); ((ChatStateListener) listener).stateChanged(chat, state, message);
} }
} }
} }
@ -184,7 +184,7 @@ public final class ChatStateManager extends Manager {
return; return;
} }
fireNewChatState(chat, state); fireNewChatState(chat, state, message);
} }
} }
} }