#6 ✓resolved
Jonathan Beck

Implement one-way contact / calendar syncing

Reported by Jonathan Beck | March 24th, 2009 @ 05:54 PM | in 1.0 Release

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).

Comments and changes to this ticket

  • Jonathan Beck

    Jonathan Beck March 24th, 2009 @ 05:58 PM

    • Tag set to libiphone
  • Matt Colyer

    Matt Colyer March 26th, 2009 @ 04:15 AM

    This repo contains a python program which can dump the calendars

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

  • Jonathan Beck

    Jonathan Beck April 1st, 2009 @ 10:16 AM

    • Milestone set to 1.0 Release
  • Martin S.

    Martin S. April 20th, 2009 @ 10:26 PM

    • 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 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.

  • Martin S.

    Martin S. April 22nd, 2009 @ 07:34 PM

    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>
    
  • Matt Colyer

    Matt Colyer April 24th, 2009 @ 02:01 AM

    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.

  • Martin S.

    Martin S. April 24th, 2009 @ 11:06 PM

    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.

  • Jonathan Beck

    Jonathan Beck May 9th, 2009 @ 10:41 AM

    • Assigned user set to “Martin S.”
    • State changed from “new” to “open”

    Hi Martin,

    here is a patch that remove unneeded lxml dependency.

  • Jonathan Beck

    Jonathan Beck May 9th, 2009 @ 10:43 AM

    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)

  • Matt Colyer

    Matt Colyer May 9th, 2009 @ 06:07 PM

    • 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.

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.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

A project around supporting the iPhone in Linux.

See http://libimobiledevice.org

People watching this ticket

Referenced by

Pages