Update: I'm not able to get as much free time as I'd like to polish up my module some more (it has yet to support chat rooms still, and the buddy list support is a lil buggy), but you can check out the current code I have:

svn checkout http://svn.kirsle.net/repos/perl-ymsg/trunk

Support for the Yahoo Messenger protocol from Perl has been lacking these past few years (read: non-existent). The YMSG protocol used by the current Net::YMSG and its clone Net::YahooMessenger had been rendered obsolete way back in 2003 when Yahoo decided they'd cut off third-party clients from their network, and the modules haven't been updated since then.

For the past few weeks I've been putting together some new code that does connect to Yahoo Messenger and it speaks the YMSG16 protocol -- which is the current version, used by the official Messenger client as is available from their site at this time.

My module is still in its early stages of life, but it signs on, sends and receives messages, and can manipulate its buddy list. Besides chat room support, the module currently has most of the functionality that the old Net::YMSG did.

The current owner of the Net::YMSG namespace is not reachable; the e-mail address bounces. So, I'm requesting control of the Net::YMSG namespace. Here are things to consider though:

My module has a different interface. I think my interface is more straightforward and easy to use than the existing Net::YMSG. Since Net::YMSG has been obsolete for nearly 7 full years, there really shouldn't be any existing code out in the wild that uses Net::YMSG; if there is, it's been out of service for 7 years. So, a change in the interface shouldn't be too much of a shock at this point.

There are already two different namespaces that deal with Yahoo Messenger on CPAN: Net::YMSG, and Net::YahooMessenger, which appears to be only an updated version of Net::YMSG - its documentation is nearly identical. Perhaps the owner of Net::YahooMessenger also couldn't reach the owner of Net::YMSG and had to create a new namespace for their changes. Both of these modules, however, do not work now. I'd like to avoid having to introduce yet another Yahoo Messenger namespace to CPAN.

Here is a test script that uses my new module (which is tentatively named Net::YMSG), so you can see how the new interface compares to the existing:

#!/usr/bin/perl -w use strict; use warnings; use lib "./lib"; use Net::YMSG qw(:standard); scalar(@ARGV) == 2 || die "Usage: $0 <username> <password>"; print "Creating object\n"; my $yahoo = new Net::YMSG ( YahooID => lc($ARGV[0]), # TODO: module should lc the ID Password => $ARGV[1], Debug => 1, ANSI => 1, ); print "Object created\n"; print "Setting handlers\n"; $yahoo->setHandlers ( Connected => \&on_connect, List => \&on_list, NewContact => \&on_new_contact, Message => \&on_message, Typing => \&on_typing, Status => \&on_status, ); print "Daring to connect\n"; $yahoo->connect(); print "Entering the main loop\n"; while (1) { $yahoo->do_one_loop(); select(undef,undef,undef,0.01); } sub on_connect { my $self = shift; print "Connected to YMSG!\n\n"; $self->sendMessage ("kirsle", "I'm alive!"); $self->sendMessage ("kirsle", "<ding>"); } sub on_list { my ($self,$buddies,$groups) = @_; print "We've received our buddy list! We're friends with:\n" . join (", ", @{$buddies}) . "\n"; } sub on_new_contact { my ($self,$from) = @_; print "$from wants to be our friend!\n"; # Add him to our list! $self->addBuddy($from, "Buddies"); } sub on_message { my ($self,$from,$message) = @_; print "[$from] $message\n"; # Some commands. if ($message =~ /!away (.+?)$/i) { $self->setStatus (YMSG_STATUS_BRB, $1); $self->sendMessage ($from, "Status changed!"); return; } elsif ($message =~ /!online/i) { $self->setStatus (YMSG_STATUS_ONLINE); $self->sendMessage ($from, "Status changed!"); return; } $self->sendTyping ($from, YMSG_TYPING_STARTED); sleep 2; $self->sendMessage ($from, "[I am a robot] You said: $message"); $self->sendTyping ($from, YMSG_TYPING_STOPPED); } sub on_typing { my ($self,$from,$typing) = @_; if ($typing) { print "$from has started typing.\n"; } else { print "$from has stopped typing.\n"; } } sub on_status { my ($self,$from,$status,$message) = @_; # Translate the status. $status = $self->statusToString($status); print "$from is $status: $message\n"; }

In reply to Taking over Net::YMSG by Kirsle

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.