[siesta-commit] siesta/bin nacho,1.5,1.6

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

From: muttley
Subject: [siesta-commit] siesta/bin nacho,1.5,1.6
Date: 12:29 on 06 Sep 2002
Update of /cvsroot/siesta/siesta/bin
In directory usw-pr-cvs1:/tmp/cvs-serv14027/bin

Modified Files:
	nacho 
Log Message:
More functionality.


Index: nacho
===================================================================
RCS file: /cvsroot/siesta/siesta/bin/nacho,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- nacho	6 Sep 2002 10:40:47 -0000	1.5
+++ nacho	6 Sep 2002 11:29:08 -0000	1.6
@@ -11,7 +11,7 @@
 # All possible modes that we can do
 my @modes = qw(show-lists new-list delete-list modify-list
 	       show-users new-user delete-user modify-user
-	       create-alias
+	       show-list show-user create-alias
 	       show-users-list show-lists-user
 	       add-user-list
 	       list-all-plugins list-plugins	
@@ -155,6 +155,28 @@
 	print "User $forename $surname <$user_id> added\n";
 }
 
+
+=head2 show-user [user id]
+
+Show the current set up of a user.
+
+=cut
+
+sub show_user
+{
+	my $user_id = shift || die "You must pass a user id\n";
+
+        my $user = Siesta::User->new($user_id) || die "Not a valid user id\n";
+
+	foreach my $field (@Siesta::User::fields)
+	{
+		my $value = $user->$field() || '';
+
+		printf "%s = %s\n", $field, $value;
+	}
+
+}
+
 =head2 delete-user [email address/user id]
 
 Remove a user from the system.
@@ -182,6 +204,9 @@
 Change a property of the user. See B<Siesta::User>
 for what propertys are valid.
 
+Note - you can effectively copy a user by setting the id. A new
+user with the new id will be created.
+
 =cut
 
 sub modify_user
@@ -198,6 +223,8 @@
 	
 	$user->$key($value);
 
+	$user->save() || die "Couldn't modify user $user_id\n";
+
 	print "Property '$key' set to '$value' for the user $user_id\n"; 
 }
 
@@ -233,31 +260,6 @@
 			
 }
 
-=head2 create-alias [list id]
-
-Print out an alias file entry for the list specified.
-
-=cut
-
-sub create_alias
-{
-	my $list_id = shift;
-
-	my $list = Siesta::List->new($list_id) || die "Not a valid list id\n";
-
-	(my $path = $0) =~ s!^(.*[\\/]).*$!$1!;
-
-	(my $post = $list->post_address()) =~ s!@.*$!!;
-	(my $ret  = $list->return_path()) =~  s!@.*$!!;
- 
-	print "\n\n";
-	printf "## %s mailing list\n", $list_id;
-	printf "## created: %s nacho (the siesta config tool)\n", 
-			strftime("%d-%b-%Y", localtime(time)); 
-	printf "%s: \"%s%s %s\"\n",  $post, $path, 'tequila', $list->id();
-	printf "%s: %s\n\n\nq", $ret,  $list->owner();
-
-}
 
 =head2 delete-list [list id]
 
@@ -279,11 +281,35 @@
 	$list->delete();	
 }
 
+=head2 show-list [list id]
+
+Show the current set up of a list.
+
+=cut
+
+sub show_list
+{
+        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";
+
+        foreach my $field (@Siesta::List::fields)
+        {
+		my $value = $list->$field() || '';
+                printf "%s = %s\n", $field, $value;
+        }
+
+}
+
 =head2 modify-list [list id] [key] [value]
 
 Change a property of the list specified. See B<Siesta::List> 
 for valid propertys.
 
+Note: you can effectively copy the configuraion of a list by 
+modifying the id - a new list with the new id will be created 
+for you.
+
 =cut
 
 sub modify_list
@@ -299,9 +325,39 @@
         die "'$key' is not a valid property\n" unless $fields{$key};
 
         $list->$key($value);
+	
+	$list->save() || die "Couldn't modify list $list_id\n";
 
         print "Property '$key' set to '$value' for the list $list_id\n";
 }
+
+=head2 create-alias [list id]
+
+Print out an alias file entry for the list specified.
+
+=cut
+
+sub create_alias
+{
+	my $list_id = shift;
+
+	my $list = Siesta::List->new($list_id) || die "Not a valid list id\n";
+
+	(my $path = $0) =~ s!^(.*[\\/]).*$!$1!;
+
+	(my $post = $list->post_address()) =~ s!@.*$!!;
+	(my $ret  = $list->return_path()) =~  s!@.*$!!;
+ 
+	print "\n\n";
+	printf "## %s mailing list\n", $list_id;
+	printf "## created: %s nacho (the siesta config tool)\n", 
+			strftime("%d-%b-%Y", localtime(time)); 
+	printf "%s: \"%s%s %s\"\n",  $post, $path, 'tequila', $list->id();
+	printf "%s: %s\n\n\nq", $ret,  $list->owner();
+
+}
+
+
 
 =head2 add-user-list [list id] [user id(s)]
 



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