| |
1 #!/usr/bin/perl -w |
| |
2 |
| |
3 use Gaim; |
| |
4 |
| |
5 %PLUGIN_INFO = ( |
| |
6 perl_api_version => 2, |
| |
7 name => 'Test Perl Plugin', |
| |
8 version => '1.0', |
| |
9 summary => 'Provides as a test base for the perl plugin.', |
| |
10 description => 'Provides as a test base for the perl plugin.', |
| |
11 author => 'Christian Hammond <chipx86@gnupdate.org>', |
| |
12 url => 'http://gaim.sf.net/', |
| |
13 |
| |
14 load => "plugin_load", |
| |
15 unload => "plugin_unload" |
| |
16 ); |
| |
17 |
| |
18 sub account_away_cb { |
| |
19 Gaim::debug_info("perl test plugin", "In account_away_cb\n"); |
| |
20 |
| |
21 my ($account, $state, $message, $data) = @_; |
| |
22 |
| |
23 Gaim::debug_info("perl test plugin", "Account " . |
| |
24 $account->get_username() . " went away.\n"); |
| |
25 Gaim::debug_info("perl test plugin", $data . "\n"); |
| |
26 } |
| |
27 |
| |
28 sub plugin_init { |
| |
29 return %PLUGIN_INFO; |
| |
30 } |
| |
31 |
| |
32 sub plugin_load { |
| |
33 Gaim::debug_info("perl test plugin", "plugin_load\n"); |
| |
34 my $plugin = shift; |
| |
35 |
| |
36 Gaim::debug_info("perl test plugin", "Listing accounts.\n"); |
| |
37 foreach $account (Gaim::accounts()) { |
| |
38 Gaim::debug_info("perl test plugin", $account->get_username() . "\n"); |
| |
39 } |
| |
40 |
| |
41 Gaim::debug_info("perl test plugin", "Listing buddy list.\n"); |
| |
42 foreach $group (Gaim::BuddyList::groups()) { |
| |
43 Gaim::debug_info("perl test plugin", |
| |
44 $group->get_name() . ":\n"); |
| |
45 |
| |
46 foreach $buddy ($group->buddies()) { |
| |
47 Gaim::debug_info("perl test plugin", |
| |
48 " " . $buddy->get_name() . "\n"); |
| |
49 } |
| |
50 } |
| |
51 |
| |
52 Gaim::signal_connect(Gaim::Accounts::handle, "account-away", |
| |
53 $plugin, \&account_away_cb, "test"); |
| |
54 } |
| |
55 |
| |
56 sub plugin_unload { |
| |
57 my $plugin = shift; |
| |
58 } |