View Single Post
Old 01-01-2008   #3 (permalink)
Matti-Koopa


 
 

Re: We cannot encrypt & decrypt messages in messenger with our dll fil

Look here:
http://forums.microsoft.com/MSDN/Sho...45980&SiteID=1

Sadly the add-in function of WLM is very limited and still very 'bugy'.
It isn't really supported and documented as well that makes it even harder.

I am writing an add-in for WLM as well but I couldn't do that without
external COM-features.
Maybe you have to find an alternative way to send your messages out. But
that wouldn't be easy.


"POLAT" <POLAT@xxxxxx> wrote in message
news:66B33A83-90C9-4BA9-A1D9-9BB80F064939@xxxxxx
Quote:

> using System;
> using System.Collections.Generic;
> using System.Text;
> using Microsoft.Messenger;
> using System.Windows.Forms;
>
> public class Konusma : IMessengerAddIn
> {
>
> private MessengerClient _client = null;
>
> string[] ary = { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
> "l", "m", "n", "o", "p", "r", "s", "t", "u", "v", "y", "z" };
>
> public string encrypt(string str)
> {
> int i = 0; int j = 0; string str1 = "";
> for (i = 0; i < str.Length; i++)
> {
> for (j = 0; j < 23; j++)
> {
> if (str.Substring(i, 1) == ary[j])
> str1 = str1 + ary[(j + 3 + 23) % 23];
> }
> }
> return str1;
> }
>
>
> public string decrypt(string str)
> {
> int i = 0; int j = 0; string str1 = "";
> for (i = 0; i < str.Length; i++)
> {
> for (j = 0; j < 23; j++)
> {
> if (str.Substring(i, 1) == ary[j])
> str1 = str1 + ary[(j - 3 + 23) % 23];
> }
> }
> return str1;
> }
>
> public void Initialize(MessengerClient messenger)
> {
> Client = messenger;
> initAddin();
> }
>
> public MessengerClient Client
> {
> get
> {
> return _client;
> }
> private set
> {
> _client = value;
> }
> }
>
> private void initAddin()
> {
>
> Client.AddInProperties.Status = UserStatus.Online;
>
>
>
> Client.IncomingTextMessage += new
> EventHandler<IncomingTextMessageEventArgs>(Client_IncomingTextMessage);
>
> Client.OutgoingTextMessage += new
> EventHandler<OutgoingTextMessageEventArgs>(Client_OutgoingTextMessage);
>
> }
>
>
> void Client_OutgoingTextMessage(object sender,
> OutgoingTextMessageEventArgs e)
> {
> //string cipherText = encrypt(e.TextMessage);
> //e.Cancel = true;
> //MessageBox.Show("Cipher text length(" + cipherText + ") is: " +
> cipherText.Length);
> //Client.SendTextMessage(cipherText, e.UserTo);
> }
>
>
> void Client_IncomingTextMessage(object sender,
> IncomingTextMessageEventArgs e)
> {
>
> string plainText = decrypt(e.TextMessage);
> MessageBox.Show("Plain text length(" + plainText + ") is: " +
> plainText.Length);
> MessageBox.Show(plainText);
>
> }
>
>
> }
>
> ****************************************
> Hi,
> Our problem is that if two messenger client (e.g. one is called Bob and
> the
> other is called Jane) (Both of them use dll file as shown above) and if
> Bob
> writes sth obviously dll takes it and encrypt this according to encrypt
> function , but Jane gets encrypted message but Incoming_Message function
> is
> not working. So Jane just gets encrypted message. Our aim is as specified
> in
> the source code of dll file. But I wanna say it again . If Bob writes sth,
> Bob's dll will encrypt its writing, and Jane gets this encrypted string
> and
> it's showed at the coming text box in the Jane's messenger and then Jane's
> dll gets this and decrypts this string then result is shown in the
> message
> box to Jane. But this two dll can't run at simultaneously.We added same
> dll
> to the two messenger.
>
>
> p.s. You can download our project in this adress
> http://rs73.rapidshare.com/files/80058220/Peltek.rar
My System SpecsSystem Spec