comparison libpurple/plugins/test.pl @ 22504:c9dc220e0301

Bring the test.pl plugin at least theoretically up to date (I haven't tried it but at least it doesn't refer to Gaim anymore).
author Etan Reisner <pidgin@unreliablesource.net>
date Wed, 27 Feb 2008 22:51:02 +0000
parents 3afd04d5f9d6
children
comparison
equal deleted inserted replaced
22503:e62b3625cc54 22504:c9dc220e0301
1 #!/usr/bin/env perl -w 1 use Purple;
2
3 use Gaim;
4 2
5 %PLUGIN_INFO = ( 3 %PLUGIN_INFO = (
6 perl_api_version => 2, 4 perl_api_version => 2,
7 name => 'Test Perl Plugin', 5 name => 'Test Perl Plugin',
8 version => '1.0', 6 version => '1.0',
9 summary => 'Provides as a test base for the perl plugin.', 7 summary => 'Provides as a test base for the perl plugin.',
10 description => 'Provides as a test base for the perl plugin.', 8 description => 'Provides as a test base for the perl plugin.',
11 author => 'Christian Hammond <chipx86@gnupdate.org>', 9 author => 'Etan Reisner <deryni\@pidgin.im>',
12 url => 'http://pidgin.im', 10 url => 'http://pidgin.im',
13 11
14 load => "plugin_load", 12 load => "plugin_load"
15 unload => "plugin_unload"
16 ); 13 );
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 14
28 sub plugin_init { 15 sub plugin_init {
29 return %PLUGIN_INFO; 16 return %PLUGIN_INFO;
30 } 17 }
31 18
19 sub account_status_cb {
20 my ($account, $old, $new, $data) = @_;
21
22 Purple::Debug::info("perl test plugin", "In account_status_cb\n");
23
24 Purple::Debug::info("perl test plugin", "Account " .
25 $account->get_username() . " changed status.\n");
26 Purple::Debug::info("perl test plugin", $data . "\n");
27 }
28
32 sub plugin_load { 29 sub plugin_load {
33 Gaim::debug_info("perl test plugin", "plugin_load\n");
34 my $plugin = shift; 30 my $plugin = shift;
35 31
36 Gaim::debug_info("perl test plugin", "Listing accounts.\n"); 32 Purple::Debug::info("perl test plugin", "plugin_load\n");
37 foreach $account (Gaim::accounts()) { 33
38 Gaim::debug_info("perl test plugin", $account->get_username() . "\n"); 34 Purple::Debug::info("perl test plugin", "Listing accounts.\n");
35 foreach $account (Purple::Accounts::get_all()) {
36 Purple::Debug::info("perl test plugin", $account->get_username() . "\n");
39 } 37 }
40 38
41 Gaim::debug_info("perl test plugin", "Listing buddy list.\n"); 39 Purple::Signal::connect(Purple::Accounts::get_handle(),
42 foreach $group (Gaim::BuddyList::groups()) { 40 "account-status-changed", $plugin,
43 Gaim::debug_info("perl test plugin", 41 \&account_status_cb, "test");
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 } 42 }
55
56 sub plugin_unload {
57 my $plugin = shift;
58 }