changeset 6529:e4e87ffd9f14

[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 <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Wed, 20 Aug 2003 11:08:19 +0000
parents 390807f638b1
children e05a54da64db
files plugins/fortuneprofile.pl plugins/test.pl
diffstat 2 files changed, 46 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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 = "&nbsp;";
 	$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);
 }
 
 
--- /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 <chipx86@gnupdate.org>',
+	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;
+}