Fix multi-calendar using & sync
commiteb4d68df8d06f734e79e13ea05f7755aa5b0a5f3
authorNicolas VIVIEN <nicolas@vivien.fr>
Wed, 26 May 2010 17:18:09 +0000 (26 19:18 +0200)
committerNicolas VIVIEN <nicolas@vivien.fr>
Sat, 29 May 2010 13:58:06 +0000 (29 15:58 +0200)
tree3f27f101aa261eb227efda87e5873bfe228a9af0
parentfdada6d52b7b116edd8613d3e6f995ed8644ec0f
Fix multi-calendar using & sync

With the new devices, we can have several calendar database. We have one
calendar per mails account.

If I sync calendar, it's OK the first time :
    1°/ a) Evolution : add a new event
        b) BlackBerry : empty (event isn't still knonw)
    2°/ run sync
    3°/ a) Evolution : event (no changement)
        b) BlackBerry : new event is added in the default calendar (OK)
    4°/ a) Evolution : edit the event
        b) BlackBerry : no modification
    5°/ run sync
    6°/ a) Evolution : event (no changement)
        b) BlackBerry : event is synced, but we loose the calendar link !

    6°/ b) => KO.

Other test case :
    1°/ a) Evolution : empty (event isn't still known)
        b) BlackBerry : add a new event associated to a mails account
    2°/ run sync
    3°/ a) Evolution : new event is added in the default calendar (OK)
        b) BlackBerry : event (no changement)
    4°/ a) Evolution : edit the event
        b) BlackBerry : no modification
    5°/ run sync
    6°/ a) Evolution : event (no changement)
        b) BlackBerry : event is synced, but we loose the calendar link !

To illustrate it :
+ Create calendar entry on the BlackBerry :
Calendar entry: 0x5b17e358 (5)
   All Day Event: no
   Class: Public
   Free/Busy: Busy
   Subject: Test
   Location: Home
   Notification Time: Sat May 29 09:45:00 2010
   Start Time: Sat May 29 10:00:00 2010
   End Time: Sat May 29 11:00:00 2010
   Recurring: no
Unknowns:
Type: 0x2a Data:
00000000: 36 35 36 33 39 36 34 39 34 31 39 35 30 37 37 32  6563964941950772
00000010: 30 35 35 00                                      055.
Type: 0x2b Data:
00000000: 64 71 2d 92 ec f0 93 bf                          dq-.....
              <== seems to the calendar link
Type: 0x2c Data:
00000000: ff ff ff ff ff ff ff ff                          ........
Type: 0x12 Data:
00000000: 00 00 00 00                                      ....
Type: 0x1b Data:
00000000: 0c 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00  ................

+ Sync after Evolution editing :
Calendar entry: 0x5b17e358 (5)
   All Day Event: no
   Class: Public
   Free/Busy: Free
   Subject: Test modif
   Location: Home
   Notification Time: Sat May 29 09:45:00 2010
   Start Time: Sat May 29 10:00:00 2010
   End Time: Sat May 29 11:00:00 2010
   Recurring: no
Unknowns:
Type: 0x2a Data:
00000000: 36 35 36 33 39 36 34 39 35 39 31 33 30 36 34 31  6563964959130641
00000010: 32 34 33 00                                      243.
Type: 0x2b Data:
00000000: ff ff ff ff ff ff ff ff                          ........
              <== information lost !
Type: 0x2c Data:
00000000: ff ff ff ff ff ff ff ff                          ........
Type: 0x12 Data:
00000000: 00 00 00 00                                      ....
Type: 0x1b Data:
00000000: 0c 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00  ................

So, fix create a new CalendarID field "0x2b", by default is set to '-1'
and not used. If we detect that this field exists and is different to
'-1', we use this field (permit to compliant with old devices)
opensync-plugin-0.4x/src/vevent.cc
opensync-plugin-0.4x/src/vevent.h
src/r_calendar.cc
src/r_calendar.h