[siesta-commit] siesta/bin nacho,1.9,1.10

[prev] [thread] [next] [lurker] [Date index for 2002/09/10]

From: muttley
Subject: [siesta-commit] siesta/bin nacho,1.9,1.10
Date: 17:58 on 10 Sep 2002
Update of /cvsroot/siesta/siesta/bin
In directory usw-pr-cvs1:/tmp/cvs-serv26127/bin

Modified Files:
	nacho 
Log Message:
Plugin manipulation commands


Index: nacho
===================================================================
RCS file: /cvsroot/siesta/siesta/bin/nacho,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- nacho	10 Sep 2002 13:55:36 -0000	1.9
+++ nacho	10 Sep 2002 16:58:29 -0000	1.10
@@ -15,7 +15,7 @@
 	       show-users-list show-lists-user
 	       add-user-list remove-user-list
 	       show-all-plugins show-plugins 
-	       set-plugins-list add-plugin-list
+	       set-plugins add-plugin
 	       show-plugin-options	
 	       show-plugin-config-default
 	       show-plugin-config-user
@@ -483,20 +483,58 @@
 
 =cut
 
-sub set_plugins 
+sub set_plugins
 {
 	my $list_id = shift || die "You must pass a list id\n";
 
         my $list = Siesta::List->new($list_id) || die "Not a valid list id\n";
 
+	my @plugins = @_;
+	
+	Siesta->storage->set_plugins($list, @plugins) ||
+		die "Sorry, couldn't do that for some reason\n";
+
+
+	unless (@plugins) {
+		print "Deleted plugins from $list_id\n";
+		return;
+	}
+
+	my $a=1;
+	print "Set the plugins for $list_id to be :\n";
+	foreach my $plugin ($list->plugins())
+        {
+                print "$a) $plugin\n";
+                $a++;
+        }
+
 }
 
 =head2 add-plugin [ list id ] [ plugin id ] < position >
 
 Add a plugin onto the end of a list or, if a position is supplied, 
-then insert it somewhere in that list.
+then insert it somewhere in that list. 1 is the first position.
 
 =cut
+
+sub add_plugin
+{
+        my $list_id = shift || die "You must pass a list id\n";
+
+        my $list = Siesta::List->new($list_id) || die "Not a valid list id\n";
+
+	my $plugin  = shift || die "You must pass a plugin id\n";
+	
+	my $position = shift;
+
+	Siesta->storage->add_plugin_to_list($list, $plugin, $position) 
+		or  die "Sorry couldn't do that for some reason\n";
+	
+	print "Successfully added plugin in $plugin to $list_id";
+	print " at position $position" if (defined $position);
+	print "\n";
+
+}
 
 
 =head2 show-plugin-options [plugin name]



Generated at 13:57 on 01 Jul 2004 by mariachi 0.52