view libpurple/plugins/perl/scripts/plugin_action.pl @ 18916:0f46f13c0805

Proposed "attention" API, a generalization of zaps (MySpaceIM), buzzes (Yahoo), and nudges (MSN). Adds a PurpleAttentionType struct to prpl.h, which is used to describe the the attention command (some protocols, notably MySpaceIM, support more than one). Uses two reserved fields in PurplePluginProtocolInfo, one function for sending an attention command, another for getting the possible attention commands (similar to status_types). Adds serv_got_attention() to server.c, similar to serv_got_im(), used to notify of incoming or outgoing attention notices.
author Jeffrey Connelly <jaconnel@calpoly.edu>
date Mon, 13 Aug 2007 05:59:24 +0000
parents 2f8274ce570a
children
line wrap: on
line source

$MODULE_NAME = "Plugin Action Test Plugin";
use Purple;

sub plugin_init {
	return %PLUGIN_INFO;
}

sub plugin_load {
	my $plugin = shift;
}

sub plugin_unload {
	my $plugin = shift;
}

sub fun1 {
	print "1\n";
}

sub fun2 {
	print "2\n";
}

sub fun3 {
	print "3\n";
}

%plugin_actions = (
	"Action 1" => \&fun1,
	"Action 2" => \&fun2,
	"Action 3" => \&fun3
#	"Action 1" => sub { print "1\n"; },
#	"Action 2" => sub { print "2\n"; },
#	"Action 3" => sub { print "3\n"; }
);

sub plugin_action_names {
	foreach $key (keys %plugin_actions) {
		push @array, $key;
	}

	return @array;
}

# All the information Purple gets about our nifty plugin
%PLUGIN_INFO = (
	perl_api_version => 2,
	name => "Perl: $MODULE_NAME",
	version => "0.1",
	summary => "Test plugin for the Perl interpreter.",
	description => "Just a basic test plugin template.",
	author => "Etan Reisner <deryni\@gmail.com>",
	url => "http://sourceforge.net/users/deryni9/",

	load => "plugin_load",
	unload => "plugin_unload",
	plugin_action_sub => "plugin_action_names"
);