From 6fb7fedb35167b6f3b3f6b1c226cee2bbc356eaa Mon Sep 17 00:00:00 2001 From: Paul Mangan Date: Fri, 6 Sep 2002 09:51:01 +0000 Subject: [PATCH 1/1] remove ldif-to-xml.py --- tools/Makefile.am | 1 - tools/README | 26 ----------- tools/ldif-to-xml.py | 102 ------------------------------------------- 3 files changed, 129 deletions(-) delete mode 100644 tools/ldif-to-xml.py diff --git a/tools/Makefile.am b/tools/Makefile.am index 1051725ec..ed91ebcab 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -6,7 +6,6 @@ EXTRA_TOOLS = \ gif2xface.pl \ gpg-sign-syl \ kmail2sylpheed.pl \ - ldif-to-xml.py \ newscache_clean.pl \ outlook2sylpheed.pl \ sylpheed-switcher \ diff --git a/tools/README b/tools/README index 588ce1828..6dd852f35 100644 --- a/tools/README +++ b/tools/README @@ -134,32 +134,6 @@ ----------------------------------------------------------------------- -* ldif-to-xml.py - - WHAT IT DOES - - This python script converts the netscape ldif format address book to - the sylpheed xml format. - - HOW TO USE IT - - Inside Netscape export your address book to a file. - From the command line, execute: - - ./ldif-to-xml.py - - In case of trouble, just invoke your python interpreter directly: - - python ldif-to-xml.py - - Either way a file called addressbook.xml will be generated in the current - directory. This xml file should be merged with or simply placed in the - $HOME/.sylpheed directory. - - Any problems, contact Rod Senra - ------------------------------------------------------------------------ - * newscache_clean.pl WHAT IT DOES AND WHY IT DOES IT diff --git a/tools/ldif-to-xml.py b/tools/ldif-to-xml.py deleted file mode 100644 index bfafdfe16..000000000 --- a/tools/ldif-to-xml.py +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/env python - -# * Copyright 2001 Rod Senra -# * -# * This file 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 2 of the License, 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. -# * -# * You should have received a copy of the GNU General Public License -# * along with this program; if not, write to the Free Software -# * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# * - -import re -import sys - -header = """ - - - -""" - -footer = """ - - - - - - -""" - -def printGroupRec(fd,name,members): - """ Print XML group record from r-tuple""" - fd.write(" \n"%(name)) - for each in members: - printRec(fd,each," ") - fd.write(" \n") - -def printRec(fd,r,ident): - """ Print XML group record from r-tuple""" - fd.write("%s\n"%(ident) ) - fd.write("%s %s\n"%(ident,r[0])) - fd.write("%s
%s
\n"%(ident,r[1])) - fd.write("%s %s\n"%(ident,r[2])) - fd.write("%s
\n"%(ident)) - -outfd = open('addressbook.xml','w') - - -outfd.write(header) -try: - rec = {} - for line in open(sys.argv[1]).readlines(): - line = line[:-1].strip() # clean string - if line=='': - try: - if rec.has_key('description'): - str = rec['description'] - elif rec.has_key('xmozillanickname'): - str = rec['xmozillanickname'] - elif rec.has_key('sn'): - str = rec['sn'] - else: - str = '' - try: - if rec.has_key('member'): - printGroupRec(outfd,rec['cn'].strip(),rec['member']) - elif rec.has_key('mail'): - printRec(outfd,(rec['cn'].strip(),rec['mail'].strip(),str.strip())," ") - - except KeyError: - pass - finally: - del rec - rec = {} - continue - - try: # parse line - key,value = line.split(':') - except: - continue - if key=='member': - name,addr = value.split(',') - name = name.split('=')[1].strip() - addr = addr.split('=')[1].strip() - value = (name,addr,'') - if rec.has_key('member'): - rec['member'].append(value) - else : - rec['member'] = [value] - else: - rec[key]=value - -finally: - outfd.write(footer) - outfd.close() -- 2.25.1