Changeset 960

Show
Ignore:
Timestamp:
10/21/03 06:17:50
Author:
miyagawa
Message:

pod cleanup; changed author

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Net-YahooMessenger/trunk/Changes

    r957 r960  
    11Revision history for Perl extension Net::YahooMessenger. 
    22 
     30.14  Tue Oct 21 06:14:33 JST 2003 
     4        - Tatsuhiko Miyagawa now takes over the module from Hiroyuki Oyama. 
     5 
     60.13  Wed Jun 26 19:15:03 JST 2002 
     7        - Fix undefined value used warning. 
     8          'Argument "" isn\'t numeric in pack' 
     9          'Use of uninitialized value in length' 
     10          etc... 
     11          (Thanks to mayuresh kadu <mayureshk@aftek.com>) 
     12        - Fix The problem which cannot acquire 'buddy list' is repaired. 
     13        - Add better test scripts. 
     140.12  Wed Jun 19 20:10:22 2002 
     15        - Refine Compatibility with protocol version 9. 
     16          Add YMSG9 Challenge-Response Authentication Mechanism 
     17              -> Net::YahooMessenger::CRAM.pm 
     18          Modify Login sequence. 
     19 
     20          It fixed so that it could communicate by the Japan and U.S. server. 
     21          (Thanks to Rajesh Kannan <rajeshin2000@yahoo.com> 
     22           and mayuresh kadu <mayureshk@aftek.com>) 
     23        - Independent from Crypt::PasswdMD5 module. 
     24        - Modify sample script. 
     25          (Thanks to mayuresh kadu <mayureshk@aftek.com>) 
     260.09  Mon Jan  7 12:38:20 2002 
     27        - Add NewFriendAlert event 
     28          Add NullEvent event 
     29          Add HTTP transaction sequence. get all buddy list and Socket 
     30                server list. 
     31          Add friend's state maintenance function was mounted. 
     32          Add Net::YahooMessenger::ping() method and ServerIsAlive event 
     33          Add bin/ymsgj. Connect to Yahoo!Japan server. 
     34        - Modify Net::YahooMessenger::EventFactory::create() 
     35          Modify The method of specifying a connection place server was decided. 
     36          Modify Net::YahooMessenger::_create_message(), 
     37                Net::YahooMessenger::EventFactory::get_message_body() 
     38                Generation and analysis of a header were substituted for 
     39                the simple thing of a pack()/unpack() function base. 
     40                In order to transmit OFFLINE MESSAGE, addition information was 
     41                given to the header. 
     42        - Rename Net::YahooMessenger::Logon.pm -> Net::YahooMessenger::Login.pm 
     43          Rename Net::YahooMessenger::CannotLogon.pm 
     44              -> Net::YahooMessenger::InvalidLogin.pm 
     45          Remove bin/uptime_agent, bin/banner_stat. 
     460.08  Wed Dec 26 21:06:48 2001 
     47        - Bugfix Net::YahooMessenger::login() The problem to freeze is 
     48          corrected when login goes wrong. 
     490.07  Fri Dec 21 18:52:47 2001 
     50        - Modify Event handling architecture. 
     51                Although it was the complicated thing which used the Visitor 
     52                pattern, it changed into the simple thing which uses an 
     53                EventHandler object. 
     540.06  Mon Dec 17 14:23:25 2001 
     55        - Modify Net::YahooMessenger::_get_request() and 
     56          Net::YahooMessenger::EventFactory::_get_message_body(), The 
     57          method of acquiring the length of a message was changed. 
     580.05  Tue Dec  4 20:20:34 2001 
     59        - Add Net::YahooMessenger::Logon event 
     60          Add bin/banner_stat. a state is rewritten so that a banner may cross. 
     61        - Modify Socket operation methods 
     620.04  Thu Nov 29 22:52:24 2001 
     63        - Modify Net::YahooMessenger::EventFactory.pm and Event.pm 
     64        - Add bin/uptime_agent. talk to 'uptime_agent', it will answer by the 
     65          result of Unix 'uptime'. 
     660.03  Sat Nov 24 11:30:31 2001 
     67        - Replace ymsg script. Thanks Takefumi KIMURA<takefumi@takefumi.com> 
     68        - Modify Event model of Visitor pattern(GoF) 
     69                Add Net::YahooMessenger::EventVisitor.pm 
     70                    Net::YahooMessenger::JapaneseCommandLineVisitor.pm 
     71          Add POD manual page 
     720.02  Sat Nov 24 02:37:35 2001 
     73        - Add GoesOnline event 
     74          Add GoesOffline event 
     75          Add UnImplementEvent event 
     76          Modify YMSG message parser 
    3770.01  Sat Nov 24 02:37:35 2001 
    4         - original version; created by h2xs 1.21 with options 
    5                 -X -n Net::YahooMessenger 
    6 0.02  Sat Nov 24 02:37:35 2001 
    7         - Add GoesOnline event 
    8           Add GoesOffline event 
    9           Add UnImplementEvent event 
    10           Modify YMSG message parser 
    11 0.03  Sat Nov 24 11:30:31 2001 
    12         - Replace ymsg script. Thanks Takefumi KIMURA<takefumi@takefumi.com> 
    13         - Modify Event model of Visitor pattern(GoF) 
    14                 Add Net::YahooMessenger::EventVisitor.pm 
    15                     Net::YahooMessenger::JapaneseCommandLineVisitor.pm 
    16           Add POD manual page 
    17 0.04  Thu Nov 29 22:52:24 2001 
    18         - Modify Net::YahooMessenger::EventFactory.pm and Event.pm 
    19         - Add bin/uptime_agent. talk to 'uptime_agent', it will answer by the 
    20           result of Unix 'uptime'. 
    21 0.05  Tue Dec  4 20:20:34 2001 
    22         - Add Net::YahooMessenger::Logon event 
    23           Add bin/banner_stat. a state is rewritten so that a banner may cross. 
    24         - Modify Socket operation methods 
    25 0.06  Mon Dec 17 14:23:25 2001 
    26         - Modify Net::YahooMessenger::_get_request() and 
    27           Net::YahooMessenger::EventFactory::_get_message_body(), The 
    28           method of acquiring the length of a message was changed. 
    29 0.07  Fri Dec 21 18:52:47 2001 
    30         - Modify Event handling architecture. 
    31                 Although it was the complicated thing which used the Visitor 
    32                 pattern, it changed into the simple thing which uses an 
    33                 EventHandler object. 
    34 0.08  Wed Dec 26 21:06:48 2001 
    35         - Bugfix Net::YahooMessenger::login() The problem to freeze is 
    36           corrected when login goes wrong. 
    37 0.09  Mon Jan  7 12:38:20 2002 
    38         - Add NewFriendAlert event 
    39           Add NullEvent event 
    40           Add HTTP transaction sequence. get all buddy list and Socket 
    41                 server list. 
    42           Add friend's state maintenance function was mounted. 
    43           Add Net::YahooMessenger::ping() method and ServerIsAlive event 
    44           Add bin/ymsgj. Connect to Yahoo!Japan server. 
    45         - Modify Net::YahooMessenger::EventFactory::create() 
    46           Modify The method of specifying a connection place server was decided. 
    47           Modify Net::YahooMessenger::_create_message(), 
    48                 Net::YahooMessenger::EventFactory::get_message_body() 
    49                 Generation and analysis of a header were substituted for 
    50                 the simple thing of a pack()/unpack() function base. 
    51                 In order to transmit OFFLINE MESSAGE, addition information was 
    52                 given to the header. 
    53         - Rename Net::YahooMessenger::Logon.pm -> Net::YahooMessenger::Login.pm 
    54           Rename Net::YahooMessenger::CannotLogon.pm 
    55               -> Net::YahooMessenger::InvalidLogin.pm 
    56           Remove bin/uptime_agent, bin/banner_stat. 
    57 0.12  Wed Jun 19 20:10:22 2002 
    58         - Refine Compatibility with protocol version 9. 
    59           Add YMSG9 Challenge-Response Authentication Mechanism 
    60               -> Net::YahooMessenger::CRAM.pm 
    61           Modify Login sequence. 
    62  
    63           It fixed so that it could communicate by the Japan and U.S. server. 
    64           (Thanks to Rajesh Kannan <rajeshin2000@yahoo.com> 
    65            and mayuresh kadu <mayureshk@aftek.com>) 
    66         - Independent from Crypt::PasswdMD5 module. 
    67         - Modify sample script. 
    68           (Thanks to mayuresh kadu <mayureshk@aftek.com>) 
    69 0.13  Wed Jun 26 19:15:03 JST 2002  
    70         - Fix undefined value used warning. 
    71           'Argument "" isn\'t numeric in pack' 
    72           'Use of uninitialized value in length' 
    73           etc... 
    74           (Thanks to mayuresh kadu <mayureshk@aftek.com>) 
    75         - Fix The problem which cannot acquire 'buddy list' is repaired. 
    76         - Add better test scripts. 
     78        - original version; created by h2xs 1.21 with options 
     79                -X -n Net::YahooMessenger 
  • Net-YahooMessenger/trunk/README

    r957 r960  
    1 Net/YahooMessenger 
    2 ================== 
    3  
    4 Welcome to Net::YahooMessenger, a work in progress. First intended to 
    5 be a quick tool for writing an Yahoo!Messenger script in Perl, 
    6 Net::YahooMessenger has grown into a comprehensive Perl implementation 
    7 of the YMSG protocol. 
    8  
    9 Please read the Changes file for details about recent updates, and the 
    10 Bugs section of this document for notes about future improvements. 
    11  
    12 Please send the authers feedback and advice. Contact information can 
    13 be found at the end of this file. 
    14  
    15 Availability 
    16  
    17         http://ymca.infoware.ne.jp/dist/ 
    18  
    19  
    20 INSTALLATION 
    21  
    22 To install this module type the following: 
    23  
    24    perl Makefile.PL 
    25    make 
    26    make test 
    27    make install 
    28  
    29  
    30 DEPENDENCIES 
    31  
    32 This module requires these other modules and libraries: 
    33  
    34   Digest::MD5 
    35  
    36  
    37 DEMONSTRATION 
    38  
    39 A sample Net::YahooMessenger script is included with the distribution, 
    40 under the creative name 'script/ymsg.pl' or 'script/ymsgj.pl'. 
    41  
    42  
    43 COPYRIGHT AND LICENCE 
    44  
    45 Copyright (C) 2001 Hiroyuki OYAMA. Japan. All righits reserved. 
    46 This program is free software; you can redistribute it and/or modify it 
    47 under the same terms as Perl itsefl. 
    48  
    49 Please refer to the use agreement of Yahoo! about use of the 
    50 Yahoo!Messenger service. 
     1NAME 
     2    Net::YahooMessenger - Interface to the Yahoo!Messenger IM protocol 
     3 
     4SYNOPSIS 
     5            use Net::YahooMessenger; 
     6 
     7            my $yahoo = Net::YahooMessenger->new( 
     8                    id       => 'your_yahoo_id', 
     9                    password => 'your_password', 
     10            ); 
     11            $yahoo->login or die "Can't login Yahoo!Messenger"; 
     12            $yahoo->send('recipient_yahoo_id', 'Hello World!'); 
     13 
     14DESCRIPTION 
     15    Net::YahooMessenger is a client class for connecting with the 
     16    Yahoo!Messenger server, and transmitting and receiving a message. 
     17 
     18    Since implement of a protocol is the result of analyzing and 
     19    investigating a packet, it has an inadequate place. However, it is 
     20    working as expected usually. 
     21 
     22METHODS 
     23    This section documents method of the Net::YahooMessenger class. 
     24 
     25  Net::YahooMessenger->new() 
     26 
     27    It should be called with following arguments (items with default value 
     28    are optional): 
     29 
     30            id            => yahoo id 
     31            password      => password 
     32            pre_login_url => url which refers to setting information. 
     33                             (default http://msg.edit.yahoo.com/config/) 
     34            hostname      => server hostname 
     35                             (default 'cs.yahoo.com) 
     36 
     37    Returns a blessed instantiation of Net::YahooMessenger. 
     38 
     39    Note: If you plan to connect with Yahoo!Japan(yahoo.co.jp), it sets up 
     40    as follows. 
     41 
     42            my $yahoo_japan = Net::YahooMessenger->new( 
     43                    pre_login_url => 'http://edit.my.yahoo.co.jp/config/', 
     44                    hostname      => 'cs.yahoo.co.jp', 
     45            ); 
     46 
     47    *Since it connects with Yahoo!(yahoo.com), this procedure is unnecessary 
     48    in almost all countries.* 
     49 
     50  $yahoo->id([$yahoo_id]) 
     51 
     52    This method gets or sets the present Yahoo Id. 
     53 
     54  $yahoo->password([$password]) 
     55 
     56    This method gets or sets the present password. 
     57 
     58  $yahoo->login() 
     59 
     60    Call this after "new()" to logon the Yahoo!Messenger service. 
     61 
     62  $yahoo->send($yahoo_id, $message) 
     63 
     64    This method send an Instant-Message $message to the user specified by 
     65    $yahoo_id. A kanji code is Shift_JIS when including Japanese in 
     66    $message. 
     67 
     68  $yahoo->change_state($busy, $status_message) 
     69 
     70    This method sets the *status messages* for the current user. 'Status 
     71    message' is set by $status_message. 'Busy icon' is set by the numerical 
     72    value of $busy. 
     73 
     74    The $busy should be called with following arguments: 
     75 
     76            0 - I'm Available 
     77            1 - Busy 
     78            2 - Sleep 
     79 
     80  $yahoo->recv() 
     81 
     82    This method reads the message from a server socket and returns a 
     83    corresponding Event object. The Event object which will be returned is 
     84    as follows: 
     85 
     86            Net::YahooMessenger::InvalidLogin     - Invalid Login 
     87            Net::YahooMessenger::Login            - Succeeded in Login. 
     88            Net::YahooMessenger::GoesOnline       - Buddy has logged in. 
     89            Net::YahooMessenger::ReceiveMessage   - Message was received. 
     90            Net::YahooMessenger::ChangeState      - Buddy has change status. 
     91            Net::YahooMessenger::GoesOffline      - Buddy logged out. 
     92            Net::YahooMessenger::NewFriendAlert   - New Friend Alert. 
     93            Net::YahooMessenger::UnImplementEvent - Un-implemented event was received. 
     94 
     95    All event objects have the following attributes: 
     96 
     97    $event->from 
     98        Yahoo id which invoked the event. 
     99 
     100    $event->to 
     101        Yahoo id which should receive an event. 
     102 
     103    $event->body 
     104        The contents of an event. The message and state which were 
     105        transmitted. 
     106 
     107    $event->code 
     108        The event number on Yahoo Messenger Protocol. 
     109 
     110  $yahoo->get_connection() 
     111 
     112    This method returns a raw server socket. When connection has already 
     113    ended, the socket is returned, and when not connecting, it connects 
     114    newly. 
     115 
     116  $yahoo->set_event_hander($event_handler) 
     117 
     118    This method sets the Event handler for a specific Yahoo!Messenger server 
     119    event. $event_handler is the sub class of 
     120    Net::YahooMessenger::EventHandler. 
     121 
     122    Note: The event which can be overwritten should look at the method 
     123    signature of the Net::YahooMessenger::EventHandler manpage. 
     124 
     125  $yahoo->add_event_source($file_handle, $code_ref, $flag) 
     126 
     127    This method adds the file handle (event sauce) to supervise. The file 
     128    handle to add is specified by $file_handle. The code reference to the 
     129    processing to perform is specified by $code_ref. 
     130 
     131            C<$flag> eq 'r' - set when the file handle to add is an object for read. 
     132            C<$flag> eq 'w' - set when the file handle to add is an object for write. 
     133 
     134    By adding another handle (for example, STDIN), processing can be 
     135    performed based on those inputs. Usually, the server socket of 
     136    'Yahoo!Messenger server' is set as a candidate for surveillance. 
     137 
     138            ex: 
     139                    # The input of STDIN is transmitted to 'EXAMPLE_YAHOO_ID'. 
     140                    $yahoo->add_event_source(\*STDIN, sub { 
     141                            my $message = scalar <STDIN>; 
     142                            chomp $message; 
     143                            $yahoo->send('EXAMPLE_YAHOO_ID', $message); 
     144                    }, 'r'); 
     145 
     146  $yahoo->start() 
     147 
     148    If you're writing a fairly simple application that doesn't need to 
     149    interface with other event-loop-based libraries, you can just call 
     150    start() to begin communicating with the server. 
     151 
     152EXAMPLE 
     153  Send message 
     154 
     155            #!perl 
     156            use Net::YahooMessenger; 
     157            use strict; 
     158 
     159            my $yahoo = Net::YahooMessenger->new; 
     160            $yahoo->id('yahoo_id'); 
     161            $yahoo->password('password'); 
     162            $yahoo->login or die "Can't login Yahoo!Messenger"; 
     163 
     164            $yahoo->send('recipient_yahoo_id', 'Hello World!'); 
     165            __END__ 
     166 
     167  Change Status message 
     168 
     169            #!perl 
     170            use Net::YahooMessenger; 
     171            use strict; 
     172            use constant IN_BUSY => 1; 
     173 
     174            my $yahoo = Net::YahooMessenger->new( 
     175                    id       => 'yahoo_id', 
     176                    password => 'password', 
     177            ); 
     178            $yahoo->login or die "Can't login Yahoo!Messenger";; 
     179 
     180            $yahoo->change_state(IN_BUSY, q{I'm very busy now!}); 
     181            sleep 5; 
     182            __END__ 
     183 
     184  Received message output to STDOUT 
     185 
     186            #!perl 
     187            use Net::YahooMessenger; 
     188            use strict; 
     189 
     190            my $yahoo = Net::YahooMessenger->new( 
     191                    id       => 'yahoo_id', 
     192                    password => 'password', 
     193            ); 
     194            $yahoo->set_event_handler(new ToStdoutEventHandler); 
     195            $yahoo->login or die "Can't login Yahoo!Messenger"; 
     196            $yahoo->start; 
     197 
     198            package ToStdoutEventHandler; 
     199            use base 'Net::YahooMessenger::EventHandler'; 
     200            use strict; 
     201 
     202            sub ChangeState {} 
     203            sub GoesOffline {} 
     204            sub GoesOnline {} 
     205            sub UnImplementEvent {} 
     206 
     207            sub ReceiveMessage 
     208            { 
     209                    my $self = shift; 
     210                    my $event = shift; 
     211                    printf "%s: %s\n", $event->from, $event->body; 
     212            } 
     213            __END__ 
     214 
     215  Connect to Yahoo!Japan Messege server 
     216 
     217            #!perl 
     218            use Net::YahooMessenger; 
     219            use strict; 
     220 
     221            my $yahoo = Net::YahooMessenger->new( 
     222                    pre_login_url => 'http://edit.my.yahoo.co.jp/config/', 
     223                    hostname      => 'cs.yahoo.co.jp', 
     224            ); 
     225            $yahoo->id('yahoo_id'); 
     226            $yahoo->password('password'); 
     227            $yahoo->login or die "Can't login Yahoo!Messenger"; 
     228 
     229            $yahoo->send('recipient_yahoo_id', 'Konnitiwa Sekai!'); 
     230            __END__ 
     231 
     232AUTHOR 
     233    Hiroyuki OYAMA <oyama@cpan.org> http://ymca.infoware.ne.jp/ 
     234 
     235    From October 2003, this module is taken over and maintained by Tatsuhiko 
     236    Miyagawa the lt manpagemiyagawa@bulknews.netthe gt manpage 
     237 
     238SEE ALSO 
     239    <http://messenger.yahoo.co.jp/>, <http://ymca.infoware.ne.jp/> 
     240 
     241COPYRIGHT 
     242    Copyright (C) 2001 Hiroyuki OYAMA. Japan. All righits reserved. 
     243 
     244    This module is free software; you can redistribute it and/or modify it 
     245    under the same terms as Perl itsefl. 
     246 
     247    Please refer to the use agreement of Yahoo! about use of the 
     248    Yahoo!Messenger service. 
     249 
  • Net-YahooMessenger/trunk/YahooMessenger.pm

    r957 r960  
    3737 
    3838use vars qw($VERSION); 
    39 $VERSION = '0.13'; 
     39$VERSION = '0.14'; 
    4040 
    4141=head1 METHODS 
     
    551551        use Net::YahooMessenger; 
    552552        use strict; 
    553          
     553 
    554554        my $yahoo = Net::YahooMessenger->new; 
    555555        $yahoo->id('yahoo_id'); 
    556556        $yahoo->password('password'); 
    557557        $yahoo->login or die "Can't login Yahoo!Messenger"; 
    558          
     558 
    559559        $yahoo->send('recipient_yahoo_id', 'Hello World!'); 
    560560        __END__ 
     
    566566        use strict; 
    567567        use constant IN_BUSY => 1; 
    568          
     568 
    569569        my $yahoo = Net::YahooMessenger->new( 
    570570                id       => 'yahoo_id', 
     
    572572        ); 
    573573        $yahoo->login or die "Can't login Yahoo!Messenger";; 
    574          
     574 
    575575        $yahoo->change_state(IN_BUSY, q{I'm very busy now!}); 
    576576        sleep 5; 
     
    582582        use Net::YahooMessenger; 
    583583        use strict; 
    584          
     584 
    585585        my $yahoo = Net::YahooMessenger->new( 
    586586                id       => 'yahoo_id', 
     
    590590        $yahoo->login or die "Can't login Yahoo!Messenger"; 
    591591        $yahoo->start; 
    592          
    593          
    594          
     592 
     593 
     594 
    595595        package ToStdoutEventHandler; 
    596596        use base 'Net::YahooMessenger::EventHandler'; 
    597597        use strict; 
    598          
     598 
    599599        sub ChangeState {} 
    600600        sub GoesOffline {} 
    601601        sub GoesOnline {} 
    602602        sub UnImplementEvent {} 
    603          
     603 
    604604        sub ReceiveMessage 
    605605        { 
     
    615615        use Net::YahooMessenger; 
    616616        use strict; 
    617          
     617 
    618618        my $yahoo = Net::YahooMessenger->new( 
    619619                pre_login_url => 'http://edit.my.yahoo.co.jp/config/', 
     
    623623        $yahoo->password('password'); 
    624624        $yahoo->login or die "Can't login Yahoo!Messenger"; 
    625          
     625 
    626626        $yahoo->send('recipient_yahoo_id', 'Konnitiwa Sekai!'); 
    627627        __END__ 
     
    629629=head1 AUTHOR 
    630630 
    631 Hiroyuki OYAMA <oyama@crayfish.co.jp> http://ymca.infoware.ne.jp/ 
     631Hiroyuki OYAMA <oyama@cpan.org> http://ymca.infoware.ne.jp/ 
     632 
     633From October 2003, this module is taken over and maintained by 
     634Tatsuhiko Miyagawa L<lt>miyagawa@bulknews.netL<gt> 
    632635 
    633636=head1 SEE ALSO