annotate plugins/perl/scripts/plugin_pref.pl @ 13572:7773c79bbe01

[gaim-migrate @ 15951] Fixing the capitalization of a couple strings. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Sun, 26 Mar 2006 16:19:19 +0000
parents 6fd82071a7b8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11170
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
1 $MODULE_NAME = "Prefs Functions Test";
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
2 use Gaim;
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
3 # All the information Gaim gets about our nifty plugin
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
4 %PLUGIN_INFO = (
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
5 perl_api_version => 2,
12364
6fd82071a7b8 [gaim-migrate @ 14668]
Mark Doliner <mark@kingant.net>
parents: 11170
diff changeset
6 name => "Perl: $MODULE_NAME",
11170
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
7 version => "0.1",
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
8 summary => "Test plugin for the Perl interpreter.",
12364
6fd82071a7b8 [gaim-migrate @ 14668]
Mark Doliner <mark@kingant.net>
parents: 11170
diff changeset
9 description => "Implements a set of test proccedures to ensure all " .
6fd82071a7b8 [gaim-migrate @ 14668]
Mark Doliner <mark@kingant.net>
parents: 11170
diff changeset
10 "functions that work in the C API still work in the " .
6fd82071a7b8 [gaim-migrate @ 14668]
Mark Doliner <mark@kingant.net>
parents: 11170
diff changeset
11 "Perl plugin interface. As XSUBs are added, this " .
6fd82071a7b8 [gaim-migrate @ 14668]
Mark Doliner <mark@kingant.net>
parents: 11170
diff changeset
12 "*should* be updated to test the changes. " .
6fd82071a7b8 [gaim-migrate @ 14668]
Mark Doliner <mark@kingant.net>
parents: 11170
diff changeset
13 "Furthermore, this will function as the tutorial perl " .
6fd82071a7b8 [gaim-migrate @ 14668]
Mark Doliner <mark@kingant.net>
parents: 11170
diff changeset
14 "plugin.",
11170
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
15 author => "John H. Kelm <johnhkelm\@gmail.com>",
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
16 url => "http://sourceforge.net/users/johnhkelm/",
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
17
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
18 load => "plugin_load",
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
19 unload => "plugin_unload",
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
20 prefs_info => "foo"
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
21 );
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
22
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
23 # These names must already exist
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
24 my $GROUP = "UIUC Buddies";
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
25 my $USERNAME = "johnhkelm2";
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
26
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
27 # We will create these on load then destroy them on unload
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
28 my $TEST_GROUP = "perlTestGroup";
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
29 my $TEST_NAME = "perlTestName";
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
30 my $TEST_ALIAS = "perlTestAlias";
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
31 my $PROTOCOL_ID = "prpl-oscar";
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
32
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
33 sub foo {
12364
6fd82071a7b8 [gaim-migrate @ 14668]
Mark Doliner <mark@kingant.net>
parents: 11170
diff changeset
34 $frame = Gaim::PluginPref::Frame->new();
11170
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
35
12364
6fd82071a7b8 [gaim-migrate @ 14668]
Mark Doliner <mark@kingant.net>
parents: 11170
diff changeset
36 $ppref = Gaim::PluginPref->new_with_label("boolean");
6fd82071a7b8 [gaim-migrate @ 14668]
Mark Doliner <mark@kingant.net>
parents: 11170
diff changeset
37 $frame->add($ppref);
11170
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
38
12364
6fd82071a7b8 [gaim-migrate @ 14668]
Mark Doliner <mark@kingant.net>
parents: 11170
diff changeset
39 $ppref = Gaim::PluginPref->new_with_name_and_label(
6fd82071a7b8 [gaim-migrate @ 14668]
Mark Doliner <mark@kingant.net>
parents: 11170
diff changeset
40 "/plugins/core/perl_test/bool", "Boolean Preference");
6fd82071a7b8 [gaim-migrate @ 14668]
Mark Doliner <mark@kingant.net>
parents: 11170
diff changeset
41 $frame->add($ppref);
11170
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
42
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
43
12364
6fd82071a7b8 [gaim-migrate @ 14668]
Mark Doliner <mark@kingant.net>
parents: 11170
diff changeset
44 $ppref = Gaim::PluginPref->new_with_name_and_label(
6fd82071a7b8 [gaim-migrate @ 14668]
Mark Doliner <mark@kingant.net>
parents: 11170
diff changeset
45 "/plugins/core/perl_test/choice", "Choice Preference");
6fd82071a7b8 [gaim-migrate @ 14668]
Mark Doliner <mark@kingant.net>
parents: 11170
diff changeset
46 $ppref->set_type(1);
6fd82071a7b8 [gaim-migrate @ 14668]
Mark Doliner <mark@kingant.net>
parents: 11170
diff changeset
47 $ppref->add_choice("ch0", $frame);
6fd82071a7b8 [gaim-migrate @ 14668]
Mark Doliner <mark@kingant.net>
parents: 11170
diff changeset
48 $ppref->add_choice("ch1", $frame);
6fd82071a7b8 [gaim-migrate @ 14668]
Mark Doliner <mark@kingant.net>
parents: 11170
diff changeset
49 $frame->add($ppref);
11170
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
50
12364
6fd82071a7b8 [gaim-migrate @ 14668]
Mark Doliner <mark@kingant.net>
parents: 11170
diff changeset
51 $ppref = Gaim::PluginPref->new_with_name_and_label(
6fd82071a7b8 [gaim-migrate @ 14668]
Mark Doliner <mark@kingant.net>
parents: 11170
diff changeset
52 "/plugins/core/perl_test/text", "Text Box Preference");
6fd82071a7b8 [gaim-migrate @ 14668]
Mark Doliner <mark@kingant.net>
parents: 11170
diff changeset
53 $ppref->set_max_length(16);
6fd82071a7b8 [gaim-migrate @ 14668]
Mark Doliner <mark@kingant.net>
parents: 11170
diff changeset
54 $frame->add($ppref);
11170
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
55
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
56 return $frame;
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
57 }
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
58
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
59 sub plugin_init {
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
60
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
61 return %PLUGIN_INFO;
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
62 }
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
63
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
64
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
65 # This is the sub defined in %PLUGIN_INFO to be called when the plugin is loaded
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
66 # Note: The plugin has a reference to itself on top of the argument stack.
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
67 sub plugin_load {
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
68 my $plugin = shift;
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
69 print "#" x 80 . "\n\n";
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
70
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
71
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
72 ######### TEST CODE HERE ##########
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
73
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
74 Gaim::Prefs::add_none("/plugins/core/perl_test");
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
75 Gaim::Prefs::add_bool("/plugins/core/perl_test/bool", 1);
12364
6fd82071a7b8 [gaim-migrate @ 14668]
Mark Doliner <mark@kingant.net>
parents: 11170
diff changeset
76 Gaim::Prefs::add_string("/plugins/core/perl_test/choice", "ch1");
6fd82071a7b8 [gaim-migrate @ 14668]
Mark Doliner <mark@kingant.net>
parents: 11170
diff changeset
77 Gaim::Prefs::add_string("/plugins/core/perl_test/text", "Foobar");
11170
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
78
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
79
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
80 print "\n\n" . "#" x 80 . "\n\n";
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
81 }
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
82
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
83 sub plugin_unload {
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
84 my $plugin = shift;
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
85
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
86 print "#" x 80 . "\n\n";
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
87
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
88
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
89 ######### TEST CODE HERE ##########
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
90
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
91
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
92 print "\n\n" . "#" x 80 . "\n\n";
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
93 }
0e9e2b923d09 [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
94