Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Implement one-way contact / calendar syncing

#6

libiphone should be able to read contact / calendars from device and sync them with host.

To fix this ticket, either an OpenSync or Conduit plugin that perform one-way sync must be provided. (Or any other syncing platform solution).

Reported by Jonathan Beck · March 24th, 2009 @ 05:54 PM

State: resolved
Milestone: 1.0 Release
Assigned to: Martin S. Martin S.

Activity

  1. Jonathan Beck
  2. Matt Colyer
    Matt Colyer

    This repo contains a python program which can dump the calendars

    http://git.matt.colyer.name/?p=2009/iphone-calendarsync.git;a=summary

    March 26th, 2009 @ 04:15 AM

  3. Jonathan Beck
    Jonathan Beck
    • Milestone set to 1.0 Release

    April 1st, 2009 @ 10:16 AM

  4. Martin S.
    Martin S.
    • Tag changed from libiphone to libiphone, mobilesync, python

    After fiddling around with Matt's work I ended up with the code below to understand how the synchronization is performed: http://cgit.sukimashita.com/pyth...

    It depends on #35 [PATCH] Fix receive of plists larger than a packet as the sync data can be quite big if you got a lot on the device.

    It is able to retrieve contacts (including photos), calendars and bookmarks from a device and serialize the data according to the data type (iCalendar, vCard, XBEL Bookmarks).

    The mail account data type should work aswell, however I have not yet figured out how to make the sync agent return records for it.

    Removal of all records is implemented but not exposed in the main script.

    The next attempt is to push records to the device which should now be rather trivial.

    Afterwards this should be useful for either a C based implementation in libiphone and/or for use with Conduit.

    April 20th, 2009 @ 10:26 PM

  5. Martin S.
    Martin S.

    It appears mail account sync is a bit "special":

    • pushes only account settings, no mail messages or related
    • can only be "pushed" from the computer to the device (thus one can only sync with one computer as another one would not know about any unique ids associated with a synced mail account)
    • it seems even iTunes doesn't get it right and people encounter a few sync issues (device cancels sync session, record commit fails, ...)
    • one has to remove all accounts on the device before syncing new ones to the device

    A sample mail account record:

    
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <array>
    	<string>SDMessageProcessChanges</string>
    	<string>com.apple.MailAccounts</string>
    	<dict>
    		<key>3E63A1D6-4B7B-686C-BC04-26B0BB3F323E</key>
    		<dict>
    			<key>AuthenticationScheme</key>
    			<string></string>
    			<key>AccountName</key>
    			<string>mail.google.com</string>
    			<key>AccountType</key>
    			<string>SMTPAccount</string>
    			<key>PortNumber</key>
    			<string>25</string>
    			<key>Hostname</key>
    			<string>mail.google.com</string>
    			<key>ShouldUseAuthentication</key>
    			<string>YES</string>
    			<key>uniqueId</key>
    			<key>3E63A1D6-4B7B-686C-BC04-26B0BB3F323E</key>
    		</dict>
    	</dict>
    	<false/>
    	<string>___EmptyParameterString___</string>
    </array>
    </plist>
    

    April 22nd, 2009 @ 07:34 PM

  6. Matt Colyer
    Matt Colyer

    This is quite awesome. I would love to have the protocol to delete, update and add records to the device. I'll see what I can do about #35 [PATCH] Fix receive of plists larger than a packet.

    April 24th, 2009 @ 02:01 AM

  7. Martin S.
    Martin S.

    To delete a record add the record id nodes twice:

    
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <array>
    	<string>SDMessageProcessChanges</string>
    	<string>com.apple.Bookmarks</string>
    	<dict>
    		<key>153E95CE-4813-4265-8E17-B7F10747FFEC</key>
    		<key>153E95CE-4813-4265-8E17-B7F10747FFEC</key>
    	</dict>
    	<false/>
    	<dict>
    		<key>SyncDeviceLinkEntityNamesKey</key>
    		<array>
    			<string>com.apple.bookmarks.Folder</string>
    		</array>
    		<key>SyncDeviceLinkAllRecordsOfPulledEntityTypeSentKey</key>
    		<true/>
    	</dict>
    </array>
    </plist>
    

    To add or update a record, just send the full record data for an id:

    
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <array>
    	<string>SDMessageProcessChanges</string>
    	<string>com.apple.Bookmarks</string>
    	<dict>
    		<key>153E95CE-4813-4265-8E17-B7F10747FFEC</key>
    		<dict>
    			<key>parent</key>
    			<array>
    				<string>81A46F6A-85D3-5D49-94C7-4FCE0BAA84C2</string>
    			</array>
    			<key>position</key>
    			<integer>12</integer>
    			<key>name</key>
    			<string>New Folder</string>
    			<key>com.apple.syncservices.RecordEntityName</key>
    			<string>com.apple.bookmarks.Folder</string>
    		</dict>
    	</dict>
    	<false/>
    	<dict>
    		<key>SyncDeviceLinkEntityNamesKey</key>
    		<array>
    			<string>com.apple.bookmarks.Folder</string>
    		</array>
    		<key>SyncDeviceLinkAllRecordsOfPulledEntityTypeSentKey</key>
    		<true/>
    	</dict>
    </array>
    </plist>
    

    The last node tells the device it should remap ids and report them back.

    The device answers with a SDMessageRemapIdentifiers and a list of key/string pairs which you update your local ids with.

    I thought about storing the first sync in binary plists and use their last file modification time as last sync time for a data storage type. However, I don't know a good way where to pull changes from afterwards.

    Perhaps it would now be the time to rather use this for a Conduit plugin.

    April 24th, 2009 @ 11:06 PM

  8. Jonathan Beck
    Jonathan Beck
    • Assigned user set to Martin S.
    • State changed from new to open

    Hi Martin,

    here is a patch that remove unneeded lxml dependency.

    May 9th, 2009 @ 10:41 AM

  9. Jonathan Beck
    Jonathan Beck

    Here is another one that provides a basic Conduit module for contacts.

    I believe things reach a point where this ticket should be marked as resolved, since all the work left does not affect libiphone (but python-iphonesync)

    May 9th, 2009 @ 10:43 AM

  10. Matt Colyer
    Matt Colyer
    • State changed from open to resolved

    I agree with Jonathan, the additional API was added and there isn't anything to do here now. Feel free to open more tickets as things arise.

    May 9th, 2009 @ 06:07 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.