Javascript code:
function OnEvent_ChatWndSendMessage ( oChatWnd , sMessage ) {
if ( oChatWnd.Contacts.Count !== 1 ) return sMessage; // Don't bother doing anything if there is more than one contact in the conversation
// Get the contact object
var oContact = new Enumerator ( oChatWnd.Contacts ).item();
// Check if the user is online, if they are send the message
if ( oContact.Status === STATUS_ONLINE ) {
return sMessage;
}
else {
// If the contacts status isn't online then cancel the message.
return '';
}
}