IF you will never encounter multiple contacts in one chat you can remove the for...loop:
code:
for(; !f.atEnd(); f.moveNext()) {
var contact1 = f.item();
if (contact == contact1.Email) {
Interop.Call("User32", "SendMessageA", chat.Handle, 0x10, 0, 0)
break;
}
}
thus, replace all the above with:
code:
var contact1 = f.item();
if (contact == contact1.Email) {
Interop.Call("User32", "SendMessageA", chat.Handle, 0x10, 0, 0)
}
or thus simple one line:
code:
if (contact == f.item().Email) Interop.Call("User32", "SendMessageA", chat.Handle, 0x10, 0, 0)