add convert_mbox.pl script
authorPaul Mangan <paul@claws-mail.org>
Thu, 8 May 2003 05:34:09 +0000 (05:34 +0000)
committerPaul Mangan <paul@claws-mail.org>
Thu, 8 May 2003 05:34:09 +0000 (05:34 +0000)
ChangeLog.claws
configure.ac
tools/Makefile.am
tools/README
tools/convert_mbox.pl [new file with mode: 0644]

index 9808435944d11fd19fa74da8a51a19eba9e6f4b1..89bfed7bf363d72a4c32e9c2a87d14894df73fce 100644 (file)
@@ -1,3 +1,11 @@
+2003-05-08 [paul]      0.8.11claws147
+
+       * tools/Makefile.am
+         tools/README
+         tools/convert_mbox.pl         ** NEW FILE **
+               add mbox conversion script. Submitted by 
+               Fred Marton <Fred.Marton@uni-bayreuth.de>
+
 2003-05-07 [christoph]
 
        * doc-src/glade.txt
index 65a50d5eed5c211337371bffc2dded79eaef1151..5cab966efbfd8a66490276344bdbe44968fe4e5a 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=11
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws146
+EXTRA_VERSION=claws147
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index c550071ac625f42d992c1060ae2eb19e20dea723..e0798b1117b07e19e89e00a6d99335b0d0e36f80 100644 (file)
@@ -1,6 +1,7 @@
 EXTRA_TOOLS = \
        OOo2sylpheed.pl \
        calypso_convert.pl \
+       convert_mbox.pl \
        eud2gc.py \
        filter_conv.pl \
        freshmeat_search.pl \
index 1a0a91dd9ed9045b0eca9100c2d89b2e01b69f13..42166f649c84e39f5f29e187518f8cbdfd7d1b9f 100644 (file)
@@ -20,6 +20,7 @@ Addressbook conversion:
 
 Mailbox conversion:
   calypso_convert.pl            Import mbox files with attachments from Calypso
+  convert_mbox.pl              Import mbox files
 
 Other tools:
   filter_conv.pl                Convert old-style filters to new filtering
@@ -285,6 +286,24 @@ Mailbox conversion
 
   Contact: Thorsten Maerz <torte@netztorte.de>
 
+* convert_mbox.pl
+
+  WHAT IT DOES
+       This perl script converts an mbox directory's contents into 
+       Sylpheed's MH format.
+  
+  HOW TO USE IT
+  
+       Run the script using:
+        
+               perl convert_mbox.pl MBOX MH_DIR
+               
+       Move the outputted MH_DIR and its contents into your Sylpheed
+       Mail folder; in Sylpheed right-click the top-level folder
+       and choose 'Rebuild folder tree' from the popup menu.   
+
+  Contact: Fred Marton <Fred.Marton@uni-bayreuth.de>
+
 --------------------------------------------------------------------------------
 
 Other tools
diff --git a/tools/convert_mbox.pl b/tools/convert_mbox.pl
new file mode 100644 (file)
index 0000000..fa1e8ee
--- /dev/null
@@ -0,0 +1,73 @@
+#!/usr/bin/perl
+# convert_mbox.pl
+# perl script to convert mbox file to files in a new MH directory
+# aka another mbox -> MH conversion tool
+# 29 April 2003  
+# Fred Marton <Fred.Marton@uni-bayreuth.de>
+#
+# Note: Running this with the -w flag generates the following warnings:
+# Scalar value @word[1] better written as $word[1] at /path/to/convert_mbox.pl line 44
+# Scalar value @word[0] better written as $word[1] at /path/to/convert_mbox.pl line 46
+# Making these changes requires further changes in the script
+# that results in much longer run-times.  
+#
+# Copyright © 2003 Fred Marton
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# check for both arguments
+&usage if ($#ARGV < 1);
+$mbox =  $ARGV[0];
+$mh = $ARGV[1];
+# check to make sure there isn't something named MH already
+if (-e $mh) {
+   die (" The directory \"$mh\" already exists.  Exiting.\n");
+}
+else {
+   mkdir $mh;
+}
+# start numbering
+$i = 0;
+# open the mbox file
+open (IN, $mbox);
+while ($line = <IN>) {
+# check for the beginning of an e-mail
+   @word = split(/ /m,$line);
+# ignore the MAILER-DAEMON message from pine
+   if (@word[1] ne "MAILER-DAEMON") {
+# start a new file
+      if (@word[0] eq "From") {
+         $i++;
+         close (OUT);
+         open (OUT, ">$mh/$i");
+         print OUT $line;
+      }
+      else {
+# continue the file
+         print OUT $line;
+      }
+   }
+}
+close (OUT);
+close (IN);
+# and we're done
+print "\n If it isn't there already, please move the directory \"$mh\"\n"
+    . " into your MH directory and rebuild your folder tree.\n\n";
+
+sub usage
+{
+   die ( " usage: convert_mbox.pl MBOX MH_DIR\n");
+}