Mercurial > pidgin
annotate libgaim/plugins/perl/scripts/account.pl @ 15113:4a8c368df4ea
[gaim-migrate @ 17899]
Some touchups:
* If one of the parallel connection attempts fails immediately (i.e.
does not time out) then don't cancel the other one.
* Make sure we don't continue on to step 2 of the peer connection
process after we kick off the parallel gaim_proxy_connects(). It
looks like this would happen most of the time, because the
connect_timeout_timer would be added for the verified ip, so it
would NOT be added for the client ip, and so we wouldn't hit the
"return" call because it happens to be in the same block as the
second gaim_timeout_add() call.
* Add the connection timeout timer even if the gaim_proxy_connect() to
the verified ip returns NULL for some crazy reason.
I didn't actually test any of this. I should probably do that when
I get home.
committer: Tailor Script <tailor@pidgin.im>
| author | Mark Doliner <mark@kingant.net> |
|---|---|
| date | Wed, 06 Dec 2006 01:29:59 +0000 |
| parents | cb7eef7bf550 |
| children |
| rev | line source |
|---|---|
| 14192 | 1 $MODULE_NAME = "Account Functions Test"; |
| 2 | |
| 3 use Gaim; | |
| 4 | |
| 5 # All the information Gaim gets about our nifty plugin | |
|
15104
cb7eef7bf550
[gaim-migrate @ 17890]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
6 %PLUGIN_INFO = ( |
|
cb7eef7bf550
[gaim-migrate @ 17890]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
7 perl_api_version => 2, |
|
cb7eef7bf550
[gaim-migrate @ 17890]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
8 name => "Perl: $MODULE_NAME", |
|
cb7eef7bf550
[gaim-migrate @ 17890]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
9 version => "0.1", |
|
cb7eef7bf550
[gaim-migrate @ 17890]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
10 summary => "Test plugin for the Perl interpreter.", |
| 14192 | 11 description => "Implements a set of test proccedures to ensure all " . |
|
15104
cb7eef7bf550
[gaim-migrate @ 17890]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
12 "functions that work in the C API still work in the " . |
| 14192 | 13 "Perl plugin interface. As XSUBs are added, this " . |
| 14 "*should* be updated to test the changes. " . | |
| 15 "Furthermore, this will function as the tutorial perl " . | |
| 16 "plugin.", | |
|
15104
cb7eef7bf550
[gaim-migrate @ 17890]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
17 author => "John H. Kelm <johnhkelm\@gmail.com>", |
|
cb7eef7bf550
[gaim-migrate @ 17890]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
18 url => "http://sourceforge.net/users/johnhkelm/", |
|
cb7eef7bf550
[gaim-migrate @ 17890]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
19 |
|
cb7eef7bf550
[gaim-migrate @ 17890]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
20 load => "plugin_load", |
|
cb7eef7bf550
[gaim-migrate @ 17890]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
21 unload => "plugin_unload" |
|
cb7eef7bf550
[gaim-migrate @ 17890]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
22 ); |
| 14192 | 23 |
| 24 | |
| 25 # These names must already exist | |
| 26 my $USERNAME = "johnhkelm2"; | |
|
15104
cb7eef7bf550
[gaim-migrate @ 17890]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
27 |
| 14192 | 28 # We will create these on load then destroy them on unload |
| 29 my $TEST_NAME = "perlTestName"; | |
| 30 my $PROTOCOL_ID = "prpl-oscar"; | |
| 31 | |
| 32 | |
|
15104
cb7eef7bf550
[gaim-migrate @ 17890]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
33 sub plugin_init { |
|
cb7eef7bf550
[gaim-migrate @ 17890]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
34 return %PLUGIN_INFO; |
|
cb7eef7bf550
[gaim-migrate @ 17890]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
35 } |
| 14192 | 36 |
| 37 | |
| 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. | |
|
15104
cb7eef7bf550
[gaim-migrate @ 17890]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
40 sub plugin_load { |
|
cb7eef7bf550
[gaim-migrate @ 17890]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
41 my $plugin = shift; |
| 14192 | 42 print "#" x 80 . "\n\n"; |
|
15104
cb7eef7bf550
[gaim-migrate @ 17890]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
43 Gaim::Debug::info($MODULE_NAME, "plugin_load() - Testing $MODULE_NAME Started."); |
| 14192 | 44 print "\n\n"; |
|
15104
cb7eef7bf550
[gaim-migrate @ 17890]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
45 |
| 14192 | 46 |
| 47 ################################# | |
| 48 # # | |
| 49 # Gaim::Account::Option # | |
| 50 # # | |
| 51 ################################# | |
| 52 | |
| 53 print "Testing: Gaim::Account::Option::new()...\n"; | |
| 54 $acc_opt = Gaim::Account::Option->new(1, "TEXT", "pref_name"); | |
| 55 $acc_opt2 = Gaim::Account::Option->bool_new("TeXt", "MYprefName", 1); | |
|
15104
cb7eef7bf550
[gaim-migrate @ 17890]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
56 |
| 14192 | 57 ################################# |
| 58 # # | |
| 59 # Gaim::Account # | |
| 60 # # | |
| 61 ################################# | |
| 62 | |
| 63 | |
| 64 print "Testing: Gaim::Account::new()... "; | |
| 65 $account = Gaim::Account->new($TEST_NAME, $PROTOCOL_ID); | |
| 66 if ($account) { print "ok.\n"; } else { print "fail.\n"; } | |
| 67 | |
| 68 print "Testing: Gaim::Accounts::add()..."; | |
| 69 Gaim::Accounts::add($account); | |
| 70 print "pending find...\n"; | |
| 71 | |
| 72 print "Testing: Gaim::Accounts::find()..."; | |
| 73 $account = Gaim::Accounts::find($TEST_NAME, $PROTOCOL_ID); | |
| 74 if ($account) { print "ok.\n"; } else { print "fail.\n"; } | |
|
15104
cb7eef7bf550
[gaim-migrate @ 17890]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
75 |
| 14192 | 76 print "Testing: Gaim::Account::get_username()... "; |
| 77 $user_name = $account->get_username(); | |
| 78 if ($user_name) { | |
| 79 print "Success: $user_name.\n"; | |
| 80 } else { | |
| 81 print "Failed!\n"; | |
| 82 } | |
| 83 | |
| 84 print "Testing: Gaim::Account::is_connected()... "; | |
| 85 if ($account->is_connected()) { | |
| 86 print " Connected.\n"; | |
| 87 } else { | |
| 88 print " Disconnected.\n"; | |
| 89 } | |
| 90 | |
| 91 print "Testing: Gaim::Accounts::get_active_status()... "; | |
| 92 if ($account->get_active_status()) { | |
| 93 print "Okay.\n"; | |
| 94 } else { | |
| 95 print "Failed!\n"; | |
| 96 } | |
| 97 | |
| 98 $account = Gaim::Accounts::find($USERNAME, $PROTOCOL_ID); | |
| 99 print "Testing: Gaim::Accounts::connect()...pending...\n"; | |
|
15104
cb7eef7bf550
[gaim-migrate @ 17890]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
100 |
| 14192 | 101 $account->set_status("available", TRUE); |
| 102 $account->connect(); | |
| 103 | |
| 104 print "\n\n"; | |
|
15104
cb7eef7bf550
[gaim-migrate @ 17890]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
105 Gaim::Debug::info($MODULE_NAME, "plugin_load() - Testing $MODULE_NAME Completed.\n"); |
| 14192 | 106 print "\n\n" . "#" x 80 . "\n\n"; |
|
15104
cb7eef7bf550
[gaim-migrate @ 17890]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
107 } |
| 14192 | 108 |
|
15104
cb7eef7bf550
[gaim-migrate @ 17890]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
109 sub plugin_unload { |
|
cb7eef7bf550
[gaim-migrate @ 17890]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
110 my $plugin = shift; |
| 14192 | 111 |
| 112 print "#" x 80 . "\n\n"; | |
|
15104
cb7eef7bf550
[gaim-migrate @ 17890]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
113 Gaim::Debug::info($MODULE_NAME, "plugin_unload() - Testing $MODULE_NAME Started.\n"); |
| 14192 | 114 print "\n\n"; |
| 115 | |
| 116 ######### TEST CODE HERE ########## | |
| 117 | |
| 118 print "\n\n"; | |
|
15104
cb7eef7bf550
[gaim-migrate @ 17890]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
119 Gaim::Debug::info($MODULE_NAME, "plugin_unload() - Testing $MODULE_NAME Completed.\n"); |
| 14192 | 120 print "\n\n" . "#" x 80 . "\n\n"; |
| 121 } | |
| 122 |
