I am working on a backup method for the open source edition that allows for message level recovery into the existing mailbox. So far I have working:

  1. E-mail (Messages)
  2. Contacts
  3. Conversations


I am now looking into calendar entries. This one is by far the most difficult to understand (for me). My goal is to understand how to pull this off without damage to the database or the users message store. I need to understand the metadata behind a calendar entry, broken out below:

Code:
d2:ad
d5:alarm
d2:ac
1:d
2:tr
5:-PT5M
3:trd
1:s
2:tt
1:r
e7:compNum
i0
e5:invId
i280
e2:na
i1239392400000
e3:nis
i1239392700000
ee3:ape
i1239403500000
e3:aps
i1239392700000
e4:inv0
d2:af
i2
e3:al0
d2:ac
1:d
2:tr
5:-PT5M
3:trd
1:s
2:tt
1:r
e4:byme
5:false
9:clSetByMe
5:false
4:comp
i0
e3:dts
i1239086084000
e2:et
59:TZID=(GMT-06.00) Central Time (US & Canada):20090410T174500
2:fb
1:B
4:frag
0:
5:isOrg
4:true
2:it
i11
e1:l
0:
3:mid
i280
e4:mthd
7:PUBLISH
1:n
8:asdfasdf
5:numAl
i1
e5:numAt
1:0
3:org
d1:a
25:demoagain@example.com
2:cn
10:Demo Again
e4:ptst
2:AC
4:rsvp
5:false
3:seq
i1
e2:st
59:TZID=(GMT-06.00) Central Time (US & Canada):20090410T144500
6:status
4:CONF
2:tr
1:O
3:tzm
d2:#0
d4:d2sr
51:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=11;BYDAY=1SU
4:d2ss
15:19710101T020000
2:do
i-18000000
e2:hd
4:true
4:s2dr
50:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=3;BYDAY=2SU
4:s2ds
15:19710101T020000
2:so
i-21600000
e4:tzid
38:(GMT-06.00) Central Time (US & Canada)
e38:(GMT-06.00) Central Time (US & Canada)
i0
ee1:u
36:d3a26917-af71-4507-84cd-8050d0d1fe9d
e2:nc
i1
e2:rl
d1:n
i0
ee3:tzm
d2:#0
d4:d2sr
51:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=11;BYDAY=1SU
4:d2ss
15:19710101T020000
2:do
i-18000000
e2:hd
4:true
4:s2dr
50:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=3;BYDAY=2SU
4:s2ds
15:19710101T020000
2:so
i-21600000
e4:tzid
38:(GMT-06.00) Central Time (US & Canada)
e38:(GMT-06.00) Central Time (US & Canada)
i0
ee1:u
36:d3a26917-af71-4507-84cd-8050d0d1fe9d
2:ua
45:ZimbraWebClient - IE7 (Win)/5.0.14_GA_2850.F7
1:v
i10
e3:ver
i2
ee
Some of this is pretty clear, others not so much. If anyone is working on a similar project and has deciphered the logic please let me know. I will at least like to know if anyone has pieces of it figured out. This is a pet project, no driving need except that I want to do it, so hobbyist and hackers please feel free to comment.

Also, I know that playing with the database directly can have disastrous consequences, I am well aware that I may be alone here, but like I said I have the above list working well, now I just want to include calendars.

Oh, the database record in question is:

Code:
*************************** 28. row ***************************
  mailbox_id: 6
          id: 281
        type: 11
   parent_id: NULL
   folder_id: 10
    index_id: 281
     imap_id: 281
        date: 1239086084
        size: 2016
   volume_id: 1
 blob_digest: ENfT0UtkyQoCcEta5eVRrsvgRVk=
      unread: NULL
       flags: 8192
        tags: 0
      sender: Demo Again demoagain@example.com
     subject: asdfasdf
        name: NULL
    metadata: d2:add5:alarmd2:ac1:d2:tr5:-PT5M3:trd1:s2:tt1:re7:compNumi0e5:invIdi280e2:nai1239392400000e3:nisi1239392700000ee3:apei1239403500000e3:apsi1239392700000e4:inv0d2:afi2e3:al0d2:ac1:d2:tr5:-PT5M3:trd1:s2:tt1:re4:byme5:false9:clSetByMe5:false4:compi0e3:dtsi1239086084000e2:et59:TZID=(GMT-06.00) Central Time (US & Canada):20090410T1745002:fb1:B4:frag0:5:isOrg4:true2:iti11e1:l0:3:midi280e4:mthd7:PUBLISH1:n8:asdfasdf5:numAli1e5:numAt1:03:orgd1:a25:demoagain@example.com2:cn10:Demo Againe4:ptst2:AC4:rsvp5:false3:seqi1e2:st59:TZID=(GMT-06.00) Central Time (US & Canada):20090410T1445006:status4:CONF2:tr1:O3:tzmd2:#0d4:d2sr51:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=11;BYDAY=1SU4:d2ss15:19710101T0200002:doi-18000000e2:hd4:true4:s2dr50:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=3;BYDAY=2SU4:s2ds15:19710101T0200002:soi-21600000e4:tzid38:(GMT-06.00) Central Time (US & Canada)e38:(GMT-06.00) Central Time (US & Canada)i0ee1:u36:d3a26917-af71-4507-84cd-8050d0d1fe9de2:nci1e2:rld1:ni0ee3:tzmd2:#0d4:d2sr51:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=11;BYDAY=1SU4:d2ss15:19710101T0200002:doi-18000000e2:hd4:true4:s2dr50:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=3;BYDAY=2SU4:s2ds15:19710101T0200002:soi-21600000e4:tzid38:(GMT-06.00) Central Time (US & Canada)e38:(GMT-06.00) Central Time (US & Canada)i0ee1:u36:d3a26917-af71-4507-84cd-8050d0d1fe9d2:ua45:ZimbraWebClient - IE7 (Win)/5.0.14_GA_2850.F71:vi10e3:veri2ee
mod_metadata: 57
 change_date: 1239086084
 mod_content: 57