comparison plugins/gaim.pl @ 3563:e120097bbd72

[gaim-migrate @ 3658] I made my perl script unloading not suck (as much). Now you may port your perl scripts--use gaim.pl and PERL-HOWTO as references. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Sat, 28 Sep 2002 08:08:14 +0000
parents cd938f18f3f8
children
comparison
equal deleted inserted replaced
3562:de3bc24fff02 3563:e120097bbd72
1 GAIM::register("Example", "1.0", "goodbye", ""); 1 sub description {
2 my($a, $b, $c, $d, $e, $f) = @_;
3 ("Example", "1.0", "An example Gaim perl script that does nothing particularly useful:\n\t-Show a dialog on load\n\t-Set user idle for 6,000 seconds\n\t-Greets people signing on with \"Hello\"\n\t-Informs you when script has been loaded for one minute.", "Eric Warmenhoven &lt;eric\@warmenhoven.org>", "http://gaim.sf.net", "/dev/null");
4 }
2 5
6 $handle = GAIM::register("Example", "1.0", "goodbye", "");
7
8 GAIM::print("Perl Says", "Handle $handle");
9
3 $ver = GAIM::get_info(0); 10 $ver = GAIM::get_info(0);
4 @ids = GAIM::get_info(1); 11 @ids = GAIM::get_info(1);
5 12
6 $msg = "Gaim $ver:"; 13 $msg = "Gaim $ver:";
7 foreach $id (@ids) { 14 foreach $id (@ids) {
8 $pro = GAIM::get_info(7, $id); 15 $pro = GAIM::get_info(7, $id);
9 $nam = GAIM::get_info(3, $id); 16 $nam = GAIM::get_info(3, $id);
10 $msg .= "\n$nam using $pro"; 17 $msg .= "\n$nam using $pro";
11 } 18 }
12 19
13 GAIM::print("Perl Says", $msg);
14 20
15 GAIM::command("idle", 6000); 21 GAIM::command("idle", 6000);
16 22
17 GAIM::add_event_handler("event_buddy_signon", "echo_reply"); 23 GAIM::add_event_handler($handle, "event_buddy_signon", "echo_reply");
18 GAIM::add_timeout_handler(60, "notify"); 24 GAIM::add_timeout_handler($handle, 60, "notify");
19 25
20 sub echo_reply { 26 sub echo_reply {
21 $index = $_[0]; 27 $index = $_[0];
22 $who = $_[1]; 28 $who = $_[1];
23 GAIM::print_to_conv($index, $who, "Hello", 0); 29 GAIM::print_to_conv($index, $who, "Hello", 0);
29 35
30 sub goodbye { 36 sub goodbye {
31 GAIM::print("You Bastard!", "You killed Kenny!"); 37 GAIM::print("You Bastard!", "You killed Kenny!");
32 } 38 }
33 39
34 sub description {
35 my($a, $b, $c, $d, $e, $f) = @_;
36 ("Example", "1.0", "An example Gaim perl script that does nothing particularly useful:\n\t-Show a dialog on load\n\t-Set user idle for 6,000 seconds\n\t-Greets people signing on with \"Hello\"\n\t-Informs you when script has been loaded for one minute.", "Eric Warmenhoven &lt;eric\@warmenhoven.org>", "http://gaim.sf.net", "/dev/null");
37 }
38