Monotone-Parent: e329ec905c74bf16f8adf33509a116ea62e1d65f

Monotone-Revision: 2fd9ca48151cb890633db65a0c6b7a4066ce2ff0

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2011-10-11T21:16:57
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2011-10-11 21:16:57 +00:00
parent afa63205bc
commit c1726a8c40
4 changed files with 130 additions and 48 deletions
+9
View File
@@ -1,5 +1,11 @@
2011-10-11 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/MAPIStoreMailMessage.m (-init): "headerMethod" has
become obsolete.
(-getPrIconIndex:inMemCtx:, -getPrMessageClass:inMemCtx:): when
mail is event, forward the invocation to the
MAPIStoreAppointmentWrapper equivalent.
* OpenChange/MAPIStoreAppointmentWrapper.m
(-getPidLidReminderSet:inMemCtx:)
(-getPidLidReminderDelta:inMemCtx:)
@@ -10,6 +16,9 @@
(-getPidLidReminderPlaySound:inMemCtx:)
(-getPidLidReminderFileParameter:inMemCtx:): implemented those
alarm-related getters (see OXORMDR).
(-getPrIconIndex:inMemCtx:, -getPrMessageClass:inMemCtx:): updated
code to handle REQUEST, REPLY (positive, negative and tentative)
as well as "COUNTER" and "CANCEL".
* OpenChange/MAPIStoreCalendarMessage.m (_setupAlarmDataInEvent:):
new method invoked from -save that sets VALARM elements on the
+101 -12
View File
@@ -360,18 +360,68 @@ static NSCharacterSet *hexCharacterSet = nil;
inMemCtx: (TALLOC_CTX *) memCtx
{
uint32_t longValue;
NSString *method;
NSArray *attendees;
/* see http://msdn.microsoft.com/en-us/library/cc815472.aspx:
Single instance appointment: 0x00000400
Recurring appointment: 0x00000401
Single instance meeting: 0x00000402
Recurring meeting: 0x00000403
Meeting request: 0x00000404
Accept: 0x00000405
Decline: 0x00000406
Tentativly: 0x00000407
Cancellation: 0x00000408
Informational update: 0x00000409 */
// if ([headerMethod isEqualToString: @"REQUEST"])
// longValue = 0x0404;
// else
// longValue = 0x0400;
/* see http://msdn.microsoft.com/en-us/library/cc815472.aspx */
// *longValue = 0x00000401 for recurring event
// *longValue = 0x00000402 for meeting
// *longValue = 0x00000403 for recurring meeting
// *longValue = 0x00000404 for invitation
longValue = 0x0400;
if ([event isRecurrent])
longValue |= 0x0001;
if ([[event attendees] count] > 0)
longValue |= 0x0002;
method = [[event parent] method];
if (method)
{
if ([method isEqualToString: @"REQUEST"])
longValue |= 0x0004;
else if ([method isEqualToString: @"REPLY"])
{
attendees = [event attendees];
if ([attendees count] == 1)
{
longValue |= 0x0004;
switch ([[attendees objectAtIndex: 0] participationStatus])
{
case iCalPersonPartStatAccepted:
longValue |= 0x0001;
break;
case iCalPersonPartStatDeclined:
longValue |= 0x0002;
break;
case iCalPersonPartStatTentative:
longValue |= 0x0003;
break;
default:
longValue = 0x0400;
[self logWithFormat: @"unhandled part stat"];
}
}
else
[self logWithFormat: @"unexpected number of attendees for a REPLY"];
}
else if ([method isEqualToString: @"CANCEL"])
longValue |= 0x0008;
}
else
{
if ([event isRecurrent])
longValue |= 0x0001;
if ([[event attendees] count] > 0)
longValue |= 0x0002;
}
*data = MAPILongValue (memCtx, longValue);
@@ -460,10 +510,49 @@ static NSCharacterSet *hexCharacterSet = nil;
- (int) getPrMessageClass: (void **) data
inMemCtx: (TALLOC_CTX *) memCtx
{
NSString *method;
NSArray *attendees;
const char *className;
if ([[event attendees] count] > 0)
className = "IPM.Schedule.Meeting.Request";
method = [[event parent] method];
if (method)
{
if ([method isEqualToString: @"REQUEST"])
className = "IPM.Schedule.Meeting.Request";
else if ([method isEqualToString: @"REPLY"])
{
attendees = [event attendees];
if ([attendees count] == 1)
{
switch ([[attendees objectAtIndex: 0] participationStatus])
{
case iCalPersonPartStatAccepted:
className = "IPM.Schedule.Meeting.Resp.Pos";
break;
case iCalPersonPartStatDeclined:
className = "IPM.Schedule.Meeting.Resp.Neg";
break;
case iCalPersonPartStatTentative:
className = "IPM.Schedule.Meeting.Resp.Tent";
break;
default:
className = "IPM.Appointment";
[self logWithFormat: @"unhandled part stat"];
}
}
else
[self logWithFormat: @"unexpected number of attendees for a REPLY"];
}
else if ([method isEqualToString: @"COUNTER"])
className = "IPM.Schedule.Meeting.Resp.Tent";
else if ([method isEqualToString: @"CANCEL"])
className = "IPM.Schedule.Meeting.Cancelled";
else
{
className = "IPM.Appointment";
[self logWithFormat: @"unhandled method: %@", method];
}
}
else
className = "IPM.Appointment";
*data = talloc_strdup(memCtx, className);
-1
View File
@@ -38,7 +38,6 @@
NSString *mimeKey;
NSString *headerCharset;
NSString *headerEncoding;
NSString *headerMethod;
NSString *headerMimeType;
BOOL bodySetup;
NSData *bodyContent;
+20 -35
View File
@@ -115,7 +115,6 @@ static Class NSExceptionK, MAPIStoreSentItemsFolderK, MAPIStoreDraftsFolderK;
mailIsEvent = NO;
headerCharset = nil;
headerEncoding = nil;
headerMethod = nil;
headerMimeType = nil;
headerSetup = NO;
bodyContent = nil;
@@ -132,7 +131,6 @@ static Class NSExceptionK, MAPIStoreSentItemsFolderK, MAPIStoreDraftsFolderK;
[bodyContent release];
[headerMimeType release];
[headerCharset release];
[headerMethod release];
[appointmentWrapper release];
[super dealloc];
}
@@ -226,10 +224,7 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
ASSIGN (headerCharset, [parameters objectForKey: @"charset"]);
if ([headerMimeType isEqualToString: @"text/calendar"]
|| [headerMimeType isEqualToString: @"application/ics"])
{
mailIsEvent = YES;
ASSIGN (headerMethod, [parameters objectForKey: @"method"]);
}
mailIsEvent = YES;
}
headerSetup = YES;
@@ -394,25 +389,23 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
if (!headerSetup)
[self _fetchHeaderData];
/* see http://msdn.microsoft.com/en-us/library/cc815472.aspx */
if ([sogoObject isNewMail])
longValue = 0xffffffff;
else if (mailIsEvent)
{
if ([headerMethod isEqualToString: @"REQUEST"])
longValue = 0x0404;
else
longValue = 0x0400;
}
else if ([sogoObject replied])
longValue = 0x105;
else if ([sogoObject forwarded])
longValue = 0x106;
else if ([sogoObject read])
longValue = 0x100;
if (mailIsEvent)
[[self _appointmentWrapper] getPrIconIndex: data inMemCtx: memCtx];
else
longValue = 0x101;
*data = MAPILongValue (memCtx, longValue);
{
/* see http://msdn.microsoft.com/en-us/library/cc815472.aspx */
if ([sogoObject isNewMail])
longValue = 0xffffffff;
else if ([sogoObject replied])
longValue = 0x105;
else if ([sogoObject forwarded])
longValue = 0x106;
else if ([sogoObject read])
longValue = 0x100;
else
longValue = 0x101;
*data = MAPILongValue (memCtx, longValue);
}
return MAPISTORE_SUCCESS;
}
@@ -501,22 +494,14 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
- (int) getPrMessageClass: (void **) data
inMemCtx: (TALLOC_CTX *) memCtx
{
const char *className;
if (!headerSetup)
[self _fetchHeaderData];
if (mailIsEvent)
{
if ([headerMethod isEqualToString: @"REQUEST"])
className = "IPM.Schedule.Meeting.Request";
else
className = "IPM.Appointment";
}
[[self _appointmentWrapper] getPrMessageClass: data
inMemCtx: memCtx];
else
className = "IPM.Note";
*data = talloc_strdup (memCtx, className);
*data = talloc_strdup (memCtx, "IPM.Note");
return MAPISTORE_SUCCESS;
}