What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Need a bit of help with email addresses.

Need a bit of help with email addresses.
Author: Message:
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Need a bit of help with email addresses.
Because the email address of the sent message isn't provided you have to do a few checks on the message.

code:
var aEmailAddresses = new Array('johndoe@hotmail.com', 'billgates@microsoft.com');
var oChatWndMessageSent = {};

function OnEvent_ChatWndSendMessage(oChatWnd, sMessage) { oChatWndMessageSent[oChatWnd.Handle] = sMessage; }

function OnEvent_ChatWndReceiveMessage(oChatWnd, sOrigin, sMessage, nMessageType) {
    if ( oChatWndMessageSent[oChatWnd.Handle] !== sMessage && sOrigin !== Messenger.MyName ) {
        for ( var oContact = new Enumerator(oChatWnd.Contacts); !oContact.atEnd(); oContact.moveNext() ) {
            for ( var i in aEmailAddresses ) {
                if ( oContact.item().Email === aEmailAddresses[i] && oContact.item().Name === sOrigin) {
                    // do stuff here
                }
            }
        }
    }
}

function OnEvent_ChatWndDestroyed(oChatWnd) { delete oChatWndMessageSent[oChatWnd.Handle]; }

What this does is when you send a message it stores it in an object then because when you send a message the OnEvent_ChatWndSendMessage is called followed by the OnEvent_ChatWndReceiveMessage. So what we do is compare the sOrigin (which is the name) to your name and we check if the message that was "received" is the different from the message stored in the object. The OnEvent_ChatWndReceiveMessage occures when specific things are added to the chat history it isn't specifically when an instant message is received.

This post was edited on 04-16-2008 at 10:53 AM by matty.
04-16-2008 01:18 AM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Need a bit of help with email addresses. - by lol2112 on 04-15-2008 at 08:24 PM
RE: Need a bit of help with email addresses. - by matty on 04-16-2008 at 01:18 AM
RE: Need a bit of help with email addresses. - by lol2112 on 04-16-2008 at 04:38 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On