barnowl_perlaim
Last change
on this file since a1c2f06 was
7a1c90d,
checked in by Geoffrey Thomas <geofft@mit.edu>, 17 years ago
|
Skeleton AIM module, and Net::OSCAR 1.925
|
-
Property mode set to
100644
|
File size:
945 bytes
|
Line | |
---|
1 | use warnings; |
---|
2 | use strict; |
---|
3 | |
---|
4 | =head1 NAME |
---|
5 | |
---|
6 | BarnOwl::Module::AIM |
---|
7 | |
---|
8 | =head1 DESCRIPTION |
---|
9 | |
---|
10 | BarnOwl module implementing AIM support via Net::OSCAR |
---|
11 | |
---|
12 | =cut |
---|
13 | |
---|
14 | package BarnOwl::Module::AIM; |
---|
15 | |
---|
16 | use Net::OSCAR; |
---|
17 | |
---|
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 | $oscar = Net::OSCAR->new(); |
---|
30 | $oscar->set_callback_im_in(\&on_im_in); |
---|
31 | $oscar->signon($user, $pass); |
---|
32 | } |
---|
33 | } |
---|
34 | |
---|
35 | sub on_im_in { |
---|
36 | my ($oscar, $sender, $message, $is_away) = @_; |
---|
37 | my $msg = BarnOwl::Message->new( |
---|
38 | type => 'AIM', |
---|
39 | sender => $sender, |
---|
40 | body => $message, |
---|
41 | away => $is_away, |
---|
42 | ); |
---|
43 | BarnOwl::queue_message($msg); |
---|
44 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.