read top level mailbox name - presume nothing
authorPaul Mangan <paul@claws-mail.org>
Mon, 26 Nov 2001 11:04:57 +0000 (11:04 +0000)
committerPaul Mangan <paul@claws-mail.org>
Mon, 26 Nov 2001 11:04:57 +0000 (11:04 +0000)
tools/README
tools/filter_conv.pl

index 47a6af7..449f56e 100644 (file)
 
   This perl script provides easy conversion of your filtering rules
   form sylpheed's old filter system to the new filtering system used
-  in sylpheed-claws. It reads 'filterrc' and outputs 'filteringrc'.
+  in sylpheed-claws. It reads '~/.sylpheed/filterrc' and outputs 
+  '~/.sylpheed/filteringrc'.
+  
+  Your old filter settings are preserved, if you want to go back to
+  the original filter system simply delete ~/.sylpheed/filteringrc
 
   HOW TO USE IT
 
-  Issue the following command:
+  Issue the following command from the 'tools' directory:
 
         perl filter_conv.pl
 
index e932a5c..68ccf74 100644 (file)
 #  *
 
 chdir;
-chdir '.sylpheed' || die("You don't appear to have Sylpheed installed");
+chdir '.sylpheed' || die("You don't appear to have Sylpheed installed\n");
 
-open(FOLDERLIST, "<folderlist.xml") || warn("Can't find folderlist.xml, guessing that you use 'Mail'");
+open(FOLDERLIST, "<folderlist.xml") || die("Can't find folderlist.xml\n");
 @folderlist = <FOLDERLIST>;
 close FOLDERLIST;
 
 foreach $folderlist (@folderlist) {
        if ($folderlist =~ m/<folder type="mh"/) {
-                if ($folderlist =~ m/name="Mailbox"/) {
-                       $TOPBOXIS = "Mailbox";
-                } else {
-                       $TOPBOXIS = "Mail";
-                }
+               $folderlist =~ s/<folder type="mh" name="//;
+                $folderlist =~ s/" path="[A-Z0-9]+">\n//ig;
+                $folderlist =~ s/^ +//;
+                $mailbox = $folderlist;
         }
 }
 
-if (!$TOPBOXIS) {
-       $TOPBOXIS = "Mail";
-}
-
-open (FILTERRC, "<filterrc") || die("Can't find your old filter rules");
+open (FILTERRC, "<filterrc") || die("Can't find your old filter rules\n");
 @input_file = <FILTERRC>;
 close FILTERRC;
 
@@ -62,7 +57,7 @@ $WRITE_THIS .= "from match \"$split_lines[1]\"";
 if (!$split_lines[5]) {
 $WRITE_THIS .= " delete";
 } elsif ($split_lines[8] == "m"){
-$WRITE_THIS .= " move \"\#mh/$TOPBOXIS/$split_lines[5]\"";
+$WRITE_THIS .= " move \"\#mh/$mailbox/$split_lines[5]\"";
 }
 $WRITE_THIS .= "\n";