#!/usr/bin/perl
# Kyle Davenport kdd@quickening.zapto.org
#
# requires: openldap-clients
# expects: ldap entries in standard netscape addressbook format, eg,
# cn=newNetscapeAddress, ou=Addressbook, o=quickening,c=US
# givenname=givenname
# sn=sirname
# objectclass=top
# objectclass=person
# objectclass=organizationalPerson
# facsimiletelephonenumber=facsimiletelephonenumber
# mail=mail
# homephone=homephone
# telephonenumber=telephonenumber
# cellphone=cellphone
# birthday=birthday
# pagerphone=pagerphone
# streetaddress=streetaddress
# l=location
# postalcode=postalcode
# st=state
# countryname=countryname
# nickname=nickname
# description=description
# homeurl=homeurl
# title=title
# xmozillanickname=xmozillanickname
# xmozillaanyphone=xmozillaanyphone
# xmozillausehtmlmail=xmozillausehtmlmail
#
#
# This script will dump an ldap addressbook into a format for the Sharp SL-5x00's addressbook.
# Copy standardout to qtopiadesktop's directory = ~/.palmtopcenter/addressbook/addressbook.xml
# on the SL-5x00 and run qtopia. It will reformat and add unique tags to the addressbook.
# Then just sync with the zaurus. Alternately, just the contacts can be inserted into an
# existing addressbook.xml file.
# >>> Backup your old addressbook first !
#
# Zaurus addressbook expects entries like this:
#
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 1, or (at your option) any
# later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
# the GNU General Public License for more details.
# Changes
# v 0.01 inital release
#
use Net::LDAP qw(:all);
$basename = "o=quickening,c=US";
$hostname = "quickening.zapto.org";
#$filter = "ou=Addressbook";
$filter = "ou=ou";
open DB,"ldapsearch -b \'$basename\' -h \'$hostname\' \'$filter\'|" or die "ouch!";
print STDERR "skipping:\n";
print "\n";
print "\n";
print " 13\n";
print "\n";
print " \n";
print " \n";
print " ){
chomp;
if ((/^$/) or eof()){
print " />\n";
$fn = "";
}
else {
s/"/"/g;
s/</g;
s/>/>/g;
case: {
/$basename/ && do { print "\n";
print "\n";