Monotone-Parent: 48706c943fa3ceb72288194c22bfec223fb4a890

Monotone-Revision: cf82a6c633ed0ff127f0f681583035b3bcc35b77

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2011-02-03T22:39:02
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2011-02-03 22:39:02 +00:00
parent 36a03a0e5c
commit a5b387cfeb
4 changed files with 101 additions and 35 deletions

View File

@ -3,8 +3,16 @@
* OpenChange/MAPIStoreMapping.m (-unregisterURLWithID:): new
method for removing entries from the mapping dictionaries.
* OpenChange/MAPIStoreContext.m
(-deleteMessageWithMID:inFID:withFlags:): implemented backend method.
2011-02-03 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/MAPIStoreContext.m
(_saveOrSubmitChangesInMessageWithMID:andFlags:save:): silently
ignore "IPM.Schedule.Meeting.Request" messages from Outlook
and return a success code.
* SoObjects/SOGo/WOResourceManager+SOGo.m: new category module
defining methods useful to the vanilla and OpenChange frontends.
(-localeForLanguageNamed:): method moved from SOGo.m.

View File

@ -142,6 +142,7 @@
inRows: (struct ModifyRecipientRow *) rows
withCount: (NSUInteger) max;
- (int) deleteMessageWithMID: (uint64_t) mid
inFID: (uint64_t) fid
withFlags: (uint8_t) flags;
- (int) releaseRecordWithFMID: (uint64_t) fmid
ofTableType: (uint8_t) tableType;

View File

@ -965,39 +965,50 @@ _prepareContextClass (struct mapistore_context *newMemCtx,
[NSNumber numberWithUnsignedLongLong: mid]];
if (messageProperties)
{
messageURL = [mapping urlFromID: mid];
associated = [[messageProperties objectForKey: @"associated"] boolValue];
if (messageURL)
if ([[messageProperties
objectForKey: MAPIPropertyKey (PR_MESSAGE_CLASS_UNICODE)]
isEqualToString: @"IPM.Schedule.Meeting.Request"])
{
if (associated)
message = [self lookupFAIObject: messageURL];
else
message = [self lookupObject: messageURL];
}
else
{
fid = [[messageProperties objectForKey: @"fid"]
unsignedLongLongValue];
message = [self _createMessageOfClass: [messageProperties objectForKey: MAPIPropertyKey (PR_MESSAGE_CLASS_UNICODE)]
associated: associated
withMID: mid inFID: fid];
}
if (message)
{
if (associated)
[faiTable cleanupCaches];
else
[messageTable cleanupCaches];
[message setMAPIProperties: messageProperties];
if (isSave)
[message MAPISave];
else
[message MAPISubmit];
/* We silently discard invitation emails since this is already
handled internally by SOGo. */
rc = MAPISTORE_SUCCESS;
}
else
rc = MAPISTORE_ERROR;
{
messageURL = [mapping urlFromID: mid];
associated = [[messageProperties objectForKey: @"associated"] boolValue];
if (messageURL)
{
if (associated)
message = [self lookupFAIObject: messageURL];
else
message = [self lookupObject: messageURL];
}
else
{
fid = [[messageProperties objectForKey: @"fid"]
unsignedLongLongValue];
message = [self _createMessageOfClass: [messageProperties objectForKey: MAPIPropertyKey (PR_MESSAGE_CLASS_UNICODE)]
associated: associated
withMID: mid inFID: fid];
}
if (message)
{
if (associated)
[faiTable cleanupCaches];
else
[messageTable cleanupCaches];
[message setMAPIProperties: messageProperties];
if (isSave)
[message MAPISave];
else
[message MAPISubmit];
rc = MAPISTORE_SUCCESS;
}
else
rc = MAPISTORE_ERROR;
}
}
else
rc = MAPISTORE_ERR_NOT_FOUND;
@ -1394,8 +1405,9 @@ _prepareContextClass (struct mapistore_context *newMemCtx,
for (count = 0; count < max; count++)
{
currentRow = rows + count;
if (currentRow->RecipClass >= 0
&& currentRow->RecipClass < 3)
if (currentRow->RecipClass >= MAPI_ORIG
&& currentRow->RecipClass < MAPI_BCC)
{
recType = recTypes[currentRow->RecipClass];
list = [recipients objectForKey: recType];
@ -1418,12 +1430,56 @@ _prepareContextClass (struct mapistore_context *newMemCtx,
}
- (int) deleteMessageWithMID: (uint64_t) mid
inFID: (uint64_t) fid
withFlags: (uint8_t) flags
{
[self logWithFormat: @"UNIMPLEMENTED METHOD '%s' (%d)", __FUNCTION__, __LINE__];
[self logWithFormat: @" mid: 0x%.16x flags: %d", mid, flags];
NSString *childURL, *childKey;
MAPIStoreTable *table;
id message;
int rc;
return MAPISTORE_ERROR;
[self logWithFormat: @"-deleteMessageWithMID: mid: 0x%.16x flags: %d", mid, flags];
childURL = [mapping urlFromID: mid];
if (childURL)
{
[self logWithFormat: @"-deleteMessageWithMID: url (%@) found for object", childURL];
childKey = [self extractChildNameFromURL: childURL
andFolderURLAt: NULL];
table = [self _tableForFID: fid andTableType: MAPISTORE_FAI_TABLE];
if ([[table cachedChildKeys] containsObject: childKey])
message = [self lookupFAIObject: childURL];
else
{
table = [self _tableForFID: fid andTableType: MAPISTORE_MESSAGE_TABLE];
if ([[table cachedChildKeys] containsObject: childKey])
message = [self lookupObject: childURL];
else
message = nil;
}
if (message)
{
if ([message delete])
{
rc = MAPISTORE_ERROR;
[self logWithFormat: @"ERROR deleting object at URL: %@", childURL];
}
else
{
[self logWithFormat: @"sucessfully deleted object at URL: %@", childURL];
[mapping unregisterURLWithID: mid];
rc = MAPISTORE_SUCCESS;
}
}
else
rc = MAPI_E_INVALID_OBJECT;
}
else
rc = MAPISTORE_ERR_NOT_FOUND;
return rc;
}
- (int) releaseRecordWithFMID: (uint64_t) fmid

View File

@ -713,6 +713,7 @@ sogo_op_modifyrecipients(void *private_data,
static int
sogo_op_deletemessage(void *private_data,
uint64_t fid,
uint64_t mid,
uint8_t flags)
{
@ -729,7 +730,7 @@ sogo_op_deletemessage(void *private_data,
context = cContext->objcContext;
[context setupRequest];
rc = [context deleteMessageWithMID: mid withFlags: flags];
rc = [context deleteMessageWithMID: mid inFID: fid withFlags: flags];
[context tearDownRequest];
[pool release];