Shoutbox

coding problem - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: coding problem (/showthread.php?tid=93902)

coding problem by scripto on 02-20-2010 at 12:15 PM

am new into msgplus scripts but am learning fast
the first time i experienced with a script i had an idea, more like a project... some already did it over here but i decided to do it by my self, like a challenge for me and to learn more....

it's an encryption/decryption tools

am having a problem and it's the following
i want to decrypt the message b4 sending it but the sender have to see it in he's chat box in clear text but it have to be sent in cipher text...
and vise versa, on the receiver side the msg have to be decrypted and then displayed in the receiver box...
How can i grab the incoming message and manipulate it and then display it ?
and how can i display it manipulate it and then send it?

so what class or functions i need for that

P.S am a beginner... if anyone have some time to help me PM for my e-mail...


RE: coding problem by whiz on 02-20-2010 at 12:57 PM

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.
RE: coding problem by billyy on 02-20-2010 at 01:02 PM

Oh wow thats sweet i was wondering about that O_o
Ty Whiz!


RE: coding problem by scripto on 02-21-2010 at 12:31 AM

mm ok one more question... i wanna make applicable on a specified conversation...
assuming i knw that X have the script installed... therefor i want the encryption script to be enabled in his conversation windows only...
how can that be done


RE: coding problem by djdannyp on 02-21-2010 at 12:45 AM

You could use something like:

java code:
function OnEvent_ContactSignin(sEmail) {
    if ( sEmail === 'contact@hotmail.com' ) ....
}

RE: coding problem by CookieRevised on 02-21-2010 at 02:59 AM

quote:
Originally posted by djdannyp
You could use something like:
js code:
function OnEvent_ContactSignin(sEmail) {
    if ( sEmail === 'contact@hotmail.com' ) ....
}

Wont work for what he wants to do...

-------------

scripto, there is a whole lot more to it than just what whiz has told you.

Making a decent encryption script is not easy at all and there are a hell of a lot tidbits you need to take into account. Even for experienced programmers it proves to be very difficult to get things right (see some of the existing scripts involving the things you want to do).

Not only are there things like the changed text can't be larger than the recieved text, but there is also no easy way to check if a message came from you or from a contact. Especially considering the differences between Nickname feature, Chat-only names and Screen names of you and your contacts (there are some specific threads on the scripting forums about that).

On top of that, it is even not straitforward to get the email address from the person who sends the text, which is what you need to do if you only want the encryption enabled for a certain contact.

In fact, in certain situations it proves to be extremely hard, if not impossible, to get a true correct answer. eg: considering contacts can come from different networks and thus have actually the same email address in your contact list (eg: Yahoo contacts), and this will only getting more complicated with future versions of Messenger.

Thus, throwing in enabling and disabling features, encryption per contact, etc only makes things a lot more complicated and you'll be in for a very steep learning curve.

Not to mention things like multi-contact conversations, etc. And since you can not change recieved text to text which is longer, it is also quite difficult to get something secure in regards to encryption. Making the whole idea of having an encrypted conversation a bit redundant as it will never be really secure anyways.

So, since you said you're just a beginning scripter I would actually suggest to drop the whole idea and start on something far more easier first.