comparison plugins/perl/scripts/conversation.pl @ 11170:0e9e2b923d09

[gaim-migrate @ 13271] Fixed some bugs and made some additions to the XSUBS. Added some of my test scripts which are incomplete, but mostly functional. GaimPluginPrefs and GaimGtkPluginPrefs--using evals to do the Gtk widgets with gtk2-perl--work. Plugin actions can now be added, but only one for now. committer: Tailor Script <tailor@pidgin.im>
author John H. Kelm <johnkelm@gmail.com>
date Fri, 29 Jul 2005 13:38:00 +0000
parents
children 4d9686e7c234
comparison
equal deleted inserted replaced
11169:778d5464a9b8 11170:0e9e2b923d09
1 $MODULE_NAME = "Conversation Test";
2
3 use Gaim;
4
5 # All the information Gaim gets about our nifty plugin
6 %PLUGIN_INFO = (
7 perl_api_version => 2,
8 name => " Perl: $MODULE_NAME",
9 version => "0.1",
10 summary => "Test plugin for the Perl interpreter.",
11 description => "Implements a set of test proccedures to ensure all functions that work in the C API still work in the Perl plugin interface. As XSUBs are added, this *should* be updated to test the changes. Furthermore, this will function as the tutorial perl plugin.",
12 author => "John H. Kelm <johnhkelm\@gmail.com",
13 url => "http://sourceforge.net/users/johnhkelm/",
14
15 load => "plugin_load",
16 unload => "plugin_unload"
17 );
18
19
20 # These names must already exist
21 my $GROUP = "UIUC Buddies";
22 my $USERNAME = "johnhkelm2";
23
24 # We will create these on load then destroy them on unload
25 my $TEST_GROUP = "UConn Buddies";
26 my $TEST_NAME = "johnhkelm";
27 my $TEST_ALIAS = "John Kelm";
28 my $PROTOCOL_ID = "prpl-oscar";
29
30
31 sub plugin_init {
32 return %PLUGIN_INFO;
33 }
34
35
36 # This is the sub defined in %PLUGIN_INFO to be called when the plugin is loaded
37 # Note: The plugin has a reference to itself on top of the argument stack.
38 sub plugin_load {
39 my $plugin = shift;
40 print "#" x 80 . "\n\n";
41
42 print "PERL: Finding account.\n";
43 $account = Gaim::Accounts::find($USERNAME, $PROTOCOL_ID);
44
45 ######### TEST CODE HERE ##########
46 print "Testing Gaim::Conv::new()...";
47 $conv1 = Gaim::Conv::new(1, $account, "Test Conv. 1");
48 if ($conv) { print "ok.\n"; } else { print "fail.\n"; }
49
50 print "Testing Gaim::Conv::new()...";
51 $conv2 = Gaim::Conv::new(1, $account, "Test Conv. 2");
52 if ($conv) { print "ok.\n"; } else { print "fail.\n"; }
53
54 print "Testing Gaim::Conv::Window::new()...\n";
55 $win = Gaim::Conv::Window::new();
56
57 print "Testing Gaim::Conv::Window::add_conversation()...";
58 $conv_count = Gaim::Conv::Window::add_conversation($win, $conv1);
59 if ($conv_count) { print "ok..." . $conv_count . " conversations...\n"; } else { print "fail.\n"; }
60
61 print "Testing Gaim::Conv::Window::add_conversation()...";
62 $conv_count = Gaim::Conv::Window::add_conversation($win, $conv2);
63 if ($conv_count) { print "ok..." . $conv_count . " conversations...\n"; } else { print "fail.\n"; }
64
65 print "Testing Gaim::Conv::Window::show()...\n";
66 Gaim::Conv::Window::show($win);
67
68 print "Testing Gaim::Conv::get_im_data()...\n";
69 $im = Gaim::Conv::get_im_data($conv1);
70 if ($im) { print "ok.\n"; } else { print "fail.\n"; }
71
72 print "Testing Gaim::Conv::IM::send()...\n";
73 Gaim::Conv::IM::send($im, "Message Test.");
74
75 print "Testing Gaim::Conv::IM::write()...\n";
76 Gaim::Conv::IM::write($im, "sendingUser", "<b>Message</b> Test.", 0, 0);
77
78 print "#" x 80 . "\n\n";
79 }
80
81 sub plugin_unload {
82 my $plugin = shift;
83
84 print "#" x 80 . "\n\n";
85 ######### TEST CODE HERE ##########
86
87
88
89 print "Testing Gaim::Conv::Window::get_conversation_count()...\n";
90 $conv_count = Gaim::Conv::Window::get_conversation_count($win);
91 print $conv_count;
92 if ($conv_count > 0) {
93 print "Testing Gaim::Conv::Window::destroy()...\n";
94 Gaim::Conv::Window::destroy($win);
95 }
96
97 print "\n\n" . "#" x 80 . "\n\n";
98 }
99