Update of mhonarc/MHonArc/lib
Modified Files:
ewhutil.pl mhamain.pl mhutil.pl
Log Message:
The return value for $mhonarc::CBMessageBodyRead and
$mhonarc::CBRawMessageBodyRead is no longer N/A. If the return
value evaluates to false, the current message will be excluded from
the archive and further processing. A true value must be returned
if the message is to not be excluded.
======================================================================
FILE: mhonarc/MHonArc/lib/ewhutil.pl
<http://www.mhonarc.org/cgi-bin/viewcvs.cgi/*checkout*/mhonarc/MHonArc/lib/ewhutil.pl?rev=2.15>
<http://www.mhonarc.org/cgi-bin/viewcvs.cgi/mhonarc/MHonArc/lib/ewhutil.pl.diff?r1=2.14&r2=2.15&diff_format=h>
--- ewhutil.pl 5 Apr 2003 23:49:38 -0000 2.14
+++ ewhutil.pl 2 Jun 2005 02:12:30 -0000 2.15
@@ -101,8 +101,8 @@
$$str_r =~ s/\</</g;
$$str_r =~ s/\>/>/g;
- $$str_r =~ s/\&/\&/g;
- $$str_r =~ s/\"/\&/g;
$$str_r =~ s/\&#[xX]0*40;/@/g;
$$str_r =~ s/\@/@/g;
+ $$str_r =~ s/\"/"/g;
+ $$str_r =~ s/\&/\&/g;
$$str_r;
}
======================================================================
FILE: mhonarc/MHonArc/lib/mhamain.pl
<http://www.mhonarc.org/cgi-bin/viewcvs.cgi/*checkout*/mhonarc/MHonArc/lib/mhamain.pl?rev=2.80>
<http://www.mhonarc.org/cgi-bin/viewcvs.cgi/mhonarc/MHonArc/lib/mhamain.pl.diff?r1=2.79&r2=2.80&diff_format=h>
--- mhamain.pl 22 May 2005 21:14:33 -0000 2.79
+++ mhamain.pl 2 Jun 2005 02:12:30 -0000 2.80
@@ -297,6 +297,8 @@
if ($index) {
- $AddIndex{$index} = 1;
- read_mail_body($handle, $index, $fields, $NoMsgPgs);
+ if (defined(read_mail_body(
+ $handle, $index, $fields, $NoMsgPgs))) {
+ $AddIndex{$index} = 1;
+ }
}
@@ -337,15 +339,19 @@
# Process message if valid
if ($index) {
- if ($ADD && !$SLOW) { $AddIndex{$index} = 1; }
- read_mail_body($fh, $index, $fields, $NoMsgPgs);
-
- # Check if conserving memory
- if ($SLOW && $DoArchive) {
- output_mail($index, 1, 1);
- $Update{$IndexNum{$index}} = 1;
- }
- if ($SLOW || !$DoArchive) {
- delete $MsgHead{$index};
- delete $Message{$index};
+ if (defined(read_mail_body(
+ $fh, $index, $fields, $NoMsgPgs))) {
+ if ($ADD && !$SLOW) { $AddIndex{$index} = 1; }
+
+ # Check if conserving memory
+ if ($SLOW && $DoArchive) {
+ output_mail($index, 1, 1);
+ $Update{$IndexNum{$index}} = 1;
+ }
+ if ($SLOW || !$DoArchive) {
+ delete $MsgHead{$index};
+ delete $Message{$index};
+ }
+ } else {
+ $index = undef;
}
}
@@ -376,17 +382,22 @@
if ($index) {
- if ($ADD && !$SLOW) { $AddIndex{$index} = 1; }
- read_mail_body($fh, $index, $fields, $NoMsgPgs);
-
- if ($SLOW && $DoArchive) {
- output_mail($index, 1, 1);
- $Update{$IndexNum{$index}} = 1;
- }
- if ($SLOW || !$DoArchive) {
- delete $MsgHead{$index};
- delete $Message{$index};
+ if (defined(read_mail_body(
+ $fh, $index, $fields, $NoMsgPgs))) {
+ if ($ADD && !$SLOW) { $AddIndex{$index} = 1; }
+
+ if ($SLOW && $DoArchive) {
+ output_mail($index, 1, 1);
+ $Update{$IndexNum{$index}} = 1;
+ }
+ if ($SLOW || !$DoArchive) {
+ delete $MsgHead{$index};
+ delete $Message{$index};
+ }
+ } else {
+ $index = undef;
}
} else {
+ # skip passed message body
read_mail_body($fh, $index, $fields, 1);
}
@@ -990,5 +1001,9 @@
## Invoke callback if defined
if (defined($CBRawMessageBodyRead) && defined(&$CBRawMessageBodyRead)) {
- &$CBRawMessageBodyRead($fields, \$data);
+ if (!&$CBRawMessageBodyRead($fields, \$data)) {
+ # reverse effect of read_mail_header()
+ delmsg_from_hashes($index);
+ return undef;
+ }
}
@@ -1007,5 +1022,9 @@
## Invoke callback if defined
if (defined($CBMessageBodyRead) && defined(&$CBMessageBodyRead)) {
- &$CBMessageBodyRead($fields, \$ret, \(_at_)files);
+ if (!&$CBMessageBodyRead($fields, \$ret, \(_at_)files)) {
+ # reverse effect of read_mail_header()
+ delmsg_from_hashes($index);
+ return undef;
+ }
$Message{$index} = $ret;
} else {
@@ -1364,13 +1383,42 @@
##---------------------------------------------------------------------------
-## delmsg delets a message from the archive.
+## delmsg deletes a message from the archive.
##
sub delmsg {
my $key = shift;
- my($pathname);
+ my($filename, $derived) = delmsg_from_hashes($key);
+ return 0 unless defined($filename);
+
+ if (!$KeepOnRmm) {
+ file_remove($filename);
+ if (defined($derived)) {
+ my $pathname;
+ foreach $filename (@{$derived}) {
+ $pathname = (OSis_absolute_path($filename)) ?
+ $filename : join($DIRSEP, $OUTDIR, $filename);
+ if (-d $pathname) {
+ dir_remove($pathname);
+ } else {
+ file_remove($pathname);
+ }
+ }
+ }
+ }
+ 1;
+}
+
+##---------------------------------------------------------------------------
+## delmsg_from_hashes deletes all message info from db hashes.
+## Return value is a list of two items: pathname to message
+## file and array ref to any derived files.
+##
+sub delmsg_from_hashes {
+ my $key = shift;
#&defineIndex2MsgId();
- my $msgnum = $IndexNum{$key}; return 0 if ($msgnum eq '');
+ my $msgnum = $IndexNum{$key};
+ return (undef, undef) if ($msgnum eq '');
my $filename = join($DIRSEP, $OUTDIR, &msgnum_filename($msgnum));
+
delete $ContentType{$key};
delete $Date{$key};
@@ -1380,17 +1428,10 @@
delete $Subject{$key};
delete $MsgId{$Index2MsgId{$key}};
- file_remove($filename) unless $KeepOnRmm;
- foreach $filename (@{$Derived{$key}}) {
- $pathname = (OSis_absolute_path($filename)) ?
- $filename : join($DIRSEP, $OUTDIR, $filename);
- if (-d $pathname) {
- dir_remove($pathname) unless $KeepOnRmm;
- } else {
- file_remove($pathname) unless $KeepOnRmm;
- }
- }
+
+ my $derived = $Derived{$key};
delete $Derived{$key};
+
$NumOfMsgs--;
- 1;
+ ($filename, $derived);
}
======================================================================
FILE: mhonarc/MHonArc/lib/mhutil.pl
<http://www.mhonarc.org/cgi-bin/viewcvs.cgi/*checkout*/mhonarc/MHonArc/lib/mhutil.pl?rev=2.31>
<http://www.mhonarc.org/cgi-bin/viewcvs.cgi/mhonarc/MHonArc/lib/mhutil.pl.diff?r1=2.30&r2=2.31&diff_format=h>
--- mhutil.pl 24 Oct 2003 19:24:35 -0000 2.30
+++ mhutil.pl 2 Jun 2005 02:12:30 -0000 2.31
@@ -40,4 +40,12 @@
);
+## Do not apply ADDRESSMODIFYCODE headerfiels
+%HFieldsAsIsList = (
+ %HFieldsList,
+ 'content-id',
+ 'content-type',
+ 'message-id',
+);
+
## Header fields that contain addresses
%HFieldsAddr = (
@@ -497,5 +505,5 @@
my $ret = "";
local($_);
- foreach (split(/(<[^>]+>)/, $txt)) {
+ foreach (split(/(<[^<>]+>)/, $txt)) {
if (/^<\w+:/) {
chop; substr($_, 0, 1) = "";
---------------------------------------------------------------------
To sign-off this list, send email to majordomo(_at_)mhonarc(_dot_)org with the
message text UNSUBSCRIBE MHONARC-COMMITS