From 0761fe0dec37d192c8b5ff177b2a3663581ddf00 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sat, 23 Jan 2016 13:55:09 +0100 Subject: [PATCH] Pass down Message stanza in ChatStateListener Fixes SMACK-704. --- .../jivesoftware/smackx/chatstates/ChatStateListener.java | 4 +++- .../jivesoftware/smackx/chatstates/ChatStateManager.java | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/chatstates/ChatStateListener.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/chatstates/ChatStateListener.java index 55a2841e7..4f1fe6f5c 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/chatstates/ChatStateListener.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/chatstates/ChatStateListener.java @@ -19,6 +19,7 @@ package org.jivesoftware.smackx.chatstates; import org.jivesoftware.smack.chat.Chat; import org.jivesoftware.smack.chat.ChatMessageListener; +import org.jivesoftware.smack.packet.Message; /** * 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 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); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/chatstates/ChatStateManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/chatstates/ChatStateManager.java index 95372e50d..ec15c1910 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/chatstates/ChatStateManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/chatstates/ChatStateManager.java @@ -142,10 +142,10 @@ public final class ChatStateManager extends Manager { 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()) { 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; } - fireNewChatState(chat, state); + fireNewChatState(chat, state, message); } } }