js code:
var oChatWnds = {};
function OnEvent_ChatWndCreated(oChatWnd) {
if (oChatWnd.Contacts.Count !== 1) return;
for (var oContact = new Enumerator(oChatWnd.Contacts); !oContact.atEnd(); oContact.moveNext()) {
if (oContact.item().Blocked === true) {
var tChatWnd = Messenger.OpenChat(oContact.item().Email.replace('@', '')+'@xXDarknessxx.chat.com')
oChatWnds[tChatWnd.Handle] = {};
oChatWnds[tChatWnd.Handle].ChatWnd = tChatWnd;
oChatWnds[tChatWnd.Handle].Email = oContact.item().Email;
Interop.Call('user32', 'SendMessageW', oChatWnd.Handle, 0x10 /* WM_CLOSE */,0,0);
}
}
}
function OnEvent_ChatWndSendMessage(oChatWnd, sMessage) {
if (oChatWnd.Contacts.Count !== 1) return;
for (var oContact = new Enumerator(oChatWnd.Contacts); !oContact.atEnd(); oContact.moveNext()) {
if (oContact.item().Email.indexOf('@xXDarknessxx.chat.com') !== -1) {
oContact.item().Blocked = false;
var tChatWnd = Messenger.OpenChat(oChatWnds[oChatWnd.Handle].Email)
tChatWnd.SendMessage(sMessage)
oContact.item().Blocked = true;
}
}
}
function OnEvent_ChatWndDestroyed(oChatWnd) {
delete oChatWnds[oChatWnd.Handle];
}
Something along those lines: