[vhffs-dev] [1392] oops, listengine was used wrong time format for years, fixed it |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1392
Author: gradator
Date: 2009-04-12 15:35:37 +0200 (Sun, 12 Apr 2009)
Log Message:
-----------
oops, listengine was used wrong time format for years, fixed it
Modified Paths:
--------------
trunk/vhffs-listengine/src/listengine.pl
trunk/vhffs-test-dependencies.in
Modified: trunk/vhffs-listengine/src/listengine.pl
===================================================================
--- trunk/vhffs-listengine/src/listengine.pl 2009-04-12 13:05:10 UTC (rev 1391)
+++ trunk/vhffs-listengine/src/listengine.pl 2009-04-12 13:35:37 UTC (rev 1392)
@@ -38,6 +38,8 @@
use locale;
use Locale::gettext;
use Mail::Internet;
+use DateTime;
+use DateTime::Format::Mail;
use lib '%VHFFS_LIB_DIR%';
use Vhffs::Main;
use Vhffs::Services::MailingList;
@@ -91,7 +93,15 @@
}
+sub datetime_rfc2822
+{
+ my $maildate = DateTime::Format::Mail->new();
+ my $dt = DateTime->now;
+ $dt->set_time_zone( 'local' );
+ return $maildate->format_datetime( $dt );
+}
+
sub sendmail
{
my $mail = shift;
@@ -356,7 +366,7 @@
my $subject = 'Successfully subscribed';
$subject = '['.$list->get_prefix.'] '.$subject if( length( $list->get_prefix ) > 0 );
$header->replace( 'Subject' , $subject );
- $header->replace('Date' , gmtime().' +00');
+ $header->replace('Date' , datetime_rfc2822() );
# validation needed or not ?
if( $list->get_sub_ctrl == Vhffs::Constants::ML_SUBSCRIBE_APPROVAL_REQUIRED ) {
@@ -414,7 +424,7 @@
my $subject = 'Subscribe error';
$subject = '['.$list->get_prefix.'] '.$subject if( length( $list->get_prefix ) > 0 );
$header->replace( 'Subject' , $subject );
- $header->replace('Date' , gmtime().' +00');
+ $header->replace('Date' , datetime_rfc2822() );
my $email = Mail::Internet->new( [ <> ] ,
Header => $header ,
@@ -444,7 +454,7 @@
$header->replace( 'To' , $from );
$header->replace( 'From' , $LISTMASTER );
$header->replace( 'Subject' , 'Successfully unsubscribe' );
- $header->replace('Date' , gmtime().' +00');
+ $header->replace('Date' , datetime_rfc2822() );
$email = Mail::Internet->new( [ <> ] ,
@@ -491,7 +501,7 @@
my $subject = 'Subscription accepted';
$subject = '['.$list->get_prefix.'] '.$subject if( length( $list->get_prefix ) > 0 );
$header->replace( 'Subject' , $subject );
- $header->replace('Date' , gmtime().' +00');
+ $header->replace('Date' , datetime_rfc2822() );
my $email = Mail::Internet->new( [ <> ] ,
Header => $header ,
@@ -534,7 +544,7 @@
my $subject = 'Subscription moderation error';
$subject = '['.$list->get_prefix.'] '.$subject if( length( $list->get_prefix ) > 0 );
$header->replace( 'Subject' , $subject );
- $header->replace('Date' , gmtime().' +00');
+ $header->replace('Date' , datetime_rfc2822() );
my $email = Mail::Internet->new( [ <> ] ,
Header => $header ,
@@ -564,7 +574,7 @@
my $subject = 'Subscription refused';
$subject = '['.$list->get_prefix.'] '.$subject if( length( $list->get_prefix ) > 0 );
$header->replace( 'Subject' , $subject );
- $header->replace('Date' , gmtime().' +00');
+ $header->replace('Date' , datetime_rfc2822() );
my $email = Mail::Internet->new( [ <> ] ,
Header => $header ,
@@ -606,7 +616,7 @@
my $subject = 'Subscription moderation error';
$subject = '['.$list->get_prefix.'] '.$subject if( length( $list->get_prefix ) > 0 );
$header->replace( 'Subject' , $subject );
- $header->replace('Date' , gmtime().' +00');
+ $header->replace('Date' , datetime_rfc2822() );
my $email = Mail::Internet->new( [ <> ] ,
Header => $header ,
@@ -835,7 +845,7 @@
$email->replace('From' , $LISTMASTER );
$email->replace('To' , $from );
$email->replace('Subject' , gettext('listengine help') );
- $email->replace('Date' , gmtime().' +00');
+ $email->replace('Date' , datetime_rfc2822() );
sendmail( $email , $from );
}
elsif( $subject =~ /^subscribe$/i )
@@ -857,7 +867,7 @@
$email->replace('From' , $LISTMASTER );
$email->replace('To' , $from );
$email->replace('Subject' , gettext('listengine help') );
- $email->replace('Date' , gmtime().' +00');
+ $email->replace('Date' , datetime_rfc2822() );
sendmail( $email , $from );
}
else
@@ -868,7 +878,7 @@
$email->replace('From' , $LISTMASTER );
$email->replace('To' , $from );
$email->replace('Subject' , gettext('listengine help') );
- $email->replace('Date' , gmtime().' +00');
+ $email->replace('Date' , datetime_rfc2822() );
sendmail( $email , $from );
}
}
@@ -885,7 +895,7 @@
$email->replace('From' , $LISTMASTER );
$email->replace('To' , $from );
$email->replace('Subject' , gettext('listengine result command') );
- $email->replace('Date' , gmtime().' +00');
+ $email->replace('Date' , datetime_rfc2822() );
sendmail( $email , $from );
}
@@ -900,7 +910,7 @@
$email->replace('From' , $LISTMASTER );
$email->replace('To' , $from );
$email->replace('Subject' , gettext('listengine moderation') );
- $email->replace('Date' , gmtime().' +00');
+ $email->replace('Date' , datetime_rfc2822() );
sendmail( $email , $from );
}
else
@@ -911,7 +921,7 @@
$email->replace('From' , $LISTMASTER );
$email->replace('To' , $from );
$email->replace('Subject' , gettext('listengine moderation') );
- $email->replace('Date' , gmtime().' +00');
+ $email->replace('Date' , datetime_rfc2822() );
sendmail( $email , $from );
}
@@ -927,7 +937,7 @@
$email->replace('From' , $LISTMASTER );
$email->replace('To' , $from );
$email->replace('Subject' , gettext('listengine moderation') );
- $email->replace('Date' , gmtime().' +00');
+ $email->replace('Date' , datetime_rfc2822() );
sendmail( $email , $from );
return;
}
@@ -939,7 +949,7 @@
$email->replace('From' , $LISTMASTER );
$email->replace('To' , $from );
$email->replace('Subject' , gettext('listengine moderation') );
- $email->replace('Date' , gmtime().' +00');
+ $email->replace('Date' , datetime_rfc2822() );
sendmail( $email , $from );
}
return;
@@ -952,7 +962,7 @@
$email->replace('From' , $LISTMASTER );
$email->replace('To' , $from );
$email->replace('Subject' , sprintf( gettext('listengine - list of messages to moderate for %s') , $list->get_listname ) );
- $email->replace('Date' , gmtime().' +00');
+ $email->replace('Date' , datetime_rfc2822() );
sendmail( $email , $from );
return;
}
@@ -966,7 +976,7 @@
$email->replace('From' , $LISTMASTER );
$email->replace('To' , $from );
$email->replace('Subject' , gettext('listengine moderation') );
- $email->replace('Date' , gmtime().' +00');
+ $email->replace('Date' , datetime_rfc2822() );
sendmail( $email , $from );
}
else
@@ -977,7 +987,7 @@
$email->replace('From' , $LISTMASTER );
$email->replace('To' , $from );
$email->replace('Subject' , gettext('listengine moderation') );
- $email->replace('Date' , gmtime().' +00');
+ $email->replace('Date' , datetime_rfc2822() );
sendmail( $email , $from );
}
}
@@ -1018,7 +1028,7 @@
$mail->replace('From' , $LISTMASTER );
$mail->replace('To' , $from );
$mail->replace('Subject' , gettext('listengine: unknown command') );
- $mail->replace('Date' , gmtime().' +00');
+ $mail->replace('Date' , datetime_rfc2822() );
sendmail( $mail , $from );
}
Modified: trunk/vhffs-test-dependencies.in
===================================================================
--- trunk/vhffs-test-dependencies.in 2009-04-12 13:05:10 UTC (rev 1391)
+++ trunk/vhffs-test-dependencies.in 2009-04-12 13:35:37 UTC (rev 1392)
@@ -37,6 +37,8 @@
$dep{'jabber'} = [ 'MIME::Base64' ];
$dep{'listengine'} = [
+ ('DateTime', ''),
+ ('DateTime::Format::Mail', ''),
('Net::SMTP', ''),
('Socket', '')];