libpurple/plugins/perl/scripts/account.pl

branch
soc.2008.masterpassword
changeset 34198
89549a1875e0
parent 29935
d28b5dcc7554
child 36798
21af2b190cfa
--- a/libpurple/plugins/perl/scripts/account.pl	Tue May 14 01:43:55 2013 +0200
+++ b/libpurple/plugins/perl/scripts/account.pl	Tue May 14 13:07:06 2013 +0200
@@ -34,6 +34,37 @@
 	return %PLUGIN_INFO;
 }
 
+sub set_password_cb
+{
+	my $account = shift;
+	my $error = shift;
+	my $data = shift;
+
+	if ($error) {
+		Purple::Debug::warning($MODULE_NAME, "Failed to set password " .
+			"for $account\n");
+		return;
+	}
+
+	Purple::Debug::misc($MODULE_NAME, "Password for $account was set\n");
+}
+
+sub get_password_cb
+{
+	my $account = shift;
+	my $password = shift;
+	my $error = shift;
+	my $data = shift;
+
+	if ($error) {
+		Purple::Debug::warning($MODULE_NAME, "Failed to get password for $account\n");
+		return;
+	}
+
+	Purple::Debug::misc($MODULE_NAME, "Got password for $account\n");
+
+	$account->set_password($password, \&set_password_cb);
+}
 
 # This is the sub defined in %PLUGIN_INFO to be called when the plugin is loaded
 #	Note: The plugin has a reference to itself on top of the argument stack.
@@ -101,6 +132,8 @@
 	$account->set_status("available", TRUE);
 	$account->connect();
 
+	$account->get_password(\&get_password_cb);
+
 	print "\n\n";
 	Purple::Debug::info($MODULE_NAME, "plugin_load() - Testing $MODULE_NAME Completed.\n");
 	print "\n\n" . "#" x 80 . "\n\n";

mercurial