Added more props and cleaned up the code

pull/17/head
Ludovic Marcotte 2014-01-23 09:41:41 -05:00
parent feb398d59c
commit aa18abd842
1 changed files with 34 additions and 17 deletions

View File

@ -47,31 +47,40 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- (NSString *) activeSyncRepresentation - (NSString *) activeSyncRepresentation
{ {
NSMutableString *s; NSMutableString *s;
id o;
int v; int v;
s = [NSMutableString string]; s = [NSMutableString string];
// Complete // Complete
NSCalendarDate *completed; o = [self completed];
completed = [self completed]; [s appendFormat: @"<Complete xmlns=\"Tasks:\">%d</Complete>", (o ? 1 : 0)];
[s appendFormat: @"<Complete xmlns=\"Tasks:\">%d</Complete>", (completed ? 1 : 0)];
// DateCompleted // DateCompleted
if (completed) if (o)
[s appendFormat: @"<DateCompleted xmlns=\"Tasks:\">%@</DateCompleted>", [completed activeSyncRepresentation]]; [s appendFormat: @"<DateCompleted xmlns=\"Tasks:\">%@</DateCompleted>", [o activeSyncRepresentation]];
// Start date
if ((o = [self startDate]))
{
[s appendFormat: @"<StartDate xmlns=\"Tasks:\">%@</StartDate>", [o activeSyncRepresentation]];
[s appendFormat: @"<UTCStartDate xmlns=\"Tasks:\">%@</UTCStartDate>", [o activeSyncRepresentation]];
}
// Due date // Due date
NSCalendarDate *due; if ((o = [self due]))
due = [self due]; {
if (due) [s appendFormat: @"<DueDate xmlns=\"Tasks:\">%@</DueDate>", [o activeSyncRepresentation]];
[s appendFormat: @"<DueDate xmlns=\"Tasks:\">%@</DueDate>", [due activeSyncRepresentation]]; [s appendFormat: @"<UTCDueDate xmlns=\"Tasks:\">%@</UTCDueDate>", [o activeSyncRepresentation]];
}
// Importance // Importance
NSString *priority; o = [self priority];
priority = [self priority]; if ([o isEqualToString: @"9"])
if ([priority isEqualToString: @"9"])
v = 0; v = 0;
else if ([priority isEqualToString: @"1"]) else if ([o isEqualToString: @"1"])
v = 2; v = 2;
else else
v = 1; v = 1;
@ -83,13 +92,21 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Sensitivity - FIXME // Sensitivity - FIXME
[s appendFormat: @"<Sensitivity xmlns=\"Tasks:\">%d</Sensitivity>", 0]; [s appendFormat: @"<Sensitivity xmlns=\"Tasks:\">%d</Sensitivity>", 0];
// UTCStartDate - FIXME
if ([self startDate])
[s appendFormat: @"<UTCStartDate xmlns=\"Tasks:\">%@</UTCStartDate>", [[self startDate] activeSyncRepresentation]];
// Subject // Subject
[s appendFormat: @"<Subject xmlns=\"Tasks:\">%@</Subject>", [self summary]]; [s appendFormat: @"<Subject xmlns=\"Tasks:\">%@</Subject>", [self summary]];
if ((o = [self comment]))
{
[s appendString: @"<Body xmlns=\"AirSyncBase:\">"];
[s appendFormat: @"<Type>%d</Type>", 1];
[s appendFormat: @"<EstimatedDataSize>%d</EstimatedDataSize>", [o length]];
[s appendFormat: @"<Truncated>%d</Truncated>", 0];
[s appendFormat: @"<Data>%@</Data>", o];
[s appendString: @"</Body>"];
}
return s;
return s; return s;
} }