Monotone-Parent: ca4fbefac87810f783af4e8524407ee848ae6b3f

Monotone-Revision: 5bef03fdbb4e4f3112fabf6812f1a2e0932c85a9

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-10-15T17:24:09
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2010-10-15 17:24:09 +00:00
parent 92030a5996
commit 3ab3e25a00
3 changed files with 87 additions and 42 deletions
+7
View File
@@ -1,5 +1,12 @@
2010-10-15 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/MAPIStoreContext.m (-getPath:ofFMID:withTableType:):
returns a found path IIF the fmid matches the current context.
Print an error message when the cause of mismatch is the lack of
sync with the indexing file.
(-getFoldersList:withFMDI:): returns a list IIF the FMID matches
the current context.
* OpenChange/MAPIStoreMapping.m (+sharedMapping): singleton
constructor.
+59 -19
View File
@@ -122,7 +122,7 @@ static MAPIStoreMapping *mapping = nil;
SOGoObjectK = [SOGoObject class];
SOGoMailAccountK = NSClassFromString (@"SOGoMailAccount");
SOGoMailFolderK = NSClassFromString (@"SOGoMailFolder");
mapping = [MAPIStoreMapping new];
mapping = [MAPIStoreMapping sharedMapping];
}
+ (id) contextFromURI: (const char *) newUri
@@ -590,7 +590,7 @@ static MAPIStoreMapping *mapping = nil;
inFolder: (SOGoFolder *) folder
withFID: (uint64_t) fid
{
NSString *stringValue;
// NSString *stringValue;
id child;
// uint64_t *llongValue;
// uint32_t *longValue;
@@ -604,24 +604,24 @@ static MAPIStoreMapping *mapping = nil;
*data = [[child displayName] asUnicodeInMemCtx: memCtx];
break;
default:
*data = NULL;
// *data = NULL;
rc = MAPI_E_NOT_FOUND;
if ((proptag & 0x001F) == 0x001F)
{
stringValue = [NSString stringWithFormat: @"Unhandled unicode value: 0x%x", proptag];
*data = [stringValue asUnicodeInMemCtx: memCtx];
rc = MAPI_E_SUCCESS;
// if ((proptag & 0x001F) == 0x001F)
// {
// stringValue = [NSString stringWithFormat: @"Unhandled unicode value: 0x%x", proptag];
// *data = [stringValue asUnicodeInMemCtx: memCtx];
// rc = MAPI_E_SUCCESS;
[self errorWithFormat: @"Unknown proptag (returned): %.8x for child '%@'",
proptag, childURL];
// }
// else
// {
// [self errorWithFormat: @"Unknown proptag: %.8x for child '%@'",
// proptag, childURL];
// *data = NULL;
rc = MAPI_E_NOT_FOUND;
break;
}
else
{
[self errorWithFormat: @"Unknown proptag: %.8x for child '%@'",
proptag, childURL];
// *data = NULL;
}
}
return rc;
}
@@ -997,21 +997,60 @@ static MAPIStoreMapping *mapping = nil;
return MAPISTORE_ERROR;
}
// struct indexing_context_list {
// struct tdb_wrap *index_ctx;
// char *username;
// uint32_t ref_count;
// struct indexing_context_list *prev;
// struct indexing_context_list *next;
// };
// struct tdb_wrap {
// struct tdb_context *tdb;
// const char *name;
// struct tdb_wrap *prev;
// struct tdb_wrap *next;
// };
- (int) getPath: (char **) path
ofFMID: (uint64_t) fmid
withTableType: (uint8_t) tableType
{
int rc;
NSString *objectURL;
// TDB_DATA key, dbuf;
objectURL = [mapping urlFromID: fmid];
if (objectURL)
{
*path = [[objectURL substringFromIndex: 7] asUnicodeInMemCtx: memCtx];
rc = MAPISTORE_SUCCESS;
if ([objectURL hasPrefix: uri])
{
*path = [[objectURL substringFromIndex: 7] asUnicodeInMemCtx: memCtx];
rc = MAPISTORE_SUCCESS;
}
else
{
/* An id was found that is not part of this context...x */
*path = NULL;
rc = MAPI_E_NOT_FOUND;
}
}
else
rc = MAPI_E_NOT_FOUND;
{
[self errorWithFormat: @"%s: you should *never* get here", __PRETTY_FUNCTION__];
// /* attempt to populate our mapping dict with data from indexing.tdb */
// key.dptr = (unsigned char *) talloc_asprintf (memCtx, "0x%.16llx",
// (long long unsigned int )fmid);
// key.dsize = strlen ((const char *) key.dptr);
// dbuf = tdb_fetch (memCtx->indexing_list->index_ctx->tdb, key);
// talloc_free (key.dptr);
// uri = talloc_strndup (memCtx, (const char *)dbuf.dptr, dbuf.dsize);
*path = NULL;
rc = MAPI_E_NOT_FOUND;
}
[self logWithFormat: @"getPath.... %lld -> (%s, %d)", fmid, *path, rc];
return rc;
}
@@ -1062,7 +1101,8 @@ static MAPIStoreMapping *mapping = nil;
rc = MAPI_E_SUCCESS;
currentURL = [mapping urlFromID: fmid];
if (currentURL && ![currentURL isEqualToString: uri])
if (currentURL && ![currentURL isEqualToString: uri]
&& [currentURL hasPrefix: uri])
{
nsFolderList = [NSMutableArray arrayWithCapacity: 32];
currentURL = [self _parentURLFromURL: currentURL];
+21 -23
View File
@@ -187,7 +187,7 @@ static Class SOGoUserFolderK;
if ([keys count] == 0 || [keys count] == 2)
{
*data = NULL;
rc = MAPISTORE_ERR_NOT_FOUND;
rc = MAPI_E_NOT_FOUND;
}
else
{
@@ -211,13 +211,12 @@ static Class SOGoUserFolderK;
encoding: NSISOLatin1StringEncoding];
// *data = NULL;
// rc = MAPISTORE_ERR_NOT_FOUND;
// rc = MAPI_E_NOT_FOUND;
*data = [stringContent asUnicodeInMemCtx: memCtx];
}
else
{
*data = NULL;
rc = MAPISTORE_ERR_NOT_FOUND;
rc = MAPI_E_NOT_FOUND;
}
}
}
@@ -251,18 +250,17 @@ static Class SOGoUserFolderK;
else
{
*data = NULL;
rc = MAPISTORE_ERR_NOT_FOUND;
rc = MAPI_E_NOT_FOUND;
}
}
// *data = NULL;
// rc = MAPISTORE_ERR_NOT_FOUND;
// rc = MAPI_E_NOT_FOUND;
break;
/* We don't handle any RTF content. */
case PR_RTF_COMPRESSED:
*data = NULL;
rc = MAPISTORE_ERR_NOT_FOUND;
rc = MAPI_E_NOT_FOUND;
break;
case PR_RTF_IN_SYNC:
*data = MAPIBoolValue (memCtx, NO);
@@ -310,7 +308,7 @@ static Class SOGoUserFolderK;
case PR_PROCESSED:
case PR_ORIGINATOR_DELIVERY_REPORT_REQUESTED:
case PR_RECIPIENT_REASSIGNMENT_PROHIBITED:
*data = MAPIBoolValue (memCtx, NO);
rc = MAPI_E_NOT_FOUND;
break;
/* PT_SYSTIME */
@@ -323,6 +321,8 @@ static Class SOGoUserFolderK;
case PR_CLIENT_SUBMIT_TIME:
case PR_DEFERRED_SEND_TIME:
case PR_ORIGINAL_SUBMIT_TIME:
rc = MAPI_E_NOT_FOUND;
break;
/* PT_BINARY */
case PR_CONVERSATION_KEY:
@@ -339,15 +339,16 @@ static Class SOGoUserFolderK;
case PR_RCVD_REPRESENTING_SEARCH_KEY:
case PR_SEARCH_KEY:
case PR_CHANGE_KEY:
case PR_ORIGINAL_AUTHOR_SEARCH_KEY:
case PR_ORIGINAL_AUTHOR_SEARCH_KEY:
case PR_CONVERSATION_INDEX:
case PR_SENDER_ENTRYID:
case PR_SENDER_SEARCH_KEY:
rc = MAPI_E_NOT_FOUND;
break;
/* PT_SVREID*/
case PR_SENT_MAILSVR_EID:
*data = NULL;
rc = MAPISTORE_ERR_NOT_FOUND;
rc = MAPI_E_NOT_FOUND;
break;
/* PR_LONG */
@@ -355,8 +356,7 @@ static Class SOGoUserFolderK;
case PR_ACTION_FLAG:
case PR_INTERNET_CPID:
case PR_INET_MAIL_OVERRIDE_FORMAT:
*data = NULL;
rc = MAPISTORE_ERR_NOT_FOUND;
rc = MAPI_E_NOT_FOUND;
break;
case PR_MSG_EDITOR_FORMAT:
@@ -507,7 +507,7 @@ static Class SOGoUserFolderK;
rc = MAPI_E_SUCCESS;
}
else
rc = MAPISTORE_ERR_NOT_FOUND;
rc = MAPI_E_NOT_FOUND;
return rc;
}
@@ -535,19 +535,17 @@ static Class SOGoUserFolderK;
withTag: tag
inFolder: nil
withFID: 0]
!= MAPI_E_SUCCESS)
== MAPI_E_SUCCESS)
{
propValue = MAPILongValue (memCtx, MAPI_E_NOT_FOUND);
tag = (tag & 0xffff0000) | 0x0a;
}
set_SPropValue_proptag (&(aRow->lpProps[aRow->cValues]),
tag, propValue);
aRow->cValues++;
set_SPropValue_proptag (&(aRow->lpProps[aRow->cValues]),
tag, propValue);
aRow->cValues++;
}
}
rc = MAPI_E_SUCCESS;
}
else
rc = MAPISTORE_ERR_NOT_FOUND;
rc = MAPI_E_NOT_FOUND;
return rc;
}