Changeset 403198c for perl/modules/AIM


Ignore:
Timestamp:
Jun 1, 2008, 8:37:02 PM (14 years ago)
Author:
Geoffrey Thomas <geofft@mit.edu>
Branches:
barnowl_perlaim
Children:
7d63a6c
Parents:
5fcf137
Message:
Proof-of-concept AIM client. Maybe less than a proof. Lemma-of-concept.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • perl/modules/AIM/lib/BarnOwl/Module/AIM.pm

    r5fcf137 r403198c  
    1616use Net::OSCAR;
    1717
    18 sub cmd_aimlogin {
    19     my ($cmd, $user, $pass) = @_;
    20     if (undef $user) {
    21         BarnOwl::start_question('Username: ', sub {
    22                 cmd_aimlogin($cmd, @_);
    23                 });
    24     } elsif (undef $pass) {
    25         BarnOwl::start_password('Password: ', sub {
    26                 cmd_aimlogin($cmd, $user, @_);
    27                 });
    28     } else {
    29         my $oscar = Net::OSCAR->new();
    30         $oscar->set_callback_im_in(\&on_im_in);
    31         $oscar->signon($user, $pass);
    32     }
    33 }
     18our @oscars;
    3419
    3520sub on_im_in {
     
    4429}
    4530
     31sub cmd_aimlogin {
     32=comment
     33    my ($cmd, $user, $pass) = @_;
     34    if (!defined $user) {
     35        BarnOwl::start_question('Username: ', sub {
     36                cmd_aimlogin($cmd, @_);
     37                });
     38    } elsif (!defined $pass) {
     39        BarnOwl::start_password('Password: ', sub {
     40                cmd_aimlogin($cmd, $user, @_);
     41                });
     42    } else {
     43=cut
     44    {
     45        my $oscar = Net::OSCAR->new();
     46        my ($user, $pass) = ('...', '...');
     47        $oscar->set_callback_im_in(\&on_im_in);
     48        $oscar->signon(
     49                screenname => $user,
     50                password => $pass
     51                );
     52        push @oscars, $oscar;
     53    }
     54}
    4655BarnOwl::new_command(aimlogin => \&cmd_aimlogin, {});
    4756
     57sub main_loop {
     58    for my $oscar (@oscars) {
     59        $oscar->do_one_loop();
     60    }
     61}
     62$BarnOwl::Hooks::mainLoop->add(\&main_loop);
     63
    48641;
     65
     66# vim: set sw=4 et cin:
Note: See TracChangeset for help on using the changeset viewer.