commit db18ddd83d2297d5cd74ae413ab74f57f8fd6599
parent ff0b191196cd1d8499b8bcad43ebaad1ababac4a
Author: Paul Mangan <paul@claws-mail.org>
Date: Fri, 12 Sep 2008 08:01:34 +0000
2008-09-12 [paul] 3.5.0cvs102
* tools/README
* tools/csv2addressbook.pl
add support for Fox Mail
Diffstat:
5 files changed, 69 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,9 @@
+2008-09-12 [paul] 3.5.0cvs102
+
+ * tools/README
+ * tools/csv2addressbook.pl
+ add support for Fox Mail
+
2008-09-12 [paul] 3.5.0cvs101
* src/compose.c
diff --git a/PATCHSETS b/PATCHSETS
@@ -3513,3 +3513,4 @@
( cvs diff -u -r 1.149.2.93 -r 1.149.2.94 src/inc.c; ) > 3.5.0cvs99.patchset
( cvs diff -u -r 1.654.2.3573 -r 1.654.2.3574 configure.ac; ) > 3.5.0cvs100.patchset
( cvs diff -u -r 1.382.2.473 -r 1.382.2.474 src/compose.c; cvs diff -u -r 1.1.2.17 -r 1.1.2.18 src/prefs_wrapping.c; ) > 3.5.0cvs101.patchset
+( cvs diff -u -r 1.30.2.31 -r 1.30.2.32 tools/README; cvs diff -u -r 1.1.2.3 -r 1.1.2.4 tools/csv2addressbook.pl; ) > 3.5.0cvs102.patchset
diff --git a/configure.ac b/configure.ac
@@ -11,7 +11,7 @@ MINOR_VERSION=5
MICRO_VERSION=0
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=101
+EXTRA_VERSION=102
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
diff --git a/tools/README b/tools/README
@@ -14,7 +14,8 @@ Action scripts:
OpenOffice
Addressbook conversion:
- csv2addressbook.pl Import Becky, Thunderbird, Kmail Gmail address books
+ csv2addressbook.pl Import Becky, Thunderbird, Kmail, Gmail and Fox
+ Mail address books
eud2gc.py Convert Eudora address book to Gnomecard
kmail2claws-mail.pl Import a Kmail address book (KDE2)
kmail2claws-mail_v2.pl Import a Kmail address book (KDE3)
@@ -142,8 +143,8 @@ Address book conversion
* csv2addressbook.pl
WHAT IT DOES
- This perl script will import a Becky, Thunderbird, Kmail and Gmail
- address book.
+ This perl script will import a Becky, Thunderbird, Kmail, Gmail and
+ Fox Mail address book.
HOW TO USE IT
(You must run claws-mail at least once before running this script.)
@@ -203,6 +204,18 @@ Address book conversion
you don't use this option the new Claws address book will be
called 'gmail address book'.
+ Fox Mail
+ --------
+ Export your Fox Mail address book as CSV with all possible headers.
+
+ Run the script with the following options:
+
+ perl csv2addressbook.pl --type=foxmail --csv=/full/path/to/file.csv
+
+ Addtionally you can use the option '--name="My address book"', if
+ you don't use this option the new Claws address book will be
+ called 'foxmail address book'.
+
You can also run the script with '--help' to get a brief usage message.
Contact: Paul Mangan <paul@claws-mail.org>
diff --git a/tools/csv2addressbook.pl b/tools/csv2addressbook.pl
@@ -29,12 +29,14 @@ use Text::CSV_XS;
# Kmail >= 1.9.7 / Kaddressbook >= 3.5.7
# ** kmail bug: can export badly formatted csv **
# Gmail
+# Fox Mail
#
# Becky: full export with titles
# thunderbird: export as 'comma separated'
# kmail/kaddressbook: Export CSV list
# gmail: export Outlook format
+# foxmail: export with all possible headers
###
my $quote_char = '"';
@@ -48,7 +50,7 @@ my $csvfile = '';
my $bookname = '';
my $iNeedHelp = '';
-my $known_types = qr/^(?:becky|thunderbird|kmail|gmail)$/;
+my $known_types = qr/^(?:becky|thunderbird|kmail|gmail|foxmail)$/;
GetOptions("type=s" => \$type,
"csv=s" => \$csvfile,
@@ -90,6 +92,15 @@ my @gmail_fields = ('Name','E-mail Address','Notes','E-mail 2 Address',
'Home Address','Business Phone','Business Phone 2',
'Business Fax','Business Address','Other Phone','Other Fax',
'Other Address','junk');
+my @foxmail_fields = ('First Name','Last Name','Name','Nickname','e-mail Address',
+ 'Mobile Phone','Pager Number','QQ','ICQ','Personal Home Page',
+ 'Sex','Birthday','Interest','Home Country','Home Province',
+ 'Home City','Home Postal Code','Home Street Address',
+ 'Home Telephone 1','Home Telephone 2','Home Fax','Office Company',
+ 'Office Country','Office Province','Office City',
+ 'Office Postal Code','Office Address','Office HomePage',
+ 'Office Position','Office Department','Office Telephone 1',
+ 'Office Telephone 2','Office Fax','Memo','foxaddrID');
if (grep m/claws-mail/ => `ps -U $ENV{USER}`) {
die("You must quit claws-mail before running this script\n");
@@ -112,7 +123,8 @@ Usage:
$script [OPTIONS]
Options:
--help Show this screen
- --type=becky|thunderbird|kmail|gmail Type of exported address book
+ --type=becky|thunderbird|kmail|gmail|foxmail
+ Type of exported address book
--csv=FILENAME Full path to CSV file
--name="My new address book" Name of new Claws address book (optional)
~;
@@ -213,6 +225,8 @@ sub get_book_name {
return("Kmail address book");
} elsif ($type eq "gmail") {
return("gmail address book");
+ } elsif ($type eq "foxmail") {
+ return("foxmail address book");
}
}
@@ -237,6 +251,11 @@ sub check_fields {
die("ERROR:\n\tInvalid field count!\n"
."\tProblem with your exported CSV file\n");
}
+ } elsif ($type eq "foxmail") {
+ if ($#csvfields != $#foxmail_fields) {
+ die("ERROR:\n\tInvalid field count!\n"
+ ."\tProblem with your exported CSV file\n");
+ }
}
}
@@ -294,6 +313,26 @@ sub write_xml {
."remarks=\"\" /> \n";
}
$xml .= " </address-list> \n";
+ } elsif ($type eq "foxmail") {
+ $xml .= "<address-list>\n ";
+ if ($fields[$std_items[4]] =~ m/,/) {
+ my @addrs = split(",", $fields[$std_items[4]]);
+ my $addr_one = pop(@addrs);
+ $xml .= "<address uid=\"$time\" alias=\"\" "
+ ."email=\"$addr_one\" "
+ ."remarks=\"$fields[$std_items[5]]\" /> \n";
+ foreach my $eaddr (@addrs) {
+ $time++;
+ $xml .= "<address uid=\"$time\" alias=\"\" "
+ ."email=\"$eaddr\" "
+ ."remarks=\"\" /> \n";
+ }
+ } else {
+ $xml .= "<address uid=\"$time\" alias=\"\" "
+ ."email=\"$fields[$std_items[4]]\" "
+ ."remarks=\"$fields[$std_items[5]]\" /> \n";
+ }
+ $xml .= "</address-list> \n";
} else {
$xml .= "<address-list>\n "
."<address uid=\"$time\" alias=\"\" "
@@ -332,6 +371,8 @@ sub get_items {
return ('2','1','6','0','28','34');
} elsif ($type eq "gmail") {
return('0','0','0','0','1','2');
+ } elsif ($type eq "foxmail") {
+ return ('0','1','3','2','4','33');
}
}
@@ -344,6 +385,8 @@ sub get_fields {
return(@kmail_fields);
} elsif ($type eq "gmail") {
return(@gmail_fields);
+ } elsif ($type eq "foxmail") {
+ return(@foxmail_fields);
}
}