Shoutbox

HELP - Email from OnEvent_ChatWndReceiveMessage! - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: HELP - Email from OnEvent_ChatWndReceiveMessage! (/showthread.php?tid=90637)

HELP - Email from OnEvent_ChatWndReceiveMessage! by whiz on 05-14-2009 at 07:16 PM

Javascript code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MsgKind)

The "Origin" variable outputs the contact's name.  Is it possible to get their email address instead?
RE: HELP - Email from OnEvent_ChatWndReceiveMessage! by SmokingCookie on 05-14-2009 at 07:44 PM

Indirectly, yes it is:

JScript code:
function OnEvent_ChatWndReceiveMessage(obj,orig,msg,k) {
    var Emails = new Array();
    for(var e = new Enumerator(obj.Contacts; !e.atEnd(); e.moveNext()) {
        Emails.push(e.item().Email);
    }
}


The Emails array contains all email addresses. I suppose you know how to use 'em from now on?
RE: HELP - Email from OnEvent_ChatWndReceiveMessage! by whiz on 05-14-2009 at 07:56 PM

So, that will get the email address from the contact window, yes?


RE: HELP - Email from OnEvent_ChatWndReceiveMessage! by matty on 05-14-2009 at 08:03 PM

The code that was posted will get ALL users emails that are participating in the conversation (aside from your own).

There is no real reliable way of doing this especially if it is a multi contact chat.

Also note that ChatWndReceiveMessage will fire when you send a message as well. This event is fired when some text is added to the History of the chat.


RE: HELP - Email from OnEvent_ChatWndReceiveMessage! by Jesus on 05-14-2009 at 08:04 PM

It will get the email addresses from ALL contacts in the chatwnd.
You can compare it to the Origin variable of the OnEvent_ChatWndReceiveMessage function, but if for example two contacts have the same name then you could get the wrong contact.

In short, it will work, but it's not fool proof.


RE: HELP - Email from OnEvent_ChatWndReceiveMessage! by roflmao456 on 05-14-2009 at 08:06 PM

JScript code:
function OnEvent_ChatWndReceiveMessage(obj,orig,msg,k) {
    var Emails = new Array();
    var OriginEmail = "";
    for(var e = new Enumerator(obj.Contacts); !e.atEnd(); e.moveNext()) {
        Emails.push(e.item().Email);
        if(e.item().Name == orig)OriginEmail = e.item().Email;
    }
}


i guess that will work :P

note: it won't work with contacts that have the same name

edit: if you want to limit it to only a one-on-one conversation, just check if obj.Contacts.count == 1
RE: HELP - Email from OnEvent_ChatWndReceiveMessage! by whiz on 05-14-2009 at 08:10 PM

Ok, thanks all!  :)