changeset 22523:fbb49435cf80

merge of '4b63bba84183d38714730df5a11d191e0c02163a' and 'eaaa61d5e4924ee4788587c24c4d290ac7ab66c2'
author Etan Reisner <pidgin@unreliablesource.net>
date Fri, 29 Feb 2008 01:44:35 +0000
parents 2f6f381b4d12 (current diff) c89414a114ab (diff)
children 2f7b42cc612c
files
diffstat 2 files changed, 26 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/account.c	Fri Feb 29 01:41:13 2008 +0000
+++ b/libpurple/account.c	Fri Feb 29 01:44:35 2008 +0000
@@ -751,6 +751,7 @@
 		description = g_strdup("");
 
 	current_error = g_new0(PurpleConnectionErrorInfo, 1);
+	PURPLE_DBUS_REGISTER_POINTER(current_error, PurpleConnectionErrorInfo);
 	current_error->type = type;
 	current_error->description = description;
 
@@ -1009,6 +1010,7 @@
 		purple_log_free(account->system_log);
 
 	priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
+	PURPLE_DBUS_UNREGISTER_POINTER(priv->current_error);
 	g_free(priv->current_error);
 	g_free(priv);
 
@@ -2365,8 +2367,7 @@
 }
 
 static void
-set_current_error(PurpleAccount *account,
-                  PurpleConnectionErrorInfo *new_err)
+set_current_error(PurpleAccount *account, PurpleConnectionErrorInfo *new_err)
 {
 	PurpleAccountPrivate *priv;
 	PurpleConnectionErrorInfo *old_err;
@@ -2389,6 +2390,7 @@
 	if(old_err)
 		g_free(old_err->description);
 
+	PURPLE_DBUS_UNREGISTER_POINTER(old_err);
 	g_free(old_err);
 }
 
@@ -2406,6 +2408,7 @@
 	g_return_if_fail(account != NULL);
 
 	err = g_new0(PurpleConnectionErrorInfo, 1);
+	PURPLE_DBUS_REGISTER_POINTER(err, PurpleConnectionErrorInfo);
 
 	err->type = type;
 	err->description = g_strdup(description);
--- a/libpurple/plugins/test.pl	Fri Feb 29 01:41:13 2008 +0000
+++ b/libpurple/plugins/test.pl	Fri Feb 29 01:44:35 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 <chipx86@gnupdate.org>',
+	author           => 'Etan Reisner <deryni\@pidgin.im>',
 	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;
-}