rev 1301 - trunk/siesta/bin

[prev] [thread] [next] [lurker] [Date index for 2003/08/10]

From: simon
Subject: rev 1301 - trunk/siesta/bin
Date: 12:06 on 10 Aug 2003
Author: simon
Date: 2003-08-10 12:06:08 +0100 (Sun, 10 Aug 2003)
New Revision: 1301

Modified:
   trunk/siesta/bin/nacho
Log:
Add support for resuming messages 


Modified: trunk/siesta/bin/nacho
===================================================================
--- trunk/siesta/bin/nacho	2003-08-10 00:38:24 UTC (rev 1300)
+++ trunk/siesta/bin/nacho	2003-08-10 11:06:08 UTC (rev 1301)
@@ -602,14 +602,83 @@
 
 #####
 #
+# Deferred message stuff
+#
+#####
+
+# dummy to put a space in
+$commands{'      '} = sub { };
+
+
+
+=head2 show-deferred member_id [ deferred_id ]
+
+Show all the deferred messages for a user name or, if
+and id is passed in, show that deferred message.
+
+=cut
+
+
+$commands{'show-deferred'} = sub {
+
+	my $user_id = shift || die "You must pass a user name\n";
+	my $mess_id = shift;
+
+	my $user = Siesta::Member->load($user_id)
+		or die "No such user $user_id\n";
+
+	if (defined $mess_id) {
+
+		my $deferred = Siesta::Deferred->search( who => $user, id => $mess_id );
+		if (defined $deferred) {
+			print $deferred->message->as_string;
+		} else {
+			print "No such deferred message\n";
+		}
+	
+	} else {
+	
+		foreach my $deferred (Siesta::Deferred->search( who => $user )) 
+		{
+			print $deferred->id(),") ",$deferred->message->subject(),"\n";
+		}
+	}
+
+};
+
+
+=head2 resume-deferred member_id deferred_id
+
+Resume a deferred message.
+
+=cut
+
+$commands{'resume-deferred'} = sub {
+
+    my $user_id = shift || die "You must pass a user name\n";
+    my $mess_id = shift;
+
+
+    my $message = Siesta::Deferred->retrieve($mess_id) 
+			or die "No such deferred message\n";
+    return unless $user_id == $message->who;
+
+    Siesta::Message->resume( $message->id );
+
+	print "Sucessfully resumed message $mess_id\n";
+
+};
+
+#####
+#
 # Misc stuff
 #
 #####
 
 # dummy to put a space in
-$commands{'     '} = sub { };
+$commands{'       '} = sub { };
 
-=item run-mariachi
+=head2 run-mariachi
 
 invoke mariachi to make webified archives (depends on the Archive plugin)
 

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