chiark / gitweb /
edit create
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 4 Sep 2012 20:35:38 +0000 (21:35 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 4 Sep 2012 20:35:38 +0000 (21:35 +0100)
mason/edit

index 6edfbbc..5e60d09 100755 (executable)
@@ -22,9 +22,19 @@ if (defined $create) {
     die unless defined $textid;
 }
 
-my $sth = $dbh->prepare("SELECT * FROM texts WHERE textid=?");
-$sth->execute($textid);
-my $tx = $sth->fetchrow_hashref();#
+my $tx;
+
+if ($ARGS{'create'}) {
+    my $date = `date --iso-8601=minutes`; chomp $date or die;
+    $tx = { desc => "Message created $date",
+           subject => "Away from my email",
+           textid => "new",
+           text => "" };
+} else {
+    my $sth = $dbh->prepare("SELECT * FROM texts WHERE textid=?");
+    $sth->execute($textid);
+    $tx = $sth->fetchrow_hashref();#
+}
 
 if (!$tx) { die "no such text $textid"; }