That code could be simplified even further. Look what I found in the documentation!
quote:
Contacts::GetContact
Return Value: A Contact object if the contact is found in the object's list, null otherwise.
You don't even need a loop to check whether that e-mail address is in the list of chat window contacts, just check that
Contacts.GetContact(sIgnoredEmail) is not null! Even better, you don't need that flag variable at all, just put that expression straight in the if-condition!
js code:
// check whether the ignored contact is in this chat
if (oChatWnd.Contacts.GetContact('gregorsturm12@hotmail.com') !== null) {
// send a message if the contact was found
oChatWnd.SendMessage('You are ignored');
}
Pretty nifty, uh?