Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Taking over Net::YMSG

by Kirsle (Pilgrim)
on Sep 04, 2009 at 18:45 UTC ( [id://793551]=perlmeditation: print w/replies, xml ) Need Help??

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"; }

Replies are listed 'Best First'.
Re: Taking over Net::YMSG
by james2vegas (Chaplain) on Sep 05, 2009 at 01:08 UTC
    I like your module, though I wonder if it is possible to have a filehandle exported so we can use it in event loops like POE or AnyEvent?

    Also, how do youwill you handle the captcha requirement to enter Yahoo chatrooms?

      I'll cross that bridge when I get to it.

      Probably there'll be an event handler the user can set up that will get the URL to the captcha image, and the calling program can do with it what it wants (e.g. get it with LWP and then: display it in a GUI for the user to answer, or feed it to an app that can try to decode it automatically, etc.) and then call a method to send the answer back to the server.

Re: Taking over Net::YMSG
by Anonymous Monk on Sep 05, 2009 at 00:47 UTC
    Did you try to YMSG him? :D
Re: Taking over Net::YMSG
by keymon (Beadle) on Sep 29, 2009 at 00:41 UTC
    This is great news. Where can we download your module and try it out? I just started looking for a YMSG client library, so this is indeed quite fortuitous!
Re: Taking over Net::YMSG
by DrHyde (Prior) on Sep 07, 2009 at 09:46 UTC
    This isn't the right place to ask to take over a distribution on the CPAN. See the CPAN FAQ.

        I read that; it's why I posted it here. I've already written modules@perl.org and tried contacting the original author (with a bounced e-mail in response).

        Perhaps I've posted it in the wrong section of perlmonks.org?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://793551]
Front-paged by tye
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (3)
As of 2024-04-24 22:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found