private void fireNewChatState(Chat chat, ChatState state) { for (MessageListener listener : chat.getListeners()) { if (listener instanceof ChatStateListener) { ((ChatStateListener) listener).stateChanged(chat, state); } } }