Curious George has asked for the wisdom of the Perl Monks concerning the following question:

Hi there,
I'm having a bit of trouble using the Net::Msmgr module that I downloaded from CPAN. Below 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=> 'test@hotmail.com', password => 'password' ) ; my $sb = Net::Msmgr::Switchboard->new(ssid => 1); 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 => {'somebody@hotmail.com'}); $session->user($user); $session->Login; print "Login Successful\n"; $conversation->send_message($conversation, $message);


My problem is that the users in my conversation are not receiving the message I sent. The e-mail addresses and password used as values really exist. I think my problem may be with the value supplied for creating a switchboard

my $sb = Net::Msmgr::Switchboard->new(ssid => 1);

I just assigned some number to ssid. Is there supposed to be some real value that goes here?

I am just trying to create an msn session, create a conversation, add someone to my conversation, and message them. The message should pop-up in their msn messenger client.

Please advise.

janitored by ybiC: <code> tags, as per Monastery convention

Replies are listed 'Best First'.
Re: Using the Net::Msmgr module
by Roger (Parson) on Nov 21, 2003 at 02:31 UTC
    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.

      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.