We now order correctly CardGroups - especially for calendars.
This is to avoid a bug in BlackBerry devices where the METHOD must be placed BEFORE any vevent/vtimezone objects, otherwise the invitation objects are never recognized, and rather shown as a "application/x-rimdevicecalendar" attachment.pull/7/head
parent
48b6cbcf0c
commit
51192dd533
|
@ -1,6 +1,6 @@
|
|||
/* CardElement.h - this file is part of SOPE
|
||||
*
|
||||
* Copyright (C) 2006 Inverse inc.
|
||||
* Copyright (C) 2006-2012 Inverse inc.
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
*
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* CardElement.m - this file is part of SOPE
|
||||
*
|
||||
* Copyright (C) 2006 Inverse inc.
|
||||
* Copyright (C) 2006-2012 Inverse inc.
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
*
|
||||
|
|
|
@ -75,6 +75,8 @@
|
|||
- (void) replaceThisElement: (CardElement *) oldElement
|
||||
withThisOne: (CardElement *) newElement;
|
||||
|
||||
- (NSArray *) orderOfElements;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* CARDGROUP_H */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* CardGroup.m - this file is part of SOPE
|
||||
*
|
||||
* Copyright (C) 2006 Inverse inc.
|
||||
* Copyright (C) 2006-2012 Inverse inc.
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
*
|
||||
|
@ -454,4 +454,9 @@ static NGCardsSaxHandler *sax = nil;
|
|||
return new;
|
||||
}
|
||||
|
||||
- (NSArray *) orderOfElements
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* CardVersitRenderer.m - this file is part of SOPE
|
||||
*
|
||||
* Copyright (C) 2006 Inverse inc.
|
||||
* Copyright (C) 2006-2012 Inverse inc.
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
*
|
||||
|
@ -107,6 +107,7 @@
|
|||
CardElement *currentChild;
|
||||
NSMutableString *rendering;
|
||||
NSString *groupTag;
|
||||
NSArray *order;
|
||||
|
||||
rendering = [NSMutableString string];
|
||||
|
||||
|
@ -120,7 +121,30 @@
|
|||
|
||||
groupTag = [groupTag uppercaseString];
|
||||
[rendering appendFormat: @"BEGIN:%@\r\n", groupTag];
|
||||
children = [[aGroup children] objectEnumerator];
|
||||
|
||||
// We reorder the group elemments, if necessary
|
||||
order = [aGroup orderOfElements];
|
||||
|
||||
if (order)
|
||||
{
|
||||
NSMutableArray *orderedElements;
|
||||
int i, c;
|
||||
|
||||
orderedElements = [NSMutableArray array];
|
||||
c = [order count];
|
||||
|
||||
for (i = 0; i < c; i++)
|
||||
{
|
||||
[orderedElements addObjectsFromArray: [aGroup childrenWithTag: [order objectAtIndex: i]]];
|
||||
}
|
||||
|
||||
children = [orderedElements objectEnumerator];
|
||||
}
|
||||
else
|
||||
{
|
||||
children = [[aGroup children] objectEnumerator];
|
||||
}
|
||||
|
||||
while ((currentChild = [children nextObject]))
|
||||
[rendering appendString: [self render: currentChild]];
|
||||
[rendering appendFormat: @"END:%@\r\n", groupTag];
|
||||
|
|
|
@ -38,18 +38,6 @@
|
|||
@class iCalTimeZone;
|
||||
|
||||
@interface iCalCalendar : CardGroup
|
||||
// {
|
||||
// NSString *version;
|
||||
// NSString *calscale;
|
||||
// NSString *prodId;
|
||||
// NSString *method;
|
||||
|
||||
// NSMutableArray *todos;
|
||||
// NSMutableArray *events;
|
||||
// NSMutableArray *journals;
|
||||
// NSMutableArray *freeBusys;
|
||||
// NSMutableDictionary *timezones;
|
||||
// }
|
||||
|
||||
/* accessors */
|
||||
|
||||
|
|
|
@ -210,6 +210,13 @@
|
|||
return [super versitString];
|
||||
}
|
||||
|
||||
- (NSArray *) orderOfElements
|
||||
{
|
||||
return [NSArray arrayWithObjects: @"prodid", @"version", @"method", @"calscale",
|
||||
@"vtimezone", @"vevent", @"vtodo", @"vjournal", @"vfreebusy", nil];
|
||||
}
|
||||
|
||||
|
||||
/* ical typing */
|
||||
|
||||
- (NSString *) entityName
|
||||
|
|
|
@ -410,14 +410,6 @@
|
|||
previousObject: oldEvent
|
||||
toAttendees: updateAttendees
|
||||
withType: @"calendar:invitation-update"];
|
||||
|
||||
#if 0
|
||||
// DELETE CODE
|
||||
[self sendReceiptEmailForObject: newEvent
|
||||
addedAttendees: nil
|
||||
deletedAttendees: nil
|
||||
updatedAttendees: updateAttendees];
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue