Bug #244
Messages from other party not received when chat started from Beem
Description
When I start a chat from Beem, I don't receive messages from the other party, but if the other party starts a chat, it works fine.
To reproduce:
- Start Beem and log in
- Click on a contact to start a chat
- Send a message (the contact will receive this)
- Any response from the contact will not show up
I added some debug messages and re-compiled, and I believe this is what is happening:
When a chat is started with Beem, the participant passed to smack is "user@example.com", with no resource appended. When the user replies, smack starts a new chat with the participant "user@example.com/resource". Beem strips the resource when it looks up the existing chat, so it knows not to start a new chat. However, the problem is that smack has created two chats, and Beem has only associated its chat object with smack's first chat object (the one created for the outgoing chat with no resource appended).
If, however, the remote user starts the chat, then only one chat object is created (for the incoming message from "user@example.com/resource") and everything works.
I added a debugging message to BeemChatManager.ChatListener.chatCreated that shows what's going on:
(click on contact in Beem to start chat)
D/BeemChatManager( 1103): Get chat key = user@example.com
V/BeemChatManager( 1103): chat created locally org.jivesoftware.smack.Chat@437c5090 participant user@example.com
I/ActivityManager( 570): Displayed activity com.beem.project.beem/.ui.Chat: 284 ms
(remote user sends a message)
V/BeemChatManager( 1103): chat created non-locally org.jivesoftware.smack.Chat@437f7cd0 participant user@example.com/resource
I tested this with a locally compiled Beem from revision 673, ejabberd, and pidgin.
Related issues