[Davical-general] Export to SquirrelMail address book

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[Davical-general] Export to SquirrelMail address book

Pander
Hi all,

The next couple of days I have some time and would really like to create
an automated export via cron from my DAViCAL CardDAV account to my
SquirrelMail account address book. The user story with justification is as
follows:

"AS a user of SquirrelMail and DAViCal with CardDAV
I WOULD LIKE TO have an up to date copy of all the contacts with email
addresses and telehone numbers
WHEN I use my SquirrelMail address book
IN ORDER TO have access to my contacts in a situation where I am using
webmail and do not have access to desktop applications such as Thunderbird
or mobile applications that have direct access to CardDAV."

So far I have figured out that SquirrelMail address books are stored as a
file. The path is
  /var/lib/squirrelmail/data/USERNAME.abook
with USERNAME your SquirrelMail username which usually in lower case.

The file format is as follows:
  |Nick|First|Last|Email|Info|
where
  Nick: required, unique and no spaces
  First: optional
  Last: optional
  Email: required
  Info: optional

The export will process all contacts and create an address book entry for
SquirellMail for each email address and/or telephone number in CardDAV via
the following pseudocode scheme where all lower case variables are from
CardDAV, capitalised variables are for SquirrelMail output format. Because
preferred email and additional email can be switched around for work or
home according to the client that manages the CardDAV data, I have chosen
for the following approach for implementation.

# initialisation
Abook = []
First = ''
Last = ''
Nick = ''
Email = ''
Info = ''

# use Info for all telephone numbers
first = True
if mopbtel:
  if first:
    first = False
  else:
    Info += ' '
  Info += 'M:'+ mobtel
if hometel:
  if first:
    first = False
  else:
    Info += ' '
  Info += 'H:'+ mobtel
if worktel:
  if first:
    first = False
  else:
    Info += ' '
  Info += 'W:'+ mobtel
if faxtel:
  if first:
    first = False
  else:
    Info += ' '
  Info += 'F:'+ mobtel

# entry for preferred email
if prefemail:
  Email = prefemail.strip()
  if first and not last:
    First = first.strip()
    Nick = first.strip()
  if not first and last:
    Last = last.strip()
    Nick = last.strip()
  if first and last:
    First = first.strip()
    Last = last.strip()
    Nick = first.strip().replace(' ','') + last.strip().replace(' ','')
  else:
    Nick = Email
  if Nick in Abook:
    logWarning
  else:
    aBook[Nick] = Nick+'|'+First+'|'+Last+'|'+Email+'|'+Info

# entry for other email
Email = ''
if addtionalemail:
  Email = additionalemail.strip()
  if not first and not last:
    Nick = Email
  Nick += 'Add'
  if Nick in Abook:
    logWarning
  else:
    aBook[Nick] = Nick+'|'+First+'|'+Last+'|'+Email+'|'+Info

# write address book
for a in sorted(aBook.keys()]:
  write aBook[key]

Would anyone like to help out with this? I need help especially on how to
iterate over the CardDAV data for a certain user (preferably from Python).
Who is also in need of this addition to DAViCal?

Regards, Pander


------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
Davical-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/davical-general
Reply | Threaded
Open this post in threaded view
|

Re: Export to SquirrelMail address book

Pander
The formatting of the pseudo code got messed up and I have some I provements. Will publish prototype on git hub later. Still in need of some pointers to be able to digest DAViCal database.

Pander <[hidden email]> wrote:

>Hi all,
>
>The next couple of days I have some time and would really like to
>create
>an automated export via cron from my DAViCAL CardDAV account to my
>SquirrelMail account address book. The user story with justification is
>as
>follows:
>
>"AS a user of SquirrelMail and DAViCal with CardDAV
>I WOULD LIKE TO have an up to date copy of all the contacts with email
>addresses and telehone numbers
>WHEN I use my SquirrelMail address book
>IN ORDER TO have access to my contacts in a situation where I am using
>webmail and do not have access to desktop applications such as
>Thunderbird
>or mobile applications that have direct access to CardDAV."
>
>So far I have figured out that SquirrelMail address books are stored as
>a
>file. The path is
>  /var/lib/squirrelmail/data/USERNAME.abook
>with USERNAME your SquirrelMail username which usually in lower case.
>
>The file format is as follows:
>  |Nick|First|Last|Email|Info|
>where
>  Nick: required, unique and no spaces
>  First: optional
>  Last: optional
>  Email: required
>  Info: optional
>
>The export will process all contacts and create an address book entry
>for
>SquirellMail for each email address and/or telephone number in CardDAV
>via
>the following pseudocode scheme where all lower case variables are from
>CardDAV, capitalised variables are for SquirrelMail output format.
>Because
>preferred email and additional email can be switched around for work or
>home according to the client that manages the CardDAV data, I have
>chosen
>for the following approach for implementation.
>
># initialisation
>Abook = []
>First = ''
>Last = ''
>Nick = ''
>Email = ''
>Info = ''
>
># use Info for all telephone numbers
>first = True
>if mopbtel:
>  if first:
>    first = False
>  else:
>    Info += ' '
>  Info += 'M:'+ mobtel
>if hometel:
>  if first:
>    first = False
>  else:
>    Info += ' '
>  Info += 'H:'+ mobtel
>if worktel:
>  if first:
>    first = False
>  else:
>    Info += ' '
>  Info += 'W:'+ mobtel
>if faxtel:
>  if first:
>    first = False
>  else:
>    Info += ' '
>  Info += 'F:'+ mobtel
>
># entry for preferred email
>if prefemail:
>  Email = prefemail.strip()
>  if first and not last:
>    First = first.strip()
>    Nick = first.strip()
>  if not first and last:
>    Last = last.strip()
>    Nick = last.strip()
>  if first and last:
>    First = first.strip()
>    Last = last.strip()
>    Nick = first.strip().replace(' ','') + last.strip().replace(' ','')
>  else:
>    Nick = Email
>  if Nick in Abook:
>    logWarning
>  else:
>    aBook[Nick] = Nick+'|'+First+'|'+Last+'|'+Email+'|'+Info
>
># entry for other email
>Email = ''
>if addtionalemail:
>  Email = additionalemail.strip()
>  if not first and not last:
>    Nick = Email
>  Nick += 'Add'
>  if Nick in Abook:
>    logWarning
>  else:
>    aBook[Nick] = Nick+'|'+First+'|'+Last+'|'+Email+'|'+Info
>
># write address book
>for a in sorted(aBook.keys()]:
>  write aBook[key]
>
>Would anyone like to help out with this? I need help especially on how
>to
>iterate over the CardDAV data for a certain user (preferably from
>Python).
>Who is also in need of this addition to DAViCal?
>
>Regards, Pander
>
>
>------------------------------------------------------------------------------
>Try New Relic Now & We'll Send You this Cool Shirt
>New Relic is the only SaaS-based application performance monitoring
>service
>that delivers powerful full stack analytics. Optimize and monitor your
>browser, app, & servers with just a few lines of code. Try New Relic
>and get this awesome Nerd Life shirt!
>http://p.sf.net/sfu/newrelic_d2d_apr
>_______________________________________________
>Davical-general mailing list
>[hidden email]
>https://lists.sourceforge.net/lists/listinfo/davical-general


------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
Davical-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/davical-general
Reply | Threaded
Open this post in threaded view
|

Re: Export to SquirrelMail address book

Pander
On 04/29/2013 05:42 PM, Pander wrote:
> The formatting of the pseudo code got messed up and I have some I provements. Will publish prototype on git hub later. Still in need of some pointers to be able to digest DAViCal database.
>

Here is a test with working write:
  https://github.com/PanderMusubi/davical2abook/blob/master/test.py
All I need is a working reader via psycopg of davical database. Help is
welcome. :)

I have discovered that I need tables
  addressbook_address_tel
  addressbook_address_email
  addressbook_resource
but don't know how to link the records to a DAViCal username.

> Pander <[hidden email]> wrote:
>
>> Hi all,
>>
>> The next couple of days I have some time and would really like to
>> create
>> an automated export via cron from my DAViCAL CardDAV account to my
>> SquirrelMail account address book. The user story with justification is
>> as
>> follows:
>>
>> "AS a user of SquirrelMail and DAViCal with CardDAV
>> I WOULD LIKE TO have an up to date copy of all the contacts with email
>> addresses and telehone numbers
>> WHEN I use my SquirrelMail address book
>> IN ORDER TO have access to my contacts in a situation where I am using
>> webmail and do not have access to desktop applications such as
>> Thunderbird
>> or mobile applications that have direct access to CardDAV."
>>
>> So far I have figured out that SquirrelMail address books are stored as
>> a
>> file. The path is
>>  /var/lib/squirrelmail/data/USERNAME.abook
>> with USERNAME your SquirrelMail username which usually in lower case.
>>
>> The file format is as follows:
>>  |Nick|First|Last|Email|Info|
>> where
>>  Nick: required, unique and no spaces
>>  First: optional
>>  Last: optional
>>  Email: required
>>  Info: optional
>>
>> The export will process all contacts and create an address book entry
>> for
>> SquirellMail for each email address and/or telephone number in CardDAV
>> via
>> the following pseudocode scheme where all lower case variables are from
>> CardDAV, capitalised variables are for SquirrelMail output format.
>> Because
>> preferred email and additional email can be switched around for work or
>> home according to the client that manages the CardDAV data, I have
>> chosen
>> for the following approach for implementation.
>>
>> # initialisation
>> Abook = []
>> First = ''
>> Last = ''
>> Nick = ''
>> Email = ''
>> Info = ''
>>
>> # use Info for all telephone numbers
>> first = True
>> if mopbtel:
>>  if first:
>>    first = False
>>  else:
>>    Info += ' '
>>  Info += 'M:'+ mobtel
>> if hometel:
>>  if first:
>>    first = False
>>  else:
>>    Info += ' '
>>  Info += 'H:'+ mobtel
>> if worktel:
>>  if first:
>>    first = False
>>  else:
>>    Info += ' '
>>  Info += 'W:'+ mobtel
>> if faxtel:
>>  if first:
>>    first = False
>>  else:
>>    Info += ' '
>>  Info += 'F:'+ mobtel
>>
>> # entry for preferred email
>> if prefemail:
>>  Email = prefemail.strip()
>>  if first and not last:
>>    First = first.strip()
>>    Nick = first.strip()
>>  if not first and last:
>>    Last = last.strip()
>>    Nick = last.strip()
>>  if first and last:
>>    First = first.strip()
>>    Last = last.strip()
>>    Nick = first.strip().replace(' ','') + last.strip().replace(' ','')
>>  else:
>>    Nick = Email
>>  if Nick in Abook:
>>    logWarning
>>  else:
>>    aBook[Nick] = Nick+'|'+First+'|'+Last+'|'+Email+'|'+Info
>>
>> # entry for other email
>> Email = ''
>> if addtionalemail:
>>  Email = additionalemail.strip()
>>  if not first and not last:
>>    Nick = Email
>>  Nick += 'Add'
>>  if Nick in Abook:
>>    logWarning
>>  else:
>>    aBook[Nick] = Nick+'|'+First+'|'+Last+'|'+Email+'|'+Info
>>
>> # write address book
>> for a in sorted(aBook.keys()]:
>>  write aBook[key]
>>
>> Would anyone like to help out with this? I need help especially on how
>> to
>> iterate over the CardDAV data for a certain user (preferably from
>> Python).
>> Who is also in need of this addition to DAViCal?
>>
>> Regards, Pander
>>
>>
>> ------------------------------------------------------------------------------
>> Try New Relic Now & We'll Send You this Cool Shirt
>> New Relic is the only SaaS-based application performance monitoring
>> service
>> that delivers powerful full stack analytics. Optimize and monitor your
>> browser, app, & servers with just a few lines of code. Try New Relic
>> and get this awesome Nerd Life shirt!
>> http://p.sf.net/sfu/newrelic_d2d_apr
>> _______________________________________________
>> Davical-general mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/davical-general
>
>
> ------------------------------------------------------------------------------
> Try New Relic Now & We'll Send You this Cool Shirt
> New Relic is the only SaaS-based application performance monitoring service
> that delivers powerful full stack analytics. Optimize and monitor your
> browser, app, & servers with just a few lines of code. Try New Relic
> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
> _______________________________________________
> Davical-general mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/davical-general
>


------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
Davical-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/davical-general
Reply | Threaded
Open this post in threaded view
|

Re: Export to SquirrelMail address book

Vincent Van Houtte
Hi,

> All I need is a working reader via psycopg of davical database. Help
> is
> welcome. :)
>
> I have discovered that I need tables
>   addressbook_address_tel
>   addressbook_address_email
>   addressbook_resource
> but don't know how to link the records to a DAViCal username.

Although technically perfectly possible, wouldn't it be better to read
all the resources via DAV?

If you insist on digging in the DB directly, I guess you could have a
look at the Davical-code to figure out the relations between those three
tables. I have no experience doing this, so I wouldn't be of any help to
you.

--
Mvg,
Vincent Van Houtte
Advocaat
Advocatenkantoor Suy, Van Baeveghem & Van Houtte
Brusselsestraat 108
9200 Dendermonde
T 052 52 06 05
F 052 52 06 46
W http://synergylaw.be

------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1
_______________________________________________
Davical-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/davical-general
Reply | Threaded
Open this post in threaded view
|

Re: Export to SquirrelMail address book

Pander
On 04/30/2013 08:56 AM, Vincent Van Houtte wrote:

> Hi,
>
>> All I need is a working reader via psycopg of davical database. Help
>> is
>> welcome. :)
>>
>> I have discovered that I need tables
>>   addressbook_address_tel
>>   addressbook_address_email
>>   addressbook_resource
>> but don't know how to link the records to a DAViCal username.
>
> Although technically perfectly possible, wouldn't it be better to read
> all the resources via DAV?
>
> If you insist on digging in the DB directly, I guess you could have a
> look at the Davical-code to figure out the relations between those three
> tables. I have no experience doing this, so I wouldn't be of any help to
> you.
>

Hi all,

I have a working version, please see
  https://github.com/PanderMusubi/davical2abook

If someone would like to improve it or support other output formats,
please contribute.

Regards,

Pander

------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1
_______________________________________________
Davical-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/davical-general
Reply | Threaded
Open this post in threaded view
|

Re: Export to SquirrelMail address book

Narcis Garcia - GiLUG
In reply to this post by Vincent Van Houtte
Hello Pander,
Developing this tool as a SquirrelMail plugin, will make sure that a lot
of people will use it widely, and there will be more improvements.


Al 30/04/13 19:16, En/na Pander ha escrit:

>
> Hi all,
>
> I have a working version, please see
>   https://github.com/PanderMusubi/davical2abook
>
> If someone would like to improve it or support other output formats,
> please contribute.
>
> Regards,
>
> Pander
>
> ------------------------------------------------------------------------------


------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1
_______________________________________________
Davical-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/davical-general