in reply to Using the Net::Msmgr module

You are correct in saying that the error is with your Net::Msmgr::Switchboard->new(ssid=>1) bit, you have not made a connection to the server yet in your code. You will need to make a connection to the server first. Have a look under Net::Msmgr::Connection for instruction on how to connect to the chat server.

I haven't tried the code below, but since Net::Msmgr::Switchboard is derived from Net::Msmgr::Connection, you can do this -
my $sb = Net::Msmgr::Switchboard->new( ssid => 1 ); $sb->nserver( server_url ); $sb->nsport( 1863 ); $sb->name('Channel 1'); $sb->session($session); # session created earlier $sb->connect; # open the connection
Or you can do everything in one go within the object constructor.

Replies are listed 'Best First'.
Re: Re: Using the Net::Msmgr module
by Curious George (Initiate) on Nov 24, 2003 at 21:35 UTC
    Thanks for your reply Roger,

    I did as you said but still no luck. I don't get any error
    messages but I do not get an instant message in my msn
    console either. Here is my code:

    use strict;
    use Net::Msmgr::Session;
    use Net::Msmgr::User;
    use Net::Msmgr::Switchboard;
    use Net::Msmgr::Conversation;

    my $session = new Net::Msmgr::Session;
    my $user = Net::Msmgr::User->new( user => 'somebody@hotmail.com', password => 'password' ) ;
    my $server_url = 'messenger.hotmail.com';
    my $sb = Net::Msmgr::Switchboard->new(ssid => 1, nserver => $server_url, nsport => 1863, name => 'Channel 1', session => $session);
    $sb->connect; # open the connection

    my $ssid = $sb->ssid;
    my $message = qq{MIME-Version: 1.0
    Content-Type: text/plain;
    charset="windows-1255"
    Content-Transfer-Encoding: quoted-printable

    Hi,
    This is a test message"};

    my $conversation = Net::Msmgr::Conversation->new(session => $session, switchboard => $sb, email => {'someuser@hotmail.com'});
    $session->user($user);
    $session->Login;
    $conversation->send_message($conversation, $message);

    #---END CODE---

    The documentation says that the message sent must be in mime format, which my message is in.

    Thanks for your time.