3 # * Copyright 2004 Paul Mangan <claws@thewildbeast.co.uk>
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.
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.
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.
19 unless ($ARGV[0]) { exit; }
21 my $sylpheed = "sylpheed --compose --attach";
22 my $prefix = "/tmp/archive.";
23 my $command = find_command($ARGV[0]);
24 my ($sel,$att) = split_parts();
26 if ($ARGV[0] eq "gz" || $ARGV[0] eq "bz2") {
27 exec "$sel$sylpheed $att";
28 } elsif ($ARGV[0] eq "attachfile") {
29 exec "$sylpheed $sel";
31 exec "$command $prefix$ARGV[0] $sel;"
32 ."$sylpheed $prefix$ARGV[0]";
41 if ($s eq "gz") { $com = "gzip -c"; }
42 elsif ($s eq "bz2") { $com = "bzip2 -c"; }
43 elsif ($s eq "zip") { $com = "$s -r"; }
44 elsif ($s eq "tar") { $com = "$s -c -f"; }
45 elsif ($s eq "tar.bz2") { $com = "tar -cj -f"; }
46 elsif ($s eq "tar.gz") { $com = "tar -cz -f"; }
52 my $selectedParts = "";
53 my $attachedParts = "";
55 for (my $count = $#ARGV; $count > 0; $count--) {
56 my @s = split("/", $ARGV[$count]);
58 if ($ARGV[0] eq "gz" || $ARGV[0] eq "bz2") {
61 my $output = "/tmp/$psub.$ARGV[0]";
62 $selectedParts .= "$command \"$p\" > $output;";
63 $attachedParts .= "$output ";
65 $selectedParts .= "\"$p\" ";
68 return ($selectedParts,$attachedParts);