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