Mercurial > pidgin
annotate plugins/perl/scripts/account.pl @ 13925:60f39c405dff
[gaim-migrate @ 16442]
It is currently possible for yourself to not show up in your own
buddy list at signon with Jabber. To reproduce:
1. Sign on and add yourself to your buddy list
2. Sign off and exit Gaim
3. Delete your blist.xml
4. Sign on
The same bug would also appear when signing into your Jabber
account using Gaim for the first time.
Normally this works because the Jabber PRPL fakes showing your status
whenever jabber_presence_send() is called. However, the call to
jabber_presence_send() can happen BEFORE we receive the roster from the
server (it usually does, I think) so the PRPL tries to set the status
for yourself, but your GaimBuddy node doesn't exist yet.
committer: Tailor Script <tailor@pidgin.im>
| author | Mark Doliner <mark@kingant.net> |
|---|---|
| date | Thu, 06 Jul 2006 08:24:26 +0000 |
| parents | 6fd82071a7b8 |
| children |
| rev | line source |
|---|---|
| 11170 | 1 $MODULE_NAME = "Account Functions 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.", | |
| 12364 | 11 description => "Implements a set of test proccedures to ensure all " . |
| 12 "functions that work in the C API still work in the " . | |
| 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.", | |
|
11457
4d9686e7c234
[gaim-migrate @ 13696]
Richard Laager <rlaager@wiktel.com>
parents:
11170
diff
changeset
|
17 author => "John H. Kelm <johnhkelm\@gmail.com>", |
| 11170 | 18 url => "http://sourceforge.net/users/johnhkelm/", |
| 19 | |
| 20 load => "plugin_load", | |
| 21 unload => "plugin_unload" | |
| 22 ); | |
| 23 | |
| 24 | |
| 25 # These names must already exist | |
| 26 my $GROUP = "UIUC Buddies"; | |
| 27 my $USERNAME = "johnhkelm2"; | |
| 28 | |
| 29 # We will create these on load then destroy them on unload | |
| 30 my $TEST_GROUP = "perlTestGroup"; | |
| 31 my $TEST_NAME = "perlTestName"; | |
| 32 my $TEST_ALIAS = "perlTestAlias"; | |
| 33 my $PROTOCOL_ID = "prpl-oscar"; | |
| 34 | |
| 35 | |
| 36 sub plugin_init { | |
| 37 return %PLUGIN_INFO; | |
| 38 } | |
| 39 | |
| 40 | |
| 41 # This is the sub defined in %PLUGIN_INFO to be called when the plugin is loaded | |
| 42 # Note: The plugin has a reference to itself on top of the argument stack. | |
| 43 sub plugin_load { | |
| 44 my $plugin = shift; | |
| 45 print "#" x 80 . "\n\n"; | |
| 46 Gaim::debug_info("plugin_load()", "Testing $MODULE_NAME Started."); | |
| 47 print "\n\n"; | |
| 48 | |
| 49 | |
| 50 ################################# | |
| 51 # # | |
| 52 # Gaim::Account::Option # | |
| 53 # # | |
| 54 ################################# | |
| 55 | |
| 12364 | 56 print "Testing: Gaim::Account::Option::new()...\n"; |
| 57 $acc_opt = Gaim::Account::Option->new(1, "TEXT", "pref_name"); | |
| 58 $acc_opt2 = Gaim::Account::Option->bool_new("TeXt", "MYprefName", 1); | |
| 11170 | 59 |
| 60 ################################# | |
| 61 # # | |
| 62 # Gaim::Account # | |
| 63 # # | |
| 64 ################################# | |
| 65 | |
| 66 | |
| 12364 | 67 print "Testing: Gaim::Account::new()... "; |
| 68 $account = Gaim::Account->new($TEST_NAME, $PROTOCOL_ID); | |
| 11170 | 69 if ($account) { print "ok.\n"; } else { print "fail.\n"; } |
| 70 | |
| 12364 | 71 print "Testing: Gaim::Accounts::add()..."; |
| 11170 | 72 Gaim::Accounts::add($account); |
| 12364 | 73 print "pending find...\n"; |
| 11170 | 74 |
| 75 print "Testing: Gaim::Accounts::find()..."; | |
| 76 $account = Gaim::Accounts::find($TEST_NAME, $PROTOCOL_ID); | |
| 77 if ($account) { print "ok.\n"; } else { print "fail.\n"; } | |
| 78 | |
| 12364 | 79 print "Testing: Gaim::Account::get_username()... "; |
| 80 $user_name = $account->get_username(); | |
| 81 if ($user_name) { | |
| 82 print "Success: $user_name.\n"; | |
| 83 } else { | |
| 84 print "Failed!\n"; | |
| 85 } | |
| 11170 | 86 |
| 12364 | 87 print "Testing: Gaim::Account::is_connected()... "; |
| 88 if ($account->is_connected()) { | |
| 89 print " Connected.\n"; | |
| 90 } else { | |
| 91 print " Disconnected.\n"; | |
| 92 } | |
| 11170 | 93 |
| 12364 | 94 print "Testing: Gaim::Accounts::get_active_status()... "; |
| 95 if ($account->get_active_status()) { | |
| 96 print "Okay.\n"; | |
| 97 } else { | |
| 98 print "Failed!\n"; | |
| 99 } | |
| 11170 | 100 |
| 101 $account = Gaim::Accounts::find($USERNAME, $PROTOCOL_ID); | |
| 102 print "Testing: Gaim::Accounts::connect()...pending...\n"; | |
| 103 | |
| 12364 | 104 $account->set_status("available", TRUE); |
| 105 $account->connect(); | |
| 11170 | 106 |
| 107 print "\n\n"; | |
| 108 Gaim::debug_info("plugin_load()", "Testing $MODULE_NAME Completed."); | |
| 109 print "\n\n" . "#" x 80 . "\n\n"; | |
| 110 } | |
| 111 | |
| 112 sub plugin_unload { | |
| 113 my $plugin = shift; | |
| 114 | |
| 115 print "#" x 80 . "\n\n"; | |
| 116 Gaim::debug_info("plugin_unload()", "Testing $MODULE_NAME Started."); | |
| 117 print "\n\n"; | |
| 118 | |
| 119 ######### TEST CODE HERE ########## | |
| 120 | |
| 121 print "\n\n"; | |
| 122 Gaim::debug_info("plugin_unload()", "Testing $MODULE_NAME Completed."); | |
| 123 print "\n\n" . "#" x 80 . "\n\n"; | |
| 124 } | |
| 125 |
