libpurple/plugins/test.pl

Sun, 22 Nov 2009 21:13:20 +0000

author
Felix Kerekes <sttwister@soc.pidgin.im>
date
Sun, 22 Nov 2009 21:13:20 +0000
changeset 28684
b4c337df39a1
parent 22485
dbb14925ce01
child 33955
55aa58076485
permissions
-rw-r--r--

Documented chat API. References #10605

22485
dbb14925ce01 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <deryni@pidgin.im>
parents: 22240
diff changeset
1 use Purple;
6529
5a0984a84166 [gaim-migrate @ 7046]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2
5a0984a84166 [gaim-migrate @ 7046]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 %PLUGIN_INFO = (
5a0984a84166 [gaim-migrate @ 7046]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4 perl_api_version => 2,
5a0984a84166 [gaim-migrate @ 7046]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 name => 'Test Perl Plugin',
5a0984a84166 [gaim-migrate @ 7046]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6 version => '1.0',
5a0984a84166 [gaim-migrate @ 7046]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7 summary => 'Provides as a test base for the perl plugin.',
5a0984a84166 [gaim-migrate @ 7046]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
8 description => 'Provides as a test base for the perl plugin.',
22485
dbb14925ce01 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <deryni@pidgin.im>
parents: 22240
diff changeset
9 author => 'Etan Reisner <deryni\@pidgin.im>',
16245
d50689fa41c9 Point to the Pidgin website.
Richard Laager <rlaager@pidgin.im>
parents: 15435
diff changeset
10 url => 'http://pidgin.im',
6529
5a0984a84166 [gaim-migrate @ 7046]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11
22485
dbb14925ce01 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <deryni@pidgin.im>
parents: 22240
diff changeset
12 load => "plugin_load"
6529
5a0984a84166 [gaim-migrate @ 7046]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 );
5a0984a84166 [gaim-migrate @ 7046]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14
5a0984a84166 [gaim-migrate @ 7046]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 sub plugin_init {
5a0984a84166 [gaim-migrate @ 7046]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 return %PLUGIN_INFO;
5a0984a84166 [gaim-migrate @ 7046]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 }
5a0984a84166 [gaim-migrate @ 7046]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18
22485
dbb14925ce01 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <deryni@pidgin.im>
parents: 22240
diff changeset
19 sub account_status_cb {
dbb14925ce01 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <deryni@pidgin.im>
parents: 22240
diff changeset
20 my ($account, $old, $new, $data) = @_;
dbb14925ce01 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <deryni@pidgin.im>
parents: 22240
diff changeset
21
dbb14925ce01 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <deryni@pidgin.im>
parents: 22240
diff changeset
22 Purple::Debug::info("perl test plugin", "In account_status_cb\n");
dbb14925ce01 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <deryni@pidgin.im>
parents: 22240
diff changeset
23
dbb14925ce01 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <deryni@pidgin.im>
parents: 22240
diff changeset
24 Purple::Debug::info("perl test plugin", "Account " .
dbb14925ce01 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <deryni@pidgin.im>
parents: 22240
diff changeset
25 $account->get_username() . " changed status.\n");
dbb14925ce01 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <deryni@pidgin.im>
parents: 22240
diff changeset
26 Purple::Debug::info("perl test plugin", $data . "\n");
dbb14925ce01 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <deryni@pidgin.im>
parents: 22240
diff changeset
27 }
dbb14925ce01 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <deryni@pidgin.im>
parents: 22240
diff changeset
28
6529
5a0984a84166 [gaim-migrate @ 7046]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
29 sub plugin_load {
5a0984a84166 [gaim-migrate @ 7046]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
30 my $plugin = shift;
5a0984a84166 [gaim-migrate @ 7046]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
31
22485
dbb14925ce01 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <deryni@pidgin.im>
parents: 22240
diff changeset
32 Purple::Debug::info("perl test plugin", "plugin_load\n");
dbb14925ce01 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <deryni@pidgin.im>
parents: 22240
diff changeset
33
dbb14925ce01 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <deryni@pidgin.im>
parents: 22240
diff changeset
34 Purple::Debug::info("perl test plugin", "Listing accounts.\n");
dbb14925ce01 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <deryni@pidgin.im>
parents: 22240
diff changeset
35 foreach $account (Purple::Accounts::get_all()) {
dbb14925ce01 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <deryni@pidgin.im>
parents: 22240
diff changeset
36 Purple::Debug::info("perl test plugin", $account->get_username() . "\n");
6529
5a0984a84166 [gaim-migrate @ 7046]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
37 }
6592
1ce027571e8a [gaim-migrate @ 7116]
Christian Hammond <chipx86@chipx86.com>
parents: 6529
diff changeset
38
22485
dbb14925ce01 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <deryni@pidgin.im>
parents: 22240
diff changeset
39 Purple::Signal::connect(Purple::Accounts::get_handle(),
dbb14925ce01 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <deryni@pidgin.im>
parents: 22240
diff changeset
40 "account-status-changed", $plugin,
dbb14925ce01 Bring the test.pl plugin at least theoretically up to date (I haven't tried it
Etan Reisner <deryni@pidgin.im>
parents: 22240
diff changeset
41 \&account_status_cb, "test");
6529
5a0984a84166 [gaim-migrate @ 7046]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
42 }

mercurial