ChatStateManager requires: org.jivesoftware.smack.chat.Chat instead: org.jivesoftware.smack.chat2.Chat

Hi there,

I am trying to implement a chat composing indicator in a chat app, I recently updated my library from 4.2.0-beta2, to 4.2.0, and everything is ok, everything works perfect for me, there is just one detail that is giving me some problems, by the time that I want to do this:

ChatStateManager.getInstance(connection).setCurrentState(ChatState.composing, chat);

The problem with this is that now I am using this: org.jivesoftware.smack.chat2.Chat, but the ChatStateManager requires org.jivesoftware.smack.chat.Chat.

So my question would be, is there any kind of ChatStateManager in the package number 2?

is this a known problem? is there any work started to fix this?

Thanks for the help.

1 Like

Any workarounds for this issue?

There is actually a TODO in the code to fix this issue.
To me it looks like the problem is easy to work around though. It seems like the manager is just appending ExtensionElements to a message, which is then sent in the chat. You should easily be able to recreate the same behaviour just with the new chat class by looking at the code.

Or better: Create a pull request adding support for chat2 classes :wink:

I created https://github.com/igniterealtime/Smack/pull/193 to migrate the Chat State package to Chat2 API.

hi Paul
i was same problem
i wanna get display notification for update chat page or implement user is typing like whatsapp
but i don’ how
can you help my?

i use smack 4.2.2

I hope my fix will be included in the next release of Smack.