Re: [NTLK] iCal for Newton

From: Andrew Beals <andrew.beals_at_gmail.com>
Date: Sun Oct 14 2007 - 14:46:11 EDT

On 2007-okt-14, at 11:34, Jon Glass wrote:

> On 10/14/07, Bob Chen <bobchenc@gmail.com> wrote:
>> In the preference of NewtSync I cannot seem to set the Default
>> calender to iCal. so consequently no syncing of dates. Also there
>> seems to be some errors in my addresses that cause the program to
>> terminate by itself. Maybe I need to remove some addresses?
>
> Notes in your Address Book cards. Supposedly, you are allowed 100
> characters, but I found that more than a few characters would cause
> the sync to fail.

Having more than one e-mail address for a person results in the
program bombing. Here's the patch:

diff -rc newtsync 0.3.3/SyncAddressBook.m /Volumes/nSync0.3.3-src/
SyncAddressBook.m
*** newtsync 0.3.3/SyncAddressBook.m Sat Jul 23 23:13:00 2005
--- /Volumes/nSync0.3.3-src/SyncAddressBook.m Fri Nov 12 18:07:53 2004
***************
*** 327,332 ****
--- 327,333 ----
   - (void)populateFieldsInABRecord:(ABPerson *)theABRecord
usingNewtonRecord:(id)theNewtonRecord
   {
         id newtonValue;
+ id subValue;
         ABMutableMultiValue *multiValue;
         NSDictionary *dictValue;
         NSEnumerator *enumerator;
***************
*** 384,401 ****
         if ((newtonValue = [theNewtonRecord
objectForKey:@"emailAddrs"]) && ([newtonValue isKindOfClass:[NSArray
class]])) {
                 enumerator = [newtonValue objectEnumerator];
                 while (obj = [enumerator nextObject]) {
! // 20050723 Andy Beals
! // ensureString returns (NSString *) from (id)
! NSString *subValue;
! if (![obj isKindOfClass:[NSDictionary
class]]) break; // 20050723 Andy Beals: done
! // 20050723 Andy Beals
! // Proper parens (and paying attention to
compiler warnings) ensures that Newton Names
! // entries with two (or more) email addresses
don't blow up nSync!
! if ((subValue = [[self myNewton] ensureString:
[obj objectForKey:@"email"]])
   // 040322 Nowhere Man
   // this additional condition will
   // stop it from tripping over null email addresses
! && (![subValue isEqualToString:@""]) )
                                 [multiValue addValue:subValue
withLabel:kABEmailWorkLabel];
                 }
         }
--- 385,395 ----
         if ((newtonValue = [theNewtonRecord
objectForKey:@"emailAddrs"]) && ([newtonValue isKindOfClass:[NSArray
class]])) {
                 enumerator = [newtonValue objectEnumerator];
                 while (obj = [enumerator nextObject]) {
! if (subValue = [[self myNewton] ensureString:
[obj objectForKey:@"email"]]
   // 040322 Nowhere Man
   // this additional condition will
   // stop it from tripping over null email addresses
! && ![subValue isEqualToString: @""] )
                                 [multiValue addValue:subValue
withLabel:kABEmailWorkLabel];
                 }
         }

====================================================================
The NewtonTalk Mailing List - http://www.newtontalk.net/
The Official Newton FAQ - http://www.splorp.com/newton/faq/
The Newton Glossary - http://www.splorp.com/newton/glossary/
WikiWikiNewt - http://tools.unna.org/wikiwikinewt/
====================================================================
Received on Sun Oct 14 14:46:17 2007

This archive was generated by hypermail 2.1.8 : Sun Oct 14 2007 - 21:30:00 EDT