don't hardcode top-level folder name
authorPaul Mangan <paul@claws-mail.org>
Tue, 30 Oct 2001 12:00:04 +0000 (12:00 +0000)
committerPaul Mangan <paul@claws-mail.org>
Tue, 30 Oct 2001 12:00:04 +0000 (12:00 +0000)
ChangeLog.claws
tools/filter_conv.pl

index 94c94f8..f6ab125 100644 (file)
@@ -3,6 +3,10 @@
                * sync with sylpheed 0.6.4cvs6
                        see ChangeLog entries 2001-10-26 to 2001-10-30
 
+               * tools/filter_conv.pl
+                       read folderlist.xml to discover whether the top-level
+                       folder is called 'Mailbox' or 'Mail' 
+
 2001-10-29 [paul]      0.6.4claws15
 
        * src/html.c, src/textview.c
index f06b379..e932a5c 100644 (file)
 chdir;
 chdir '.sylpheed' || die("You don't appear to have Sylpheed installed");
 
-$INPUT = open (FILTERRC, "<filterrc") || die("Can't find your old filter rules");
+open(FOLDERLIST, "<folderlist.xml") || warn("Can't find folderlist.xml, guessing that you use 'Mail'");
+@folderlist = <FOLDERLIST>;
+close FOLDERLIST;
+
+foreach $folderlist (@folderlist) {
+       if ($folderlist =~ m/<folder type="mh"/) {
+                if ($folderlist =~ m/name="Mailbox"/) {
+                       $TOPBOXIS = "Mailbox";
+                } else {
+                       $TOPBOXIS = "Mail";
+                }
+        }
+}
+
+if (!$TOPBOXIS) {
+       $TOPBOXIS = "Mail";
+}
+
+open (FILTERRC, "<filterrc") || die("Can't find your old filter rules");
 @input_file = <FILTERRC>;
 close FILTERRC;
 
@@ -44,7 +62,7 @@ $WRITE_THIS .= "from match \"$split_lines[1]\"";
 if (!$split_lines[5]) {
 $WRITE_THIS .= " delete";
 } elsif ($split_lines[8] == "m"){
-$WRITE_THIS .= " move \"\#mh/Mailbox/$split_lines[5]\"";
+$WRITE_THIS .= " move \"\#mh/$TOPBOXIS/$split_lines[5]\"";
 }
 $WRITE_THIS .= "\n";