Following is my scenario.
I have the following clients setup.
client1 = firstname.lastname@example.org
client 2= email@example.com
machine-A — firstname.lastname@example.org\resource1 connected
machine-B — email@example.com\resouce2 connected
machine-C — firstname.lastname@example.org\adminResource1 connected
machine-D — email@example.com\adminResource2 connected
When firstname.lastname@example.org\adminResource1 sends a message for the first time ever to the bare jid email@example.com with threadId=ABC – one of the client’s on either machine A or B receive the message successfully with all the correct details including the thread id ABC. The reply to the first message by firstname.lastname@example.org\resource1 contains all the correct details including the corrent thread id, the correct sender jid and the correct receiver jid.
But after the first message has been received by email@example.com\resource1 , all new messages coming from firstname.lastname@example.org\resouce1 with new a new Thread Id for example DEF (As seen in the Raw Packet via Debug window) are received with the old thread id of the first message when they are received by the MessageListener’s chatCreated(Chat chat, boolean createdLocally) method.
Because of this when email@example.com]\resouce1 replies to the message for all other messages after the first message, the message goes to the wrong admin client. For example if the second message received by firstname.lastname@example.org was from email@example.com\adminResource2 – the message ends up to firstname.lastname@example.org\adminResource1 as I am thinking because the thread id being set on the outgoing message is that of the first message which was received from email@example.com\adminResource1, the reply message ends up in to the wrong admin client.
Any help or pointers to solve the issue will be greatly appreciated.