views:

328

answers:

2

Hi folks,

I'm trying to have my windows application send a message to two msn messenger accounts. So, I grabbed the code from the MSNPSharp library and had a look in that.

I can authenticate/sign in without a problem. But once i've done that, I have no idea how to send a simple text message to two other users.

Do those users need to be approved ?

Can someone help me please - maybe show some sample code?

cheers :)

A: 

Looking through the example code from the conversation form may help:

There is a Conversation object that you use to send the message. As soon as I get some more time I'll whip up an example.

cdeweese
Yeah. This is the hard bit. A conversation requires a contact. I don't know how to make a contact :( If my msn account username is : [email protected] ... then how do i add that contact, to send the message? I've figured the rest out a few days ago .. ...
Pure.Krome
(and welcome to Stack Overflow, Chris :)
Pure.Krome
A: 

somebody tried to handle multiple conversation ? can someone to provide an example of how to do it ?

i tried in this way:

void Conversation_ContactJoined(object sender, ContactEventArgs e)
    {
        //The request is initiated by remote user, so we needn't invite anyone
        Conversation convers = sender as Conversation;
        Console.WriteLine("Contact Joined to Conversation: " + e.Contact.Name);
        try
        {
            Talk = convers;
            convers.AutoKeepAlive = true;
            convers.ConversationEnded += new EventHandler<ConversationEndEventArgs>(convers_ConversationEnded);
            convers.ContactLeft += new EventHandler<ContactEventArgs>(convers_ContactLeft);
            //convers.TextMessageReceived += new EventHandler<ConversationCreatedEventArgs>(messenger_ConversationCreated);
            convers.TextMessageReceived += new EventHandler<TextMessageEventArgs>(ConversationReplay);
            convers.SendTextMessage(new TextMessage("Conversation_ContactJoined event :)" + e.Contact.Name));
        }
        catch (Exception err) { Console.WriteLine("Contact Joined Error: " + err.Message.ToString()); }
    }

and here i receive all user messages:

    private void ConversationReplay(object sender, TextMessageEventArgs e)
    {
        Console.WriteLine(e.Sender.Name + ":" + e.Message.Text.ToString());

        //Talk.SendNudge();
        try
        {
            Talk.SendTypingMessage();
            //System.Threading.Thread.Sleep(3000);
            Talk.SendTextMessage(new TextMessage("Hey this is an reply to your [" + e.Message.Text.ToString() + "] :P"));
        }
        catch (Exception err) { Console.WriteLine("Reply Error: " + err.Message.ToString());}
    }

but i have one problem :) i can reply only to last user that is joined to this conversation :) if someone already fixed this problem using MSNP-SHARP library please give a hint :) thanks.

Constantine
@Constantine - maybe you'll need to start a new thread about this :( My current question (here) isn't getting any love :(
Pure.Krome