Hello.
1) Two private chat windows opening isn’t correct behavior and I can’t reproduce it on my localhost or any other site. This was issue with one older version, 3.00 I believe I’ve fixed it in 3.01 and current version is 4.01. You can reproduce this issue every time? If yes these are my thoughts on this. There could be some kind of conflict where some other plugin javascript triggers extra click event but not likely. If you can’t reproduce it every time it is possible that one I call it “system message” got lost. To emulate private chat invitations QC sends messages with json payload and keeps private chat invitation queues on both sides. I one side didn’t get invitation or sender didn’t receive back it’s own pvt invitation that could mess up other invitation queue to result in two windows being open. But this all stands only if it isn’t reproducible every time.
2) Yes that would actually make code simpler because there wouldn’t be need for pvt chat invitation queues on both sides. Take a look at quick_chat.private_queue and quick_chat.private_current objects in quick-chat-core.dev.js For more on private chat internals please take a look at my last reply to this thread. The meat of pvt chat is quick_chat.update_messages where it detect is message system message caring json payload to process into queue or regular message etc.
3. You could tap into code mentioned under 2) quick_chat.update_messages ajax success callback where you have:
if(updates[i].alias != 'quick_chat'){
// Regular message
} else if(quick_chat.last_timestamp != 0){
/* System message has sender name 'quick_chat' and here it Json decodes updates[i].message and see if it's pvt invitation, from whom it is and stores it in quick_chat.private_queue or starts private chat if it finds existing inv. from same user etc... quick_chat.last_timestamp != 0 is there to prevent processing old system message on first load, first load has quick_chat.last_timestamp == 0 */
}
It’s a lot of code, I wrote most of it a year ago so now I would probably do some things differently.
Hope this helps,
regards