If you want to change a message before you send it, you can do this:
js code:
function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
return "This is the message that will be sent instead.";
}
Both you and the contact will see this message, but this only applies to message you send, not receive from a contact.
To change the appearance of a message from you or a contact, you can use this:
js code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MsgKind)
{
return "This is the message that will be displayed instead.";
}
Only you will see this message - the other contact will see the message they sent. Also, the changed message cannot be any longer than the original (otherwise, it'll be truncated).
To make an encrypter, you would need to encrypt the message in the SendMessage function, and then decrypt it in the ReceiveMessage function. When you send a message, the other contact would receive the encrypted message, and (assuming they have the script installed on their computer) it would be decrypted in the conversation. You would also see the decrypted message as it would be changed back as soon as it is sent.