our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
$VERSION = 1.00;
@ISA = qw(Exporter);
- @EXPORT = qw(db_connect db_commit expires2timet
+ @EXPORT = qw(db_connect db_commit
+ expires2timet expirestime2show
$dbh);
%EXPORT_TAGS = ( );
@EXPORT_OK = qw();
sub expires2timet ($) {
my ($str) = @_;
- if ($str eq '') {
+ if ($str eq '' or $str =~ m/never/i) {
return undef;
}
open F, "-|", qw(date -d),'$str',qw(+%s) or die $!;
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");
nooutput("SELECT * FROM addresses LEFT JOIN texts".
- " USING (textid) WHERE name IS NULL");
+ " USING (textid) WHERE desc IS NULL");
$dbh->do("COMMIT");
}