[Fwd: Re: [Fwd: Re: [Evolution] export local addressbook to HTML by cron]]



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3-nr1 (Windows XP)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFAuukl/PmuubxPWAIRAsL5AJ43Uc0Y5y2fD3s750ekGCozMBUngACdHw93
pQE8hlYZAdUVWxVVo6r+p5A=
=et4g
-----END PGP SIGNATURE-----
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

|>
|>>Could we see them?
|>
|>After rereading I realize I was not very clear. The Perl and Python
|>scripts do addressbook lookups to do whitelisting against your local evo
|>addressbook. They do not do any web page generation. However you could
|>extended then and generate the required web pages.

The problem I see is that they attacj directly the berkeleydb storage...

therefor, they must know how the data is stored and structured. If the
storage changes, it will break.

- --> I'ld rather have a python wrapper around some evolution addressbook
library, to work at a higher level...

like that:

ebook = ebook_open("local")

for contacts in ebook.contacts:
        ...

Stan.

|>
|>The point I was trying to make was that accessing the data via the
|>Berkley db modules is fairly easy.
|>
|>The scripts I have are:
|>
|>======================================
|>#!/usr/bin/python
|>#
|># Written by Cliff Wells
|>#
|># Used to extract all contacts in Evolution database
|>#
|># via: whitelist.py > whitelist.txt
|>#
|># or to test if sender in in whitelist
|>#
|># via: whitelist.py someone somewhere somedom
|>#
|># Returns 0 if not in contacts, non-zero if in contacts
|>
|>import bsddb, os, re, sys
|>
|>if len(sys.argv) > 1: # return 0 or 1 if arg is in contacts
|>    check = sys.argv[1]
|>else:
|>    check = None      # just dump a list of contacts
|>
|>home = os.getenv('HOME')
|>dbname = '%s/evolution/local/Contacts/addressbook.db' % home
|>
|>db = bsddb.hashopen(dbname, 'r')
|>
|>regex = re.compile('EMAIL;INTERNET:(?P<contact>.*)[\n|$]', re.M)
|>
|>for k in db.keys():
|>    matches = [s.strip() for s in regex.findall(db[k])]
|>    for contact in matches:
|>        if contact:
|>            if check is not None:
|>           # Note: forcing both to lower case to deal with ever changing
|>           #       capitalization in email addresses
|>           lower_check = check.lower()
|>           lower_contact = contact.lower()
|>                if lower_check == lower_contact:
|>                    db.close()
|>                    print contact
|>                    sys.exit(1)
|>            else:
|>                print contact
|>
|>db.close()
|>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3-nr1 (Windows XP)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFAuuj4/PmuubxPWAIRAvl0AJ4nFFd8Ba/jpKHfa7Yst+R8yO+PQACggfG0
Jvu9FYJzypCaZOeCGR+lEE0=
=vJuX
-----END PGP SIGNATURE-----


--- End Message ---


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]