# kmail/kaddressbook: Export CSV list
# gmail: export Outlook format
# foxmail: export with all possible headers
+# basic: a csv file only containing these fields 'First Name', 'Last Name', 'Nickname', 'Email Address'
###
my $quote_char = '"';
my $bookname = '';
my $iNeedHelp = '';
-my $known_types = qr/^(?:becky|thunderbird|kmail|gmail|foxmail)$/;
+my $known_types = qr/^(?:becky|thunderbird|kmail|gmail|foxmail|basic)$/;
GetOptions("type=s" => \$type,
"csv=s" => \$csvfile,
'Office Postal Code','Office Address','Office HomePage',
'Office Position','Office Department','Office Telephone 1',
'Office Telephone 2','Office Fax','Memo','foxaddrID');
+my @basic_fields = ('Nickname','e-mail Address');
if (grep m/claws-mail/ => `ps -U $ENV{USER}`) {
die("You must quit claws-mail before running this script\n");
$script [OPTIONS]
Options:
--help Show this screen
- --type=becky|thunderbird|kmail|gmail|foxmail
+ --type=becky|thunderbird|kmail|gmail|foxmail|basic
Type of exported address book
--csv=FILENAME Full path to CSV file
--name="My new address book" Name of new Claws address book (optional)
return("gmail address book");
} elsif ($type eq "foxmail") {
return("foxmail address book");
- }
+ } elsif ($type eq "basic") {
+ return("basic address book");
+ }
}
sub check_fields {
die("ERROR:\n\tInvalid field count!\n"
."\tProblem with your exported CSV file\n");
}
- }
+ } elsif ($type eq "basic") {
+ if ($#csvfields != $#basic_fields) {
+ die("ERROR:\n\tInvalid field count!\n"
+ ."\tProblem with your exported CSV file\n");
+ }
+ }
}
sub write_xml {
return('0','0','0','0','1','2');
} elsif ($type eq "foxmail") {
return ('0','1','3','2','4','33');
- }
+ } elsif ($type eq "basic") {
+ return ('0','0','0','0','1','0');
+ }
}
sub get_fields {
return(@gmail_fields);
} elsif ($type eq "foxmail") {
return(@foxmail_fields);
- }
+ } elsif ($type eq "basic") {
+ return (@basic_fields);
+ }
}
sub escape_fields {