Mercurial > pidgin
annotate plugins/perl/scripts/conversation.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 = "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, | |
| 12340 | 8 name => "Perl: $MODULE_NAME", |
| 11170 | 9 version => "0.1", |
| 10 summary => "Test plugin for the Perl interpreter.", | |
| 12340 | 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 = "UConn Buddies"; | |
| 31 my $TEST_NAME = "johnhkelm"; | |
| 32 my $TEST_ALIAS = "John Kelm"; | |
| 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 | |
| 47 print "PERL: Finding account.\n"; | |
| 48 $account = Gaim::Accounts::find($USERNAME, $PROTOCOL_ID); | |
| 49 | |
| 50 ######### TEST CODE HERE ########## | |
| 12340 | 51 # First we create two new conversations. |
| 52 print "Testing Gaim::Conversation::new()..."; | |
| 12364 | 53 $conv1 = Gaim::Conversation->new(1, $account, "Test Conversation 1"); |
| 12340 | 54 if ($conv1) { print "ok.\n"; } else { print "fail.\n"; } |
| 11170 | 55 |
| 12340 | 56 print "Testing Gaim::Conversation::new()..."; |
| 12364 | 57 $conv2 = Gaim::Conversation->new(1, $account, "Test Conversation 2"); |
| 12340 | 58 if ($conv2) { print "ok.\n"; } else { print "fail.\n"; } |
| 11170 | 59 |
| 12340 | 60 # Second we create a window to display the conversations in. |
| 61 # Note that the package here is Gaim::Conversation::Window | |
| 62 print "Testing Gaim::Conversation::Window::new()...\n"; | |
| 63 $win = Gaim::Conversation::Window::new(); | |
| 11170 | 64 |
| 12340 | 65 # The third thing to do is to add the two conversations to the windows. |
| 66 # The subroutine add_conversation() returns the number of conversations | |
| 67 # present in the window. | |
| 68 print "Testing Gaim::Conversation::Window::add_conversation()..."; | |
| 69 $conv_count = $conv1->add_conversation(); | |
| 70 if ($conv_count) { | |
| 71 print "ok..." . $conv_count . " conversations...\n"; | |
| 72 } else { | |
| 73 print "fail.\n"; | |
| 74 } | |
| 75 | |
| 76 print "Testing Gaim::Conversation::Window::add_conversation()..."; | |
| 77 $conv_count = $win->add_conversation($conv2); | |
| 78 if ($conv_count) { | |
| 79 print "ok..." . $conv_count . " conversations...\n"; | |
| 80 } else { | |
| 81 print "fail.\n"; | |
| 82 } | |
| 83 | |
| 84 # Now the window is displayed to the user. | |
| 85 print "Testing Gaim::Conversation::Window::show()...\n"; | |
| 86 $win->show(); | |
| 87 | |
| 88 # Use get_im_data() to get a handle for the conversation | |
| 89 print "Testing Gaim::Conversation::get_im_data()...\n"; | |
| 90 $im = $conv1->get_im_data(); | |
| 11170 | 91 if ($im) { print "ok.\n"; } else { print "fail.\n"; } |
| 12340 | 92 |
| 93 # Here we send messages to the conversation | |
| 94 print "Testing Gaim::Conversation::IM::send()...\n"; | |
| 95 $im->send("Message Test."); | |
| 96 | |
| 97 print "Testing Gaim::Conversation::IM::write()...\n"; | |
| 98 $im->write("SENDER", "<b>Message</b> Test.", 0, 0); | |
| 11170 | 99 |
| 100 print "#" x 80 . "\n\n"; | |
| 101 } | |
| 102 | |
| 103 sub plugin_unload { | |
| 104 my $plugin = shift; | |
| 105 | |
| 106 print "#" x 80 . "\n\n"; | |
| 107 ######### TEST CODE HERE ########## | |
| 108 | |
| 12340 | 109 print "Testing Gaim::Conversation::Window::get_conversation_count()...\n"; |
| 110 $conv_count = $win->get_conversation_count(); | |
| 111 print "...and it returned $conv_count.\n"; | |
| 11170 | 112 if ($conv_count > 0) { |
| 12340 | 113 print "Testing Gaim::Conversation::Window::destroy()...\n"; |
| 114 $win->destroy(); | |
| 11170 | 115 } |
| 116 | |
| 117 print "\n\n" . "#" x 80 . "\n\n"; | |
| 118 } | |
| 119 |
