# HG changeset patch # User Christian Hammond # Date 1061377699 0 # Node ID e4e87ffd9f140677fc63a146a24ff2f01b1146b7 # Parent 390807f638b1414d9fe68e385c2918f7fdf39f65 [gaim-migrate @ 7046] The fortunateprofile.pl script works again. At least, I think it works, but it's never worked here, but all the events and suff work, so that's good, and i added a test.pl that people acan also see. now I'm going to bebd. committer: Tailor Script diff -r 390807f638b1 -r e4e87ffd9f14 plugins/fortuneprofile.pl --- a/plugins/fortuneprofile.pl Wed Aug 20 11:02:39 2003 +0000 +++ b/plugins/fortuneprofile.pl Wed Aug 20 11:08:19 2003 +0000 @@ -42,6 +42,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +use Gaim; + %PLUGIN_INFO = ( perl_api_version => 2, name => "Fortune Profile", @@ -59,7 +61,7 @@ } sub plugin_load { - my $plugin = shift; + $plugin = shift; $tab = " "; $tab = $tab . $tab . $tab . $tab; @@ -81,12 +83,13 @@ } # Command to get dynamic message from - $command = "fortune -sn " . ($max - $len); + $command = "fortune -sn " . ($max - $len); + $seconds = 10; # Delay before updating away messages. # output the first message and start the timers... # This is done as a timeout to prevent attempts to set the # profile before logging in. - Gaim::timeout_add($plugin, $seconds, "update_away"); + Gaim::timeout_add($plugin, $seconds, "update_away", NULL); } sub update_away { @@ -113,8 +116,13 @@ $message = $message . "---$nl" . $post_message ; } - foreach $id (GAIM::get_info(1)) {GAIM::command("info", $id, $message);} - GAIM::add_timeout_handler($handle, $seconds, "update_away"); + foreach $account (Gaim::accounts()) { + if ($account->is_connected()) { + $account->set_user_info($message); + } + } + + Gaim::timeout_add($plugin, $seconds, "update_away", NULL); } diff -r 390807f638b1 -r e4e87ffd9f14 plugins/test.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/test.pl Wed Aug 20 11:08:19 2003 +0000 @@ -0,0 +1,33 @@ +#!/usr/bin/perl -w + +use Gaim; +use vars qw(%PLUGIN_INFO); + +%PLUGIN_INFO = ( + perl_api_version => 2, + name => 'Test Perl Plugin', + version => '1.0', + summary => 'Provides as a test base for the perl plugin.', + description => 'Provides as a test base for the perl plugin.', + author => 'Christian Hammond ', + url => 'http://gaim.sf.net/', + + load => "plugin_load", + unload => "plugin_unload", +); + +sub plugin_init { + return %PLUGIN_INFO; +} + +sub plugin_load { + my $plugin = shift; + + foreach $account (Gaim::accounts()) { + Gaim::debug("perl test plugin", $account->get_username() . "\n"); + } +} + +sub plugin_unload { + my $plugin = shift; +}