view plugins/perl/scripts/request.pl @ 12468:6faefbebcd24

[gaim-migrate @ 14778] SF Patch #1372898 from charkins "This patch updates the unseen conversation api in gtkconv to ensure consistancy and avoid code duplication. The ...first_unseen() function is renamed and expanded to return a list of conversations that match the specified criteria. A max_count parameter is used to allow this to short circuit early (using 1 gives old behavior). An additional flag was added to allow this function to only consider hidden conversations (used by the buddy list). The blist is currently inconsistant in which conversations it loops over for showing the menu tray icon, creating the tooltip and the unseen menu. This patch fixes that. The ...find_unseen_list() now handles contact-aware conversations correctly as well (based on sadrul's patches in #1362579 which are obsoleted by this patch). I also included the fix from #1362579 which increments unseen_count only when state>=UNSEEN_TEXT." committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Mon, 12 Dec 2005 18:59:29 +0000
parents 4d9686e7c234
children
line wrap: on
line source

$MODULE_NAME = "Request Functions Test";

use Gaim;

# All the information Gaim 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 => "Implements a set of test proccedures to ensure all functions that work in the C API still work in the Perl plugin interface.  As XSUBs are added, this *should* be updated to test the changes.  Furthermore, this will function as the tutorial perl plugin.", 
	author => "John H. Kelm <johnhkelm\@gmail.com>", 
	url => "http://sourceforge.net/users/johnhkelm/", 
	
	load => "plugin_load", 
	unload => "plugin_unload", 
	plugin_action => "plugin_action_test",
	plugin_action_label => "Plugin Action Test Label"
); 


	# These names must already exist
	my $GROUP		= "UIUC Buddies";
	my $USERNAME 		= "johnhkelm2";
	
	# We will create these on load then destroy them on unload
	my $TEST_GROUP		= "perlTestGroup";
	my $TEST_NAME	 	= "perlTestName";
	my $TEST_ALIAS	 	= "perlTestAlias";
	my $PROTOCOL_ID 	= "prpl-oscar";


sub plugin_init { 
	return %PLUGIN_INFO; 
} 

sub ok_cb_test{
	$fields = shift;
	print "ok_cb_test: BEGIN\n";
	print "ok_cb_test: Button Click\n";
	print "ok_cb_test: Field Type: " . $fields . "\n";
	$account = Gaim::Request::fields_get_account($fields, "acct_test");
	print "ok_cb_test: Username of selected account: " . Gaim::Account::get_username($account) . "\n";
	$int = Gaim::Request::fields_get_integer($fields, "int_test");
	print "ok_cb_test: Integer Value:" . $int . "\n";
	$choice = Gaim::Request::fields_get_choice($fields, "ch_test");
	print "ok_cb_test: Choice Value:" . $choice . "\n";
	print "ok_cb_test: END\n";
}

sub cancel_cb_test{
	print "cancel_cb_test: Button Click\n";
}

sub plugin_action_test {
	$plugin = shift;
	print "plugin_action_cb_test: BEGIN\n";
	plugin_request($plugin);
	print "plugin_action_cb_test: END\n";
}

sub plugin_load { 
	my $plugin = shift; 
	#########  TEST CODE HERE  ##########
	

}

sub plugin_request {	
	$group = Gaim::Request::field_group_new("Group Name");
	$field = Gaim::Request::field_account_new("acct_test", "Account Text", undef);
	Gaim::Request::field_account_set_show_all($field, 0);
	Gaim::Request::field_group_add_field($group, $field);
	
	$field = Gaim::Request::field_int_new("int_test", "Integer Text", 33);
	Gaim::Request::field_group_add_field($group, $field);
	
	# Test field choice
	$field = Gaim::Request::field_choice_new("ch_test", "Choice Text", 1);
	Gaim::Request::field_choice_add($field, "Choice 0");
	Gaim::Request::field_choice_add($field, "Choice 1");
	Gaim::Request::field_choice_add($field, "Choice 2");
	
	Gaim::Request::field_group_add_field($group, $field);
	
	
	$request = Gaim::Request::fields_new();
	Gaim::Request::fields_add_group($request, $group);
	
	Gaim::Request::fields(
		$plugin, 
		"Request Title!", 
		"Primary Title", 
		"Secondary Title",
		$request,
		"Ok Text", "ok_cb_test",
		"Cancel Text", "cancel_cb_test");
} 

sub plugin_unload { 
	my $plugin = shift; 
	print "#" x 80 . "\n";
	#########  TEST CODE HERE  ##########
	
	

	print "\n" . "#" x 80 . "\n";
}