commit 8136f9450ae392e8a9a6a41278ce8d9006944481
parent 14bc093e253b63ad536d88ffb34e268f1aa2e9a3
Author: Paul Mangan <paul@claws-mail.org>
Date: Tue, 19 Feb 2008 06:55:21 +0000
2008-02-19 [paul] 3.3.0cvs17
* tools/README
* tools/csv2addressbook.pl
add support for Kmail/Kaddressbook
Diffstat:
5 files changed, 57 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,9 @@
+2008-02-19 [paul] 3.3.0cvs17
+
+ * tools/README
+ * tools/csv2addressbook.pl
+ add support for Kmail/Kaddressbook
+
2008-02-18 [colin] 3.3.0cvs16
* src/imap.c
diff --git a/PATCHSETS b/PATCHSETS
@@ -3230,3 +3230,4 @@
( cvs diff -u -r 1.75.2.55 -r 1.75.2.56 src/matcher.c; ) > 3.3.0cvs14.patchset
( cvs diff -u -r 1.75.2.56 -r 1.75.2.57 src/matcher.c; ) > 3.3.0cvs15.patchset
( cvs diff -u -r 1.179.2.210 -r 1.179.2.211 src/imap.c; cvs diff -u -r 1.115.2.187 -r 1.115.2.188 src/main.c; cvs diff -u -r 1.204.2.161 -r 1.204.2.162 src/prefs_common.c; cvs diff -u -r 1.103.2.104 -r 1.103.2.105 src/prefs_common.h; cvs diff -u -r 1.1.2.44 -r 1.1.2.45 manual/advanced.xml; ) > 3.3.0cvs16.patchset
+( cvs diff -u -r 1.30.2.26 -r 1.30.2.27 tools/README; cvs diff -u -r 1.1.2.1 -r 1.1.2.2 tools/csv2addressbook.pl; ) > 3.3.0cvs17.patchset
diff --git a/configure.ac b/configure.ac
@@ -11,7 +11,7 @@ MINOR_VERSION=3
MICRO_VERSION=0
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=16
+EXTRA_VERSION=17
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
diff --git a/tools/README b/tools/README
@@ -14,7 +14,7 @@ Action scripts:
OpenOffice
Addressbook conversion:
- csv2addressbook.pl Import Becky or Thunderbird address books
+ csv2addressbook.pl Import Becky, Thunderbird or Kmail 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 +142,8 @@ Address book conversion
* csv2addressbook.pl
WHAT IT DOES
- This perl script will import a Becky address book and a Thunderbird
- address book.
+ This perl script will import a Becky, Thunderbird and Kmail address
+ book.
HOW TO USE IT
(You must run claws-mail at least once before running this script.)
@@ -175,6 +175,21 @@ Address book conversion
you don't use this option the new Claws address book will be
called 'Thunderbird address book'.
+ Kmail >= 1.9.7 / Kaddressbook >= 3.5.7
+ --------------------------------------
+ In Kaddressbook you need to export your address as 'CSV List'.
+
+ Run the script with the following options:
+
+ perl csv2addressbook.pl --type=kmail --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 'Kmail address book'.
+
+ WARNING: Kmail/Kaddressbook has a bug whereby it exports badly
+ formatted CSV if the values are quoted.
+
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
@@ -18,7 +18,7 @@ use Text::CSV_XS;
# * along with this program; if not, write to the Free Software
# * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# *
-# * Copyright 2007 Paul Mangan <paul@claws-mail.org>
+# * Copyright 2007/2008 Paul Mangan <paul@claws-mail.org>
# *
#
@@ -26,10 +26,13 @@ use Text::CSV_XS;
# Supported address books:
# Becky >= 2.41
# Thunderbird >= 2.0.0.6
+# Kmail >= 1.9.7 / Kaddressbook >= 3.5.7
+# ** kmail bug: can export badly formatted csv **
#
# Becky: full export with titles
# thunderbird: export as 'comma separated'
+# kmail/kaddressbook: Export CSV list
###
my $quote_char = '"';
@@ -43,7 +46,7 @@ my $csvfile = '';
my $bookname = '';
my $iNeedHelp = '';
-my $known_types = qr/^(?:becky|thunderbird)$/;
+my $known_types = qr/^(?:becky|thunderbird|kmail)$/;
GetOptions("type=s" => \$type,
"csv=s" => \$csvfile,
@@ -65,6 +68,20 @@ my @tbird_fields = ('First Name','Last Name','Display Name','Nickname',
'Job Title','Department','Organization','Web Page 1',
'Web Page 2','Birth Year','Birth Month','Birth Day',
'Custom 1','Custom 2','Custom 3','Custom 4','Notes','junk');
+my @kmail_fields = ('Formatted Name','Family Name','Given Name',
+ 'Additional Names','Honorific Prefixes','Honorific Suffixes',
+ 'Nick Name','Birthday','Home Address Street',
+ 'Home Address City','Home Address Region',
+ 'Home Address Post Code','Home Address Country',
+ 'Home Address Label','Business Address Street',
+ 'Business Address City','Business Address Region',
+ 'Business Address Post Code','Business Address Country',
+ 'Business Address Label','Home Phone','Business Phone',
+ 'Mobile Phone','Home Fax','Business Fax','Car Phone','ISDN',
+ 'Pager','Email Address','Mail Client','Title','Role',
+ 'Organisation','Department','Note','Homepage','Profession',
+ 'Assistant\'s Name','Manager\'s Name','Partner\'s Name',
+ 'Office','IM Address','Anniversary','Blog');
if (grep m/claws-mail/ => `ps -U $ENV{USER}`) {
die("You must quit claws-mail before running this script\n");
@@ -87,7 +104,7 @@ Usage:
$script [OPTIONS]
Options:
--help Show this screen
- --type=becky|thunderbird Type of exported address book
+ --type=becky|thunderbird|kmail Type of exported address book
--csv=FILENAME Full path to CSV file
--name="My new address book" Name of new Claws address book (optional)
~;
@@ -184,6 +201,8 @@ sub get_book_name {
return("Becky address book");
} elsif ($type eq "thunderbird") {
return("Thunderbird address book");
+ } elsif ($type eq "kmail") {
+ return("Kmail address book");
}
}
@@ -198,6 +217,11 @@ sub check_fields {
die("ERROR:\n\tNot enough fields!\n"
."\tProblem with your exported CSV file\n");
}
+ } elsif ($type eq "kmail") {
+ if ($#csvfields != $#kmail_fields) {
+ die("ERROR:\n\tNot enough fields!\n"
+ ."\tProblem with your exported CSV file\n");
+ }
}
}
@@ -289,6 +313,8 @@ sub get_items {
return ('10','9','2','0','1','4');
} elsif ($type eq "thunderbird") {
return ('0','1','3','2','4','5','38');
+ } elsif ($type eq "kmail") {
+ return ('2','1','6','0','28','34');
}
}
@@ -297,6 +323,8 @@ sub get_fields {
return(@becky_fields);
} elsif ($type eq "thunderbird") {
return(@tbird_fields);
+ } elsif ($type eq "kmail") {
+ return(@kmail_fields);
}
}