[siesta-commit] siesta/lib/Siesta Message.pm,1.14,1.15 Plugin.pm,1.8,1.9 Storage.pm,1.8,1.9

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

From: muttley
Subject: [siesta-commit] siesta/lib/Siesta Message.pm,1.14,1.15 Plugin.pm,1.8,1.9 Storage.pm,1.8,1.9
Date: 12:01 on 08 Sep 2002
Update of /cvsroot/siesta/siesta/lib/Siesta
In directory usw-pr-cvs1:/tmp/cvs-serv24586/lib/Siesta

Modified Files:
	Message.pm Plugin.pm Storage.pm 
Log Message:
Config stuff. 


Index: Message.pm
===================================================================
RCS file: /cvsroot/siesta/siesta/lib/Siesta/Message.pm,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- Message.pm	23 Aug 2002 15:20:30 -0000	1.14
+++ Message.pm	8 Sep 2002 11:01:32 -0000	1.15
@@ -8,7 +8,7 @@
 use constant debug => 0;
 
 use Class::MethodMaker
-  get_set => [ qw( list ) ];
+  get_set => [ qw( list user) ];
 
 sub from {
     my $self = shift;

Index: Plugin.pm
===================================================================
RCS file: /cvsroot/siesta/siesta/lib/Siesta/Plugin.pm,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- Plugin.pm	28 Aug 2002 10:06:29 -0000	1.8
+++ Plugin.pm	8 Sep 2002 11:01:32 -0000	1.9
@@ -4,8 +4,25 @@
 use Class::MethodMaker new => 'new';
 
 sub process { die "virtual" }
-sub list_config {}
-sub user_config {}
+
+sub config 
+{
+	my $self = shift;
+	(my $package = ref $self) =~ s!^.*::!!;
+
+	my $mail = shift;	
+
+	
+
+	my $list_id = $mail->list->id || undef if defined $mail->list;
+	my $user_id = $mail->user->id || undef if defined $mail->user;
+
+	
+	return Siesta->storage->config($package, $user_id, $list_id, @_);
+
+}
+
+
 
 1;
 __END__
@@ -27,6 +44,13 @@
 
 Return a true value to indicate "process no further plugins".  use
 this for message rejection.
+
+=item ->config($message, $key, [$value])  
+
+gets (or sets) the value of key for this plugin based on the 
+list and user.
+
+See B<Siesta::Storage> for more details.
 
 =back
 

Index: Storage.pm
===================================================================
RCS file: /cvsroot/siesta/siesta/lib/Siesta/Storage.pm,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- Storage.pm	5 Sep 2002 16:13:16 -0000	1.8
+++ Storage.pm	8 Sep 2002 11:01:32 -0000	1.9
@@ -8,6 +8,9 @@
 }
 
 
+# These are all virtual methods and are implemented 
+# in a subclass like Siesta::Storage::DBI. If only 
+# Perl had an interface keyword. 
 
 sub load_user   { die "virtual" }
 sub save_user   { die "virtual" }
@@ -27,6 +30,8 @@
 sub list_plugins { die "virtual" }
 sub user_lists   { die "virtual" }
 
+sub config       { die "virtual" };
+
 1;
 __END__
 
@@ -88,5 +93,18 @@
 =item ->user_lists ($list_object)
 
 returns List objects for every list the user belongs to.
+
+=item ->config ($namespace, $user_id, $list_id, $key, [$value])
+
+Returns the value of key for the namespace based on the user and list.
+
+Either or both of these can be undef. 
+
+The namespace will usually be the plugin name.
+
+If you pass in a fifth argument as well then the value will be set to that.
+
+This method attempts to work out the best value to look up for this tuple by searching, 
+in order : per user-per list, per user, per list, system default.
 
 =cut



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