Mercurial > pidgin.yaz
diff plugins/fortuneprofile.pl @ 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 | 7f0fffa1077b |
children | 540edd51051b |
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 = " "; $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); }