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
|
/* 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>
|
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* CardElement.m - this file is part of SOPE
|
/* 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>
|
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
*
|
*
|
||||||
|
|
|
@ -75,6 +75,8 @@
|
||||||
- (void) replaceThisElement: (CardElement *) oldElement
|
- (void) replaceThisElement: (CardElement *) oldElement
|
||||||
withThisOne: (CardElement *) newElement;
|
withThisOne: (CardElement *) newElement;
|
||||||
|
|
||||||
|
- (NSArray *) orderOfElements;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#endif /* CARDGROUP_H */
|
#endif /* CARDGROUP_H */
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* CardGroup.m - this file is part of SOPE
|
/* 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>
|
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
*
|
*
|
||||||
|
@ -454,4 +454,9 @@ static NGCardsSaxHandler *sax = nil;
|
||||||
return new;
|
return new;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSArray *) orderOfElements
|
||||||
|
{
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* CardVersitRenderer.m - this file is part of SOPE
|
/* 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>
|
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
*
|
*
|
||||||
|
@ -107,6 +107,7 @@
|
||||||
CardElement *currentChild;
|
CardElement *currentChild;
|
||||||
NSMutableString *rendering;
|
NSMutableString *rendering;
|
||||||
NSString *groupTag;
|
NSString *groupTag;
|
||||||
|
NSArray *order;
|
||||||
|
|
||||||
rendering = [NSMutableString string];
|
rendering = [NSMutableString string];
|
||||||
|
|
||||||
|
@ -120,7 +121,30 @@
|
||||||
|
|
||||||
groupTag = [groupTag uppercaseString];
|
groupTag = [groupTag uppercaseString];
|
||||||
[rendering appendFormat: @"BEGIN:%@\r\n", groupTag];
|
[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]))
|
while ((currentChild = [children nextObject]))
|
||||||
[rendering appendString: [self render: currentChild]];
|
[rendering appendString: [self render: currentChild]];
|
||||||
[rendering appendFormat: @"END:%@\r\n", groupTag];
|
[rendering appendFormat: @"END:%@\r\n", groupTag];
|
||||||
|
|
|
@ -38,18 +38,6 @@
|
||||||
@class iCalTimeZone;
|
@class iCalTimeZone;
|
||||||
|
|
||||||
@interface iCalCalendar : CardGroup
|
@interface iCalCalendar : CardGroup
|
||||||
// {
|
|
||||||
// NSString *version;
|
|
||||||
// NSString *calscale;
|
|
||||||
// NSString *prodId;
|
|
||||||
// NSString *method;
|
|
||||||
|
|
||||||
// NSMutableArray *todos;
|
|
||||||
// NSMutableArray *events;
|
|
||||||
// NSMutableArray *journals;
|
|
||||||
// NSMutableArray *freeBusys;
|
|
||||||
// NSMutableDictionary *timezones;
|
|
||||||
// }
|
|
||||||
|
|
||||||
/* accessors */
|
/* accessors */
|
||||||
|
|
||||||
|
|
|
@ -210,6 +210,13 @@
|
||||||
return [super versitString];
|
return [super versitString];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSArray *) orderOfElements
|
||||||
|
{
|
||||||
|
return [NSArray arrayWithObjects: @"prodid", @"version", @"method", @"calscale",
|
||||||
|
@"vtimezone", @"vevent", @"vtodo", @"vjournal", @"vfreebusy", nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ical typing */
|
/* ical typing */
|
||||||
|
|
||||||
- (NSString *) entityName
|
- (NSString *) entityName
|
||||||
|
|
|
@ -410,14 +410,6 @@
|
||||||
previousObject: oldEvent
|
previousObject: oldEvent
|
||||||
toAttendees: updateAttendees
|
toAttendees: updateAttendees
|
||||||
withType: @"calendar:invitation-update"];
|
withType: @"calendar:invitation-update"];
|
||||||
|
|
||||||
#if 0
|
|
||||||
// DELETE CODE
|
|
||||||
[self sendReceiptEmailForObject: newEvent
|
|
||||||
addedAttendees: nil
|
|
||||||
deletedAttendees: nil
|
|
||||||
updatedAttendees: updateAttendees];
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue