Fixed display on echelon fields
authortausq <>
Tue, 11 Jan 2000 04:43:18 +0000 (04:43 +0000)
committertausq <>
Tue, 11 Jan 2000 04:43:18 +0000 (04:43 +0000)
Util.pm
search.cgi

diff --git a/Util.pm b/Util.pm
index b1b85f3..6117a4e 100644 (file)
--- a/Util.pm
+++ b/Util.pm
@@ -2,6 +2,7 @@
 package Util;
 
 use strict;
+use Date::Manip qw(ParseDate);
 
 my $blocksize = 8; # A blowfish block is 8 bytes
 my $configfile = "/etc/userdir-ldap/userdir-ldap.conf";
@@ -207,12 +208,22 @@ sub FormatLastSeen {
 # Format:
 # [Tue, 11 Jan 2000 02:37:18] "Joey Hess <joeyh@debian.org>" "<debian-boot@lists.debian.org> archive/latest/7130" "<20000110181924.H19910@kitenet.net>"
 # [Mon, 10 Jan 2000 21:48:19] "9E1E 1052 F8BB A351  0606 5527 50BB 2974 2D59 A7D2" "<debian-devel-changes@lists.debian.org> archive/latest/58632" "<20000110200506.13257.qmail@master.debian.org>"
-  my $lastseen = shift;
-  return "<b>No activity detected</b>" if (!$lastseen);
+  my $lastseenpgp = shift;
+  my $lastseenfrom = shift;
+  my ($d1, $d2, $lastseen);
 
-  my ($date,$user,$list,$msgid) = ($lastseen =~ /^\[(.+?)\]\s+"(.+?)"\s+"<(.+?)>.+?"\s+"<(.+?)>"/);
-  return "<b>$list</b><br>Message ID: $msgid";
+  return "<b>No activity detected</b>" if (!$lastseenpgp && !$lastseenfrom);
+  $lastseen = $lastseenfrom if (!$lastseenpgp);
+
+  if ($lastseenfrom && $lastseenpgp) {
+    ($d1) = ($lastseenpgp =~ /^\[(.+?)\]/); $d1 = ParseDate($d1);  
+    ($d2) = ($lastseenfrom =~ /^\[(.+?)\]/); $d2 = ParseDate($d2);
+    $lastseen = (($d1 gt $d2) ? $lastseenpgp : $lastseenfrom);
+  }
+
+  my ($date,$user,$list,$msgid) = ($lastseen =~ /^\[(.+?)\]\s+"(.+?)"\s+"(?:<(.+?)>.+?|\-)"\s+"<(.+?)>"/);
+  $list = "on $list" if ($list);
+  return "$date $list<br>&nbsp;Message ID: $msgid";
 }
 
 sub LookupCountry {
index 3afb03a..ff67109 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: search.cgi,v 1.4 2000/01/11 04:52:53 tausq Exp $
+# $Id: search.cgi,v 1.5 2000/01/11 05:43:18 tausq Exp $
 # (c) 1999 Randolph Chung. Licensed under the GPL. <tausq@debian.org>
 
 use lib '.';
@@ -154,7 +154,7 @@ if (!$dosearch) {
     $created =  &Util::FormatTimestamp($data->{createtimestamp}->[0]);
 
     # Last seen information (Echelon)
-    $lastseen = &Util::FormatLastSeen($data->{"activity-pgp"}->[0] || 
+    $lastseen = &Util::FormatLastSeen($data->{"activity-pgp"}->[0],
                                       $data->{"activity-from"}->[0]);
 
     # Link in the debian login id