added gif2xface tool
[claws.git] / tools / filter_conv.pl
1 #!/usr/bin/perl
2
3 #  * Copyright 2001 Paul Mangan <claws@thewildbeast.co.uk>
4 #  *
5 #  * This file is free software; you can redistribute it and/or modify it
6 #  * under the terms of the GNU General Public License as published by
7 #  * the Free Software Foundation; either version 2 of the License, or
8 #  * (at your option) any later version.
9 #  *
10 #  * This program is distributed in the hope that it will be useful, but
11 #  * WITHOUT ANY WARRANTY; without even the implied warranty of
12 #  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 #  * General Public License for more details.
14 #  *
15 #  * You should have received a copy of the GNU General Public License
16 #  * along with this program; if not, write to the Free Software
17 #  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 #  *
19
20
21 $INPUT = open (FILTERRC, "<filterrc");
22 @input_file = <FILTERRC>;
23 $WRITE_THIS = "";
24 close FILTERRC;
25
26 foreach $input_file (@input_file) {
27 @split_lines = split("\t", $input_file);
28 if (($split_lines[3]) && ($split_lines[0] eq "To")) {
29 $WRITE_THIS .= "to_or_cc match \"$split_lines[1]\"";
30 } elsif ($split_lines[0] eq "To") {
31 $WRITE_THIS .= "to match \"$split_lines[1]\"";
32 } elsif ($split_lines[0] eq "Reply-To") {
33 $WRITE_THIS .= "inreplyto match \"$split_lines[1]\"";
34 } elsif ($split_lines[0] eq "Subject") {
35 $WRITE_THIS .= "subject match \"$split_lines[1]\"";
36 } elsif (($split_lines[0] eq "From") || ($split_lines[0] eq "Sender")){
37 $WRITE_THIS .= "from match \"$split_lines[1]\"";
38 }
39 if (!$split_lines[5]) {
40 $WRITE_THIS .= " delete";
41 } elsif ($split_lines[8] == "m"){
42 $WRITE_THIS .= " move \"\#mh/Mailbox/$split_lines[5]\"";
43 }
44 $WRITE_THIS .= "\n";
45
46 @split_lines = "";
47 }
48
49 open (FILTERINGRC, ">filteringrc");
50
51 print FILTERINGRC $WRITE_THIS;
52 close FILTERINGRC;
53
54 exit;
55