annotate libpurple/plugins/test.pl @ 23661:6659ba7b3941

Fix a crash when the user isn't in your list.
author Daniel Atallah <daniel.atallah@gmail.com>
date Tue, 29 Jul 2008 18:55:03 +0000
parents c9dc220e0301
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22504
c9dc220e0301 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <pidgin@unreliablesource.net>
parents: 22113
diff changeset
1 use Purple;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 %PLUGIN_INFO = (
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4 perl_api_version => 2,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5 name => 'Test Perl Plugin',
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6 version => '1.0',
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 summary => 'Provides as a test base for the perl plugin.',
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8 description => 'Provides as a test base for the perl plugin.',
22504
c9dc220e0301 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <pidgin@unreliablesource.net>
parents: 22113
diff changeset
9 author => 'Etan Reisner <deryni\@pidgin.im>',
16184
22f65e75980c Point to the Pidgin website.
Richard Laager <rlaager@wiktel.com>
parents: 15374
diff changeset
10 url => 'http://pidgin.im',
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11
22504
c9dc220e0301 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <pidgin@unreliablesource.net>
parents: 22113
diff changeset
12 load => "plugin_load"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 );
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 sub plugin_init {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 return %PLUGIN_INFO;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18
22504
c9dc220e0301 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <pidgin@unreliablesource.net>
parents: 22113
diff changeset
19 sub account_status_cb {
c9dc220e0301 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <pidgin@unreliablesource.net>
parents: 22113
diff changeset
20 my ($account, $old, $new, $data) = @_;
c9dc220e0301 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <pidgin@unreliablesource.net>
parents: 22113
diff changeset
21
c9dc220e0301 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <pidgin@unreliablesource.net>
parents: 22113
diff changeset
22 Purple::Debug::info("perl test plugin", "In account_status_cb\n");
c9dc220e0301 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <pidgin@unreliablesource.net>
parents: 22113
diff changeset
23
c9dc220e0301 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <pidgin@unreliablesource.net>
parents: 22113
diff changeset
24 Purple::Debug::info("perl test plugin", "Account " .
c9dc220e0301 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <pidgin@unreliablesource.net>
parents: 22113
diff changeset
25 $account->get_username() . " changed status.\n");
c9dc220e0301 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <pidgin@unreliablesource.net>
parents: 22113
diff changeset
26 Purple::Debug::info("perl test plugin", $data . "\n");
c9dc220e0301 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <pidgin@unreliablesource.net>
parents: 22113
diff changeset
27 }
c9dc220e0301 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <pidgin@unreliablesource.net>
parents: 22113
diff changeset
28
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 sub plugin_load {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 my $plugin = shift;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31
22504
c9dc220e0301 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <pidgin@unreliablesource.net>
parents: 22113
diff changeset
32 Purple::Debug::info("perl test plugin", "plugin_load\n");
c9dc220e0301 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <pidgin@unreliablesource.net>
parents: 22113
diff changeset
33
c9dc220e0301 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <pidgin@unreliablesource.net>
parents: 22113
diff changeset
34 Purple::Debug::info("perl test plugin", "Listing accounts.\n");
c9dc220e0301 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <pidgin@unreliablesource.net>
parents: 22113
diff changeset
35 foreach $account (Purple::Accounts::get_all()) {
c9dc220e0301 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <pidgin@unreliablesource.net>
parents: 22113
diff changeset
36 Purple::Debug::info("perl test plugin", $account->get_username() . "\n");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38
22504
c9dc220e0301 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <pidgin@unreliablesource.net>
parents: 22113
diff changeset
39 Purple::Signal::connect(Purple::Accounts::get_handle(),
c9dc220e0301 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <pidgin@unreliablesource.net>
parents: 22113
diff changeset
40 "account-status-changed", $plugin,
c9dc220e0301 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <pidgin@unreliablesource.net>
parents: 22113
diff changeset
41 \&account_status_cb, "test");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42 }