From 7e208f7c1a29c08a439d3d7b25b1e459fd3e7946 Mon Sep 17 00:00:00 2001 From: lars Date: Fri, 21 Sep 2007 01:39:26 +0000 Subject: [PATCH] improved parsing of subscription log files --- TODO | 9 +++++---- ezmlm-web.cgi | 25 +++++++++++++++---------- lang/en.hdf | 1 + template/show_subscription_log.cs | 2 ++ 4 files changed, 23 insertions(+), 14 deletions(-) diff --git a/TODO b/TODO index 84559dd..1761372 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,3 @@ -add translators to "contribute" - -check the content of the Log file for automatic subscription - Infos fuer Massen-Hosting: http://www.fbis.ch/index-de.php?page=14&frameset=4 @@ -9,3 +5,8 @@ add "only for plain text mails" to the TrailerText string check version history of Mail::Ezmlm +main page title should be a link to the domain/list selection + -> text configurable? + +listname (incl. domain name) below the main title? + diff --git a/ezmlm-web.cgi b/ezmlm-web.cgi index 7b62d87..47f096c 100755 --- a/ezmlm-web.cgi +++ b/ezmlm-web.cgi @@ -1304,7 +1304,8 @@ sub set_pagedata_subscription_log { my ($listname) = @_; - my ($log_file, @event, $i, $datetext, $epoch_seconds, $note, $address); + my ($log_file, $i, $line); + my ($datetext, $epoch_seconds, $action, $action_details, $address); $log_file = "$LIST_DIR/" . $q->param('list') . "/Log"; # break if there is no log_file @@ -1319,18 +1320,22 @@ sub set_pagedata_subscription_log { $i = 0; while () { chomp; - @event = split; - if ($#event eq 2) { - $epoch_seconds = $event[0]; + $line = $_; + # a line of the log file could look like the following: + # 748392136 +manual foo@bar.org Foo Bar + $line =~ m/^(\d+) ([+-])(\w*) ([^ ]*) ?(.*)$/; + if (defined($5)) { + $epoch_seconds = $1; + $action = $2; + $action_details = $3; + $address = $5 ? $5 : $4; $datetext = localtime($epoch_seconds); - $note = $event[1]; - $address = $event[2]; # the date in gmt format - this should be sufficient $pagedata->setValue("Data.List.SubscribeLog.$i.date", $datetext); - # the first letter of 'note' should be +/- - $pagedata->setValue("Data.List.SubscribeLog.$i.action", substr($note,0,1)); - # manual/auto/mod - TODO: verify "auto" - $pagedata->setValue("Data.List.SubscribeLog.$i.details", substr($note,1)); + # the the action should be +/- + $pagedata->setValue("Data.List.SubscribeLog.$i.action", $action); + # manual/auto/mod/probe - TODO: verify "auto" + $pagedata->setValue("Data.List.SubscribeLog.$i.details", $action_details); $pagedata->setValue("Data.List.SubscribeLog.$i.address", $address); $i++; } diff --git a/lang/en.hdf b/lang/en.hdf index 8acaa6f..8f2f4c7 100644 --- a/lang/en.hdf +++ b/lang/en.hdf @@ -290,6 +290,7 @@ Lang { add = added mod = moderated manual = manual + probe = delivery failed auto = automatical unknown = unknown } diff --git a/template/show_subscription_log.cs b/template/show_subscription_log.cs index 34406d9..b651b4b 100644 --- a/template/show_subscription_log.cs +++ b/template/show_subscription_log.cs @@ -27,6 +27,8 @@ var:html_escape(Lang.Misc.SubscribeActions.manual) ?>