mhonarc-commits
[Top] [All Lists]

CVS: mhonarc/MHonArc/lib mhamain.pl,2.97,2.98 mhopt.pl,2.66,2.67 readmail.p...

2011-01-08 23:13:17
Update of mhonarc/MHonArc/lib
Modified Files:
	mhamain.pl mhopt.pl readmail.pl 
Log Message:
Added debug mode and some initial debugging messages based on
some testing I'm doing.  If debugging enabled, any debugging
messages go to stderr.


======================================================================
FILE: mhonarc/MHonArc/lib/mhamain.pl
<http://www.mhonarc.org/cgi-bin/viewcvs.cgi/*checkout*/mhonarc/MHonArc/lib/mhamain.pl?rev=2.98>

<http://www.mhonarc.org/cgi-bin/viewcvs.cgi/mhonarc/MHonArc/lib/mhamain.pl.diff?r1=2.97&r2=2.98&diff_format=h>
--- mhamain.pl	1 Jan 2011 22:26:20 -0000	2.97
+++ mhamain.pl	9 Jan 2011 05:13:14 -0000	2.98
@@ -60,4 +60,5 @@
 ###############################################################################
 
+$DEBUG          = 0;
 $CODE           = 0;
 $ERROR          = "";
@@ -1033,4 +1034,7 @@
         $data = <$handle>;
     }
+    if ($DEBUG) {
+      print STDERR "read_mail_body(): Body data loaded into memory\n";
+    }
 
     return ''  if $skip;
@@ -1038,4 +1042,7 @@
     ## Invoke callback if defined
     if (defined($CBRawMessageBodyRead) && defined(&$CBRawMessageBodyRead)) {
+        if ($DEBUG) {
+          print STDERR "read_mail_body(): Calling CBRawMessageBodyRead\n";
+        }
         if (!&$CBRawMessageBodyRead($fields, \$data)) {
             # reverse effect of read_mail_header()
@@ -1053,5 +1060,11 @@
 
     ## Filter data
+    if ($DEBUG) {
+      print STDERR "read_mail_body(): Calling readmail::MAILread_body\n";
+    }
     ($ret, @files) = &readmail::MAILread_body($fields, \$data);
+    if ($DEBUG) {
+      print STDERR "read_mail_body(): readmail::MAILread_body DONE\n";
+    }
     $ret = ''     unless defined $ret;
     @files = ( )  unless @files;

======================================================================
FILE: mhonarc/MHonArc/lib/mhopt.pl
<http://www.mhonarc.org/cgi-bin/viewcvs.cgi/*checkout*/mhonarc/MHonArc/lib/mhopt.pl?rev=2.67>

<http://www.mhonarc.org/cgi-bin/viewcvs.cgi/mhonarc/MHonArc/lib/mhopt.pl.diff?r1=2.66&r2=2.67&diff_format=h>
--- mhopt.pl	31 Dec 2010 21:37:00 -0000	2.66
+++ mhopt.pl	9 Jan 2011 05:13:14 -0000	2.67
@@ -59,4 +59,5 @@
         'dbfile=s',     # Database/state filename for mhonarc archive
         'dbfileperms=i',# Octal permission to set DBFILE
+        'debug',        # Turn on debugging
         'decodeheads',  # Decode all 1522 encoded data in message headers
         'definevar|definevars=s@',
@@ -227,4 +228,7 @@
     if ($opt{'help'})   { &usage();   return 0; }
     if ($opt{'v'})      { &version(); return 0; }
+    if ($opt{'debug'}) {
+        $DEBUG = 1;
+    }
 
     ## Check std{in,out,err} options
@@ -892,4 +896,6 @@
 ##
 sub mhinit_readmail_vars {
+    $readmail::DEBUG = $DEBUG;
+
     ##  Default decoders
     %readmail::MIMEDecoders = (

======================================================================
FILE: mhonarc/MHonArc/lib/readmail.pl
<http://www.mhonarc.org/cgi-bin/viewcvs.cgi/*checkout*/mhonarc/MHonArc/lib/readmail.pl?rev=2.42>

<http://www.mhonarc.org/cgi-bin/viewcvs.cgi/mhonarc/MHonArc/lib/readmail.pl.diff?r1=2.41&r2=2.42&diff_format=h>
--- readmail.pl	3 Jan 2011 06:42:39 -0000	2.41
+++ readmail.pl	9 Jan 2011 05:13:14 -0000	2.42
@@ -45,4 +45,6 @@
 package readmail;
 
+$DEBUG = 0;
+
 ###############################################################################
 ##      Private Globals                                                      ##
@@ -569,8 +571,15 @@
         my $textfunc = load_textencoder();
         if (defined($textfunc)) {
+            if ($DEBUG) {
+              print STDERR "MAILread_body: have textfunc: $textfunc\n";
+            }
             $fields->{'x-mha-charset'} = $TextEncode
                 if defined(&$textfunc($body, $charset, $TextEncode));
         }
         if (defined($TextPreFilter) && defined(&$TextPreFilter)) {
+            if ($DEBUG) {
+              print STDERR 'MAILread_body: have TextPreFilter: ',
+                           $TextPreFilter, "\n";
+            }
             &$TextPreFilter($fields, $body);
         }
@@ -580,4 +589,7 @@
         $fields->{'x-mha-charset'} = $TextDefCharset;
     }
+    if ($DEBUG) {
+      print STDERR 'MAILread_body: charset: ',$fields->{'x-mha-charset'},"\n";
+    }
 
     ## A filter is defined for given content-type

---------------------------------------------------------------------
To sign-off this list, send email to majordomo(_at_)mhonarc(_dot_)org with the
message text UNSUBSCRIBE MHONARC-COMMITS