quote:
Originally posted by matty
With that said this is the easiest way of knowing if you sent the message. If the messages do not match well than you know you didn't send it.
Unfortunatly, I see you use that kind of approach in many example codes of yours. Although it would work in theory, it is not implemented properly in any of your example codes and thus will not work properly!
You will get into trouble when the contact sends the same message (at a certain point in time) as you last did:
You: Type the next command to initiate the transfer:
You: !start
Contact: Ah, ok, thanks. I'l send the command now
Contact: !start
Contact: nothing happened
You: Hmm, the code in OnEvent_ChatWndReceiveMessage was never executed...
...
^^ the above scenario will show exactly what I mean...
To solve that you must delete
oChatWnds[pChatWnd.Handle] before you return with
sMessage in
OnEvent_ChatWndReceiveMessagejs code:
function OnEvent_ChatWndReceiveMessage(pChatWnd, sOrigin, sMessage, nMessageKind ) {
if (oChatWnds[pChatWnd.Handle] === sMessage ) {
>>>delete oChatWnds[pChatWnd.Handle];<<<
return sMessage; // Since we just send this message we can ignore it
}
...
}