Mercurial > pidgin
annotate plugins/perl/scripts/conversation.pl @ 13342:bd981bf1a663
[gaim-migrate @ 15712]
SF Patch #1439221 from Shawn Outman
"The fix that allowed the message window to blink with
the first message in the conversation also allowed it
to blink with system messages, including those from the
Buddy State Notification plugin.
This patch modifies winprefs to not flash for system
messages, which is how it is in 1.5 and 2.0beta1 & 2.
(The first message in the conversation still causes it
to blink, however)."
committer: Tailor Script <tailor@pidgin.im>
| author | Richard Laager <rlaager@wiktel.com> |
|---|---|
| date | Tue, 28 Feb 2006 01:27:12 +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 |
