Fixed globalobjid so it doesn't contain \n characters!
parent
c94595ea7f
commit
8225f76279
|
@ -99,11 +99,11 @@ struct GlobalObjectId {
|
||||||
//
|
//
|
||||||
- (NSData *) _computeGlobalObjectIdFromEvent: (iCalEvent *) event
|
- (NSData *) _computeGlobalObjectIdFromEvent: (iCalEvent *) event
|
||||||
{
|
{
|
||||||
NSData *binPrefix, *globalObjectId;
|
NSData *binPrefix, *globalObjectId, *uidAsASCII;
|
||||||
NSString *prefix, *uid;
|
NSString *prefix, *uid;
|
||||||
|
|
||||||
struct GlobalObjectId newGlobalId;
|
struct GlobalObjectId newGlobalId;
|
||||||
const char *uidAsUTF8;
|
const char *bytes;
|
||||||
|
|
||||||
prefix = @"040000008200e00074c5b7101a82e008";
|
prefix = @"040000008200e00074c5b7101a82e008";
|
||||||
|
|
||||||
|
@ -115,13 +115,14 @@ struct GlobalObjectId {
|
||||||
[binPrefix getBytes: &newGlobalId.ByteArrayID];
|
[binPrefix getBytes: &newGlobalId.ByteArrayID];
|
||||||
[self _setInstanceDate: &newGlobalId
|
[self _setInstanceDate: &newGlobalId
|
||||||
fromDate: [event recurrenceId]];
|
fromDate: [event recurrenceId]];
|
||||||
uidAsUTF8 = [uid UTF8String];
|
uidAsASCII = [uid dataUsingEncoding: NSASCIIStringEncoding];
|
||||||
|
bytes = [uidAsASCII bytes];
|
||||||
|
|
||||||
// 0x0c is the size of our dataPrefix
|
// 0x0c is the size of our dataPrefix
|
||||||
newGlobalId.Size = 0x0c + strlen(uidAsUTF8);
|
newGlobalId.Size = 0x0c + [uidAsASCII length];
|
||||||
newGlobalId.Data = malloc(newGlobalId.Size * sizeof(uint8_t));
|
newGlobalId.Data = malloc(newGlobalId.Size * sizeof(uint8_t));
|
||||||
memcpy(newGlobalId.Data, dataPrefix, 0x0c);
|
memcpy(newGlobalId.Data, dataPrefix, 0x0c);
|
||||||
memcpy(newGlobalId.Data + 0x0c, uidAsUTF8, newGlobalId.Size - 0x0c);
|
memcpy(newGlobalId.Data + 0x0c, bytes, newGlobalId.Size - 0x0c);
|
||||||
|
|
||||||
globalObjectId = [[NSData alloc] initWithBytes: &newGlobalId length: 40 + newGlobalId.Size*sizeof(uint8_t)];
|
globalObjectId = [[NSData alloc] initWithBytes: &newGlobalId length: 40 + newGlobalId.Size*sizeof(uint8_t)];
|
||||||
free(newGlobalId.Data);
|
free(newGlobalId.Data);
|
||||||
|
@ -146,10 +147,10 @@ struct GlobalObjectId {
|
||||||
// bytes = malloc(length*sizeof(uint8_t));
|
// bytes = malloc(length*sizeof(uint8_t));
|
||||||
// [objectId getBytes: bytes length: length];
|
// [objectId getBytes: bytes length: length];
|
||||||
|
|
||||||
// newGlobalId = bytes;
|
// newGlobalId = (struct GlobalObjectId *)bytes;
|
||||||
|
|
||||||
// // We must take the offset (dataPrefix) into account
|
// // We must take the offset (dataPrefix) into account
|
||||||
// uid = [[NSString alloc] initWithBytes: newGlobalId->Data+12 length: newGlobalId->Size-12 encoding: NSUTF8StringEncoding];
|
// uid = [[NSString alloc] initWithBytes: newGlobalId->Data+12 length: newGlobalId->Size-12 encoding: NSASCIIStringEncoding];
|
||||||
// free(bytes);
|
// free(bytes);
|
||||||
|
|
||||||
// return AUTORELEASE(uid);
|
// return AUTORELEASE(uid);
|
||||||
|
@ -389,11 +390,14 @@ struct GlobalObjectId {
|
||||||
{
|
{
|
||||||
iCalTimeZone *tz;
|
iCalTimeZone *tz;
|
||||||
iCalEvent *event;
|
iCalEvent *event;
|
||||||
|
int v;
|
||||||
|
|
||||||
event = [[calendar events] lastObject];
|
event = [[calendar events] lastObject];
|
||||||
|
|
||||||
[s appendString: @"<MeetingRequest xmlns=\"Email:\">"];
|
[s appendString: @"<MeetingRequest xmlns=\"Email:\">"];
|
||||||
|
|
||||||
|
[s appendFormat: @"<AllDayEvent xmlns=\"Email:\">%d</AllDayEvent>", ([event isAllDay] ? 1 : 0)];
|
||||||
|
|
||||||
if ([event timeStampAsDate])
|
if ([event timeStampAsDate])
|
||||||
[s appendFormat: @"<DTStamp xmlns=\"Email:\">%@</DTStamp>", [[event timeStampAsDate] activeSyncRepresentationWithoutSeparators]];
|
[s appendFormat: @"<DTStamp xmlns=\"Email:\">%@</DTStamp>", [[event timeStampAsDate] activeSyncRepresentationWithoutSeparators]];
|
||||||
else if ([event created])
|
else if ([event created])
|
||||||
|
@ -419,11 +423,21 @@ struct GlobalObjectId {
|
||||||
[s appendFormat: @"<Organizer xmlns=\"Email:\">%@</Organizer>", [[event organizer] rfc822Email]];
|
[s appendFormat: @"<Organizer xmlns=\"Email:\">%@</Organizer>", [[event organizer] rfc822Email]];
|
||||||
[s appendFormat: @"<ResponseRequested xmlns=\"Email:\">%d</ResponseRequested>", 1];
|
[s appendFormat: @"<ResponseRequested xmlns=\"Email:\">%d</ResponseRequested>", 1];
|
||||||
|
|
||||||
|
// Sensitivity
|
||||||
|
if ([[event accessClass] isEqualToString: @"PRIVATE"])
|
||||||
|
v = 2;
|
||||||
|
if ([[event accessClass] isEqualToString: @"CONFIDENTIAL"])
|
||||||
|
v = 3;
|
||||||
|
else
|
||||||
|
v = 0;
|
||||||
|
|
||||||
|
[s appendFormat: @"<Sensitivity xmlns=\"Email:\">%d</Sensitivity>", v];
|
||||||
|
|
||||||
// We disallow new time proposals
|
// We disallow new time proposals
|
||||||
[s appendFormat: @"<DisallowNewTimeProposal xmlns=\"Email:\">%d</DisallowNewTimeProposal>", 1];
|
[s appendFormat: @"<DisallowNewTimeProposal xmlns=\"Email:\">%d</DisallowNewTimeProposal>", 1];
|
||||||
|
|
||||||
// We set the right message type
|
// We set the right message type - we must set AS version to 14.1 for this
|
||||||
[s appendFormat: @"<MeetingMessageType xmlns=\"Email2:\">%d</MeetingMessageType>", 1];
|
//[s appendFormat: @"<MeetingMessageType xmlns=\"Email2:\">%d</MeetingMessageType>", 1];
|
||||||
|
|
||||||
// From http://blogs.msdn.com/b/exchangedev/archive/2011/07/22/working-with-meeting-requests-in-exchange-activesync.aspx:
|
// From http://blogs.msdn.com/b/exchangedev/archive/2011/07/22/working-with-meeting-requests-in-exchange-activesync.aspx:
|
||||||
//
|
//
|
||||||
|
@ -431,13 +445,12 @@ struct GlobalObjectId {
|
||||||
// object in the Calendar folder have to convert the GlobalObjId element value to a UID element value to make the comparison."
|
// object in the Calendar folder have to convert the GlobalObjId element value to a UID element value to make the comparison."
|
||||||
//
|
//
|
||||||
globalObjId = [self _computeGlobalObjectIdFromEvent: event];
|
globalObjId = [self _computeGlobalObjectIdFromEvent: event];
|
||||||
[s appendFormat: @"<GlobalObjId xmlns=\"Email:\">%@</GlobalObjId>", [globalObjId stringByEncodingBase64]];
|
[s appendFormat: @"<GlobalObjId xmlns=\"Email:\">%@</GlobalObjId>", [[globalObjId stringByEncodingBase64] stringByReplacingString: @"\n" withString: @""]];
|
||||||
[s appendString: @"</MeetingRequest>"];
|
[s appendString: @"</MeetingRequest>"];
|
||||||
|
|
||||||
// MesssageClass and ContentClass
|
// MesssageClass and ContentClass
|
||||||
[s appendFormat: @"<MessageClass xmlns=\"Email:\">%@</MessageClass>", @"IPM.Schedule.Meeting.Request"];
|
[s appendFormat: @"<MessageClass xmlns=\"Email:\">%@</MessageClass>", @"IPM.Schedule.Meeting.Request"];
|
||||||
[s appendFormat: @"<ContentClass xmlns=\"Email:\">%@</ContentClass>", @"urn:content-classes:calendarmessage"];
|
[s appendFormat: @"<ContentClass xmlns=\"Email:\">%@</ContentClass>", @"urn:content-classes:calendarmessage"];
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue