It's not working, for two reasons (that I can see). Firstly, you are using the event Message Recieved. I am pretty sure that you wantto do this when a Message is Sent, not Recieved.
Secondly, you aren't returning anything. The run function returns the Message with gradient to the event function, but the event function doesn't return it. You have to either assign it to a vriable and return it, or just return it directly.
eg
code:
var Contact = e.item();
switch (Contact.Email)
{
case "email1@hotmail.com":
return run(ChatWnd, Message);
case "email2@hotmail.com":
return run(ChatWnd, Message);
}
alternatively
code:
var Contact = e.item();
var toReturn = Message;//return the original if email isn't in list
switch (Contact.Email)
{
case "email1@hotmail.com":
toReturn = run(ChatWnd, Message);
break;
case "email2@hotmail.com":
toReturn = run(ChatWnd, Message);
break;
}
return toReturn;
I would use the first one, but whichever you understand and like better.