Following is my scenario.
I have the following clients setup.
client1 = email@example.com
client 2= firstname.lastname@example.org
machine-A --- email@example.com\resource1 connected
machine-B --- firstname.lastname@example.org\resouce2 connected
machine-C --- email@example.com\adminResource1 connected
machine-D --- firstname.lastname@example.org\adminResource2 connected
When email@example.com\adminResource1 sends a message for the first time ever to the bare jid firstname.lastname@example.org 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 email@example.com\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 firstname.lastname@example.org\resource1 , all new messages coming from email@example.com\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 firstname.lastname@example.org]\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 email@example.com was from firstname.lastname@example.org\adminResource2 -- the message ends up to email@example.com\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 firstname.lastname@example.org\adminResource1, the reply message ends up in to the wrong admin client.
Any help or pointers to solve the issue will be greatly appreciated.