# HG changeset patch # User Etan Reisner # Date 1204152662 0 # Node ID c9dc220e030126945b19631270b85cc666e7a5df # Parent e62b3625cc542ef86cc05e6d746909c0114220a8 Bring the test.pl plugin at least theoretically up to date (I haven't tried it but at least it doesn't refer to Gaim anymore). diff -r e62b3625cc54 -r c9dc220e0301 libpurple/plugins/test.pl --- a/libpurple/plugins/test.pl Wed Feb 27 22:43:36 2008 +0000 +++ b/libpurple/plugins/test.pl Wed Feb 27 22:51:02 2008 +0000 @@ -1,6 +1,4 @@ -#!/usr/bin/env perl -w - -use Gaim; +use Purple; %PLUGIN_INFO = ( perl_api_version => 2, @@ -8,51 +6,37 @@ 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 ', + author => 'Etan Reisner ', url => 'http://pidgin.im', - load => "plugin_load", - unload => "plugin_unload" + load => "plugin_load" ); -sub account_away_cb { - Gaim::debug_info("perl test plugin", "In account_away_cb\n"); - - my ($account, $state, $message, $data) = @_; - - Gaim::debug_info("perl test plugin", "Account " . - $account->get_username() . " went away.\n"); - Gaim::debug_info("perl test plugin", $data . "\n"); -} - sub plugin_init { return %PLUGIN_INFO; } +sub account_status_cb { + my ($account, $old, $new, $data) = @_; + + Purple::Debug::info("perl test plugin", "In account_status_cb\n"); + + Purple::Debug::info("perl test plugin", "Account " . + $account->get_username() . " changed status.\n"); + Purple::Debug::info("perl test plugin", $data . "\n"); +} + sub plugin_load { - Gaim::debug_info("perl test plugin", "plugin_load\n"); my $plugin = shift; - Gaim::debug_info("perl test plugin", "Listing accounts.\n"); - foreach $account (Gaim::accounts()) { - Gaim::debug_info("perl test plugin", $account->get_username() . "\n"); + Purple::Debug::info("perl test plugin", "plugin_load\n"); + + Purple::Debug::info("perl test plugin", "Listing accounts.\n"); + foreach $account (Purple::Accounts::get_all()) { + Purple::Debug::info("perl test plugin", $account->get_username() . "\n"); } - Gaim::debug_info("perl test plugin", "Listing buddy list.\n"); - foreach $group (Gaim::BuddyList::groups()) { - Gaim::debug_info("perl test plugin", - $group->get_name() . ":\n"); - - foreach $buddy ($group->buddies()) { - Gaim::debug_info("perl test plugin", - " " . $buddy->get_name() . "\n"); - } - } - - Gaim::signal_connect(Gaim::Accounts::handle, "account-away", - $plugin, \&account_away_cb, "test"); + Purple::Signal::connect(Purple::Accounts::get_handle(), + "account-status-changed", $plugin, + \&account_status_cb, "test"); } - -sub plugin_unload { - my $plugin = shift; -}