# HG changeset patch # User Christian Hammond # Date 1061372036 0 # Node ID 7f0fffa1077ba8cf6c9f0dba7afb628de80c88a3 # Parent 3f8880ea78564f5e385c3949603c10510f488953 [gaim-migrate @ 7036] Updated the fortune profile script for the new perl API. It doesn't work yet, but it will once I implement some new functions. committer: Tailor Script diff -r 3f8880ea7856 -r 7f0fffa1077b plugins/fortuneprofile.pl --- a/plugins/fortuneprofile.pl Wed Aug 20 02:49:05 2003 +0000 +++ b/plugins/fortuneprofile.pl Wed Aug 20 09:33:56 2003 +0000 @@ -20,6 +20,11 @@ # * Fixed a bug where your info would be set to nothing if you had # no pre and no post message # AIM: lbdash +# +# Updated by Christian Hammond, 20 August 2002 +# Changes: +# * Modified to work with the changed perl interface of gaim 0.68 +# AIM: ChipX86 # Copyright (C) 2001 Sean Egan @@ -37,35 +42,58 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -$handle = GAIM::register("Fortune Profile", "3.3", "", ""); - -$tab = " "; -$tab = $tab . $tab . $tab . $tab; -$nl = "
"; +%PLUGIN_INFO = ( + perl_api_version => 2, + name => "Fortune Profile", + version => "3.4", + summary => "Sets your AIM profile to a fortune (with a header and footer of your choice).", + description => "Sets your AIM profile to a fortune (with a header and footer of your choice).", + author => "Sean Egan ", + url => "http://gaim.sf.net/", -$seconds = 30; # Delay before updating away messages. -$max = 1020; # Max length of an profile. It should be - # 1024, but I am being safe -$pre_message = ""; # This gets added before the fortune - -$post_message =""; + load => "plugin_load" +); -$len = 0; -if ($pre_message ne "") { - $len += length( $pre_message . "---$nl" ); -} -if ($post_message ne "") { - $len += length("---$nl" . $post_message); +sub plugin_init { + return %PLUGIN_INFO; } -$command = "fortune -sn " . ($max - $len); # Command to get dynamic message from +sub plugin_load { + my $plugin = shift; + + $tab = " "; + $tab = $tab . $tab . $tab . $tab; + $nl = "
"; + + $seconds = 30; # Delay before updating away messages. + $max = 1020; # Max length of an profile. It should be + # 1024, but I am being safe + $pre_message = ""; # This gets added before the fortune + + $post_message =""; + + $len = 0; + if ($pre_message ne "") { + $len += length( $pre_message . "---$nl" ); + } + if ($post_message ne "") { + $len += length("---$nl" . $post_message); + } + + # Command to get dynamic message from + $command = "fortune -sn " . ($max - $len); + + # 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"); +} sub update_away { # The fortunes are expanded into HTML (the tabs and newlines) which # causes the -s option of fortune to be a little bit meaningless. This # will loop until it gets a fortune of a good size (after expansion). - + do { do { #It's a while loop because it doesn't always work for some reason $fortune = `$command`; @@ -89,13 +117,4 @@ GAIM::add_timeout_handler($handle, $seconds, "update_away"); } -sub description { - my($a, $b, $c, $d, $e, $f) = @_; - ("Fortune Profile", "3.3", "Sets your AIM profile to a fortune (with a header and footer of your choice).", - "Sean Egan ", "http://gaim.sf.net/", - "/dev/null"); -} -# 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::add_timeout_handler($handle, $seconds, "update_away");