From: Ian Jackson Date: Tue, 4 Sep 2012 20:35:38 +0000 (+0100) Subject: edit create X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=nj-awaymsg.git;a=commitdiff_plain;h=dce06504e5f9a73e8d3da414023bbf05ef31e3b3 edit create --- diff --git a/mason/edit b/mason/edit index 6edfbbc..5e60d09 100755 --- a/mason/edit +++ b/mason/edit @@ -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"; }