From: Ian Jackson Date: Tue, 4 Sep 2012 20:09:29 +0000 (+0100) Subject: remove autoexpiry X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=nj-awaymsg.git;a=commitdiff_plain;h=84779d17f630c021da997ea4627d396b78c85d9e;ds=sidebyside remove autoexpiry --- diff --git a/AwayMsg.pm b/AwayMsg.pm index d6f63a5..1fa3899 100644 --- a/AwayMsg.pm +++ b/AwayMsg.pm @@ -13,7 +13,6 @@ BEGIN { $VERSION = 1.00; @ISA = qw(Exporter); @EXPORT = qw(db_connect db_commit - expires2timet expirestime2show $dbh); %EXPORT_TAGS = ( ); @EXPORT_OK = qw(); @@ -48,27 +47,6 @@ sub nooutput ($) { } } -sub expires2timet ($) { - my ($str) = @_; - if ($str eq '' or $str =~ m/never/i) { - return undef; - } - open F, "-|", qw(date -d),'$str',qw(+%s) or die $!; - my $dtime = ; - $?=0; $!=0; close F or die "$? $!"; - $dtime =~ m/^\d+$/ or die "$dtime ?"; - return $dtime+0; -} - -sub expirestime2show ($) { - my ($tt) = @_; - if (!defined $tt) { - return 'never'; - } else { - return strftime("%Y-%m-%d %H:%M"); - } -} - sub db_commit () { nooutput("SELECT * FROM addresses LEFT JOIN config". " USING (emailaddr) WHERE forwardfile IS NULL"); diff --git a/mason/main b/mason/main index 43ef45a..ac49c50 100755 --- a/mason/main +++ b/mason/main @@ -24,20 +24,12 @@ $sth->execute(); Address Status Which message? -Expiry date % while (my $row= $sth->fetchrow_hashref()) { <% $row->{'emailaddr'} |h %> % if (defined $row->{'textid'}) { -% my $expires = expires2timet($row->{'expires'}); -% if (defined($expires) && $expires < time) { -expired -% } else { -active -% } <% $row->{'desc'} |h %> -<% expirestime2show($expires) |h %> % } else { inactive diff --git a/schema b/schema index afcda29..da41a1e 100644 --- a/schema +++ b/schema @@ -3,8 +3,7 @@ CREATE TABLE texts ( textid INTEGER PRIMARY KEY NOT NULL, desc TEXT NOT NULL, subject TEXT NOT NULL, - text TEXT NOT NULL, - expires TEXT NOT NULL + text TEXT NOT NULL ); CREATE TABLE addresses (