changeset 6519:7f0fffa1077b

[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 <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Wed, 20 Aug 2003 09:33:56 +0000
parents 3f8880ea7856
children 2e2593d95121
files plugins/fortuneprofile.pl
diffstat 1 files changed, 48 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- 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 = "&nbsp;";
-$tab = $tab . $tab . $tab . $tab;
-$nl = "<BR>";
+%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 <bj91704\@binghamton.edu>",
+	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 = "&nbsp;";
+	$tab = $tab . $tab . $tab . $tab;
+	$nl = "<BR>";
+
+	$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 <bj91704\@binghamton.edu>", "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");