comparison libpurple/plugins/perl/scripts/account.pl @ 15833:2f8274ce570a

Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
author Daniel Atallah <daniel.atallah@gmail.com>
date Mon, 19 Mar 2007 17:02:24 +0000
parents 5fe8042783c1
children 0646207f360f
comparison
equal deleted inserted replaced
15832:df859a1b40b1 15833:2f8274ce570a
1 $MODULE_NAME = "Account Functions Test"; 1 $MODULE_NAME = "Account Functions Test";
2 2
3 use Gaim; 3 use Purple;
4 4
5 # All the information Gaim gets about our nifty plugin 5 # All the information Purple gets about our nifty plugin
6 %PLUGIN_INFO = ( 6 %PLUGIN_INFO = (
7 perl_api_version => 2, 7 perl_api_version => 2,
8 name => "Perl: $MODULE_NAME", 8 name => "Perl: $MODULE_NAME",
9 version => "0.1", 9 version => "0.1",
10 summary => "Test plugin for the Perl interpreter.", 10 summary => "Test plugin for the Perl interpreter.",
38 # This is the sub defined in %PLUGIN_INFO to be called when the plugin is loaded 38 # This is the sub defined in %PLUGIN_INFO to be called when the plugin is loaded
39 # Note: The plugin has a reference to itself on top of the argument stack. 39 # Note: The plugin has a reference to itself on top of the argument stack.
40 sub plugin_load { 40 sub plugin_load {
41 my $plugin = shift; 41 my $plugin = shift;
42 print "#" x 80 . "\n\n"; 42 print "#" x 80 . "\n\n";
43 Gaim::Debug::info($MODULE_NAME, "plugin_load() - Testing $MODULE_NAME Started."); 43 Purple::Debug::info($MODULE_NAME, "plugin_load() - Testing $MODULE_NAME Started.");
44 print "\n\n"; 44 print "\n\n";
45 45
46 46
47 ################################# 47 #################################
48 # # 48 # #
49 # Gaim::Account::Option # 49 # Purple::Account::Option #
50 # # 50 # #
51 ################################# 51 #################################
52 52
53 print "Testing: Gaim::Account::Option::new()...\n"; 53 print "Testing: Purple::Account::Option::new()...\n";
54 $acc_opt = Gaim::Account::Option->new(1, "TEXT", "pref_name"); 54 $acc_opt = Purple::Account::Option->new(1, "TEXT", "pref_name");
55 $acc_opt2 = Gaim::Account::Option->bool_new("TeXt", "MYprefName", 1); 55 $acc_opt2 = Purple::Account::Option->bool_new("TeXt", "MYprefName", 1);
56 56
57 ################################# 57 #################################
58 # # 58 # #
59 # Gaim::Account # 59 # Purple::Account #
60 # # 60 # #
61 ################################# 61 #################################
62 62
63 63
64 print "Testing: Gaim::Account::new()... "; 64 print "Testing: Purple::Account::new()... ";
65 $account = Gaim::Account->new($TEST_NAME, $PROTOCOL_ID); 65 $account = Purple::Account->new($TEST_NAME, $PROTOCOL_ID);
66 if ($account) { print "ok.\n"; } else { print "fail.\n"; } 66 if ($account) { print "ok.\n"; } else { print "fail.\n"; }
67 67
68 print "Testing: Gaim::Accounts::add()..."; 68 print "Testing: Purple::Accounts::add()...";
69 Gaim::Accounts::add($account); 69 Purple::Accounts::add($account);
70 print "pending find...\n"; 70 print "pending find...\n";
71 71
72 print "Testing: Gaim::Accounts::find()..."; 72 print "Testing: Purple::Accounts::find()...";
73 $account = Gaim::Accounts::find($TEST_NAME, $PROTOCOL_ID); 73 $account = Purple::Accounts::find($TEST_NAME, $PROTOCOL_ID);
74 if ($account) { print "ok.\n"; } else { print "fail.\n"; } 74 if ($account) { print "ok.\n"; } else { print "fail.\n"; }
75 75
76 print "Testing: Gaim::Account::get_username()... "; 76 print "Testing: Purple::Account::get_username()... ";
77 $user_name = $account->get_username(); 77 $user_name = $account->get_username();
78 if ($user_name) { 78 if ($user_name) {
79 print "Success: $user_name.\n"; 79 print "Success: $user_name.\n";
80 } else { 80 } else {
81 print "Failed!\n"; 81 print "Failed!\n";
82 } 82 }
83 83
84 print "Testing: Gaim::Account::is_connected()... "; 84 print "Testing: Purple::Account::is_connected()... ";
85 if ($account->is_connected()) { 85 if ($account->is_connected()) {
86 print " Connected.\n"; 86 print " Connected.\n";
87 } else { 87 } else {
88 print " Disconnected.\n"; 88 print " Disconnected.\n";
89 } 89 }
90 90
91 print "Testing: Gaim::Accounts::get_active_status()... "; 91 print "Testing: Purple::Accounts::get_active_status()... ";
92 if ($account->get_active_status()) { 92 if ($account->get_active_status()) {
93 print "Okay.\n"; 93 print "Okay.\n";
94 } else { 94 } else {
95 print "Failed!\n"; 95 print "Failed!\n";
96 } 96 }
97 97
98 $account = Gaim::Accounts::find($USERNAME, $PROTOCOL_ID); 98 $account = Purple::Accounts::find($USERNAME, $PROTOCOL_ID);
99 print "Testing: Gaim::Accounts::connect()...pending...\n"; 99 print "Testing: Purple::Accounts::connect()...pending...\n";
100 100
101 $account->set_status("available", TRUE); 101 $account->set_status("available", TRUE);
102 $account->connect(); 102 $account->connect();
103 103
104 print "\n\n"; 104 print "\n\n";
105 Gaim::Debug::info($MODULE_NAME, "plugin_load() - Testing $MODULE_NAME Completed.\n"); 105 Purple::Debug::info($MODULE_NAME, "plugin_load() - Testing $MODULE_NAME Completed.\n");
106 print "\n\n" . "#" x 80 . "\n\n"; 106 print "\n\n" . "#" x 80 . "\n\n";
107 } 107 }
108 108
109 sub plugin_unload { 109 sub plugin_unload {
110 my $plugin = shift; 110 my $plugin = shift;
111 111
112 print "#" x 80 . "\n\n"; 112 print "#" x 80 . "\n\n";
113 Gaim::Debug::info($MODULE_NAME, "plugin_unload() - Testing $MODULE_NAME Started.\n"); 113 Purple::Debug::info($MODULE_NAME, "plugin_unload() - Testing $MODULE_NAME Started.\n");
114 print "\n\n"; 114 print "\n\n";
115 115
116 ######### TEST CODE HERE ########## 116 ######### TEST CODE HERE ##########
117 117
118 print "\n\n"; 118 print "\n\n";
119 Gaim::Debug::info($MODULE_NAME, "plugin_unload() - Testing $MODULE_NAME Completed.\n"); 119 Purple::Debug::info($MODULE_NAME, "plugin_unload() - Testing $MODULE_NAME Completed.\n");
120 print "\n\n" . "#" x 80 . "\n\n"; 120 print "\n\n" . "#" x 80 . "\n\n";
121 } 121 }
122 122