First of all, Messenger.MyUserId is not going to equal the origin unless someone has set their name to it
(typo/mixup?).
Also, there's an easier method. If you're trying to just find which message is yours, you can do this:
code:
var bSent = false; // a global variable
function OnEvent_ChatWndSendMessage(ChatWnd, Message){
bSent = true; // we've sent a message so set bSent to true
}
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind){
if(bSent){ // if bSent is true, meaning we just sent a message
bSent = false; // we caught our message so reset it
} else {
// a contact sent the message, so do whatever
}
}
This code ignores the first message that's been received after you send one, which is almost always yours because messenger places your sent message into the textbox immediately after you press Send or Enter.