Monotone-Parent: 535269ec26cac9e28483df1693160af134682680

Monotone-Revision: 4a2e7b98be9bf00419ec1e19e3bfda5b9b0a9f8f

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-10-06T14:27:09
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2010-10-06 14:27:09 +00:00
parent bc5c6979a3
commit e8debc37e3
7 changed files with 110 additions and 121 deletions

View File

@ -3,6 +3,8 @@
* OpenChange/MAPIStoreContext.m: * OpenChange/MAPIStoreContext.m:
(-getMessageTableChildproperty:atURL:withTag:inFolder:withFID:) (-getMessageTableChildproperty:atURL:withTag:inFolder:withFID:)
added response for PR_ROW_TYPE (always 1) and PR_DEPTH (always 0). added response for PR_ROW_TYPE (always 1) and PR_DEPTH (always 0).
(MAPIBoolValue, MAPILongValue, MAPILongLongValue): new helpers for
talloc'd C values.
2010-10-05 Wolfgang Sourdeau <wsourdeau@inverse.ca> 2010-10-05 Wolfgang Sourdeau <wsourdeau@inverse.ca>

View File

@ -73,8 +73,6 @@ static Class SOGoUserFolderK;
inFolder: (SOGoFolder *) folder inFolder: (SOGoFolder *) folder
withFID: (uint64_t) fid withFID: (uint64_t) fid
{ {
uint32_t *longValue;
uint8_t *boolValue;
// id child; // id child;
id event; id event;
int rc; int rc;
@ -83,13 +81,12 @@ static Class SOGoUserFolderK;
switch (proptag) switch (proptag)
{ {
case PR_ICON_INDEX: // TODO case PR_ICON_INDEX: // TODO
longValue = talloc_zero(memCtx, uint32_t); /* see http://msdn.microsoft.com/en-us/library/cc815472.aspx */
*longValue = 0x00000400; /* see http://msdn.microsoft.com/en-us/library/cc815472.aspx */
// *longValue = 0x00000401 for recurring event // *longValue = 0x00000401 for recurring event
// *longValue = 0x00000402 for meeting // *longValue = 0x00000402 for meeting
// *longValue = 0x00000403 for recurring meeting // *longValue = 0x00000403 for recurring meeting
// *longValue = 0x00000404 for invitation // *longValue = 0x00000404 for invitation
*data = longValue; *data = MAPILongValue (memCtx, 0x00000400);
break; break;
case PR_MESSAGE_CLASS_UNICODE: case PR_MESSAGE_CLASS_UNICODE:
*data = talloc_strdup(memCtx, "IPM.Appointment"); *data = talloc_strdup(memCtx, "IPM.Appointment");
@ -103,9 +100,7 @@ static Class SOGoUserFolderK;
*data = [[event endDate] asFileTimeInMemCtx: memCtx]; *data = [[event endDate] asFileTimeInMemCtx: memCtx];
break; break;
case 0x82410003: // LABEL idx, should be saved in an X- property case 0x82410003: // LABEL idx, should be saved in an X- property
longValue = talloc_zero(memCtx, uint32_t); *data = MAPILongValue (memCtx, 0);
*longValue = 0;
*data = longValue;
break; break;
case PR_SUBJECT_UNICODE: // SUMMARY case PR_SUBJECT_UNICODE: // SUMMARY
case PR_NORMALIZED_SUBJECT_UNICODE: case PR_NORMALIZED_SUBJECT_UNICODE:
@ -118,15 +113,11 @@ static Class SOGoUserFolderK;
*data = [[event location] asUnicodeInMemCtx: memCtx]; *data = [[event location] asUnicodeInMemCtx: memCtx];
break; break;
case 0x8224000b: // private (bool), should depend on CLASS case 0x8224000b: // private (bool), should depend on CLASS
boolValue = talloc_zero(memCtx, uint8_t); *data = MAPIBoolValue (memCtx, NO);
*boolValue = NO;
*data = boolValue;
break; break;
case PR_SENSITIVITY: // not implemented, depends on CLASS case PR_SENSITIVITY: // not implemented, depends on CLASS
// normal = 0, private = 2 // normal = 0, private = 2
longValue = talloc_zero(memCtx, uint32_t); *data = MAPILongValue (memCtx, 0);
*longValue = 0;
*data = longValue;
break; break;
// case PR_VD_NAME_UNICODE: // case PR_VD_NAME_UNICODE:

View File

@ -138,7 +138,6 @@ static Class SOGoUserFolderK;
withFID: (uint64_t) fid withFID: (uint64_t) fid
{ {
NSString *stringValue; NSString *stringValue;
uint32_t *longValue;
id child; id child;
int rc; int rc;
@ -146,29 +145,27 @@ static Class SOGoUserFolderK;
switch (proptag) switch (proptag)
{ {
case PR_ICON_INDEX: // TODO case PR_ICON_INDEX: // TODO
longValue = talloc_zero(memCtx, uint32_t); /* see http://msdn.microsoft.com/en-us/library/cc815472.aspx */
*longValue = 0x00000200; /* see http://msdn.microsoft.com/en-us/library/cc815472.aspx */ *data = MAPILongValue (memCtx, 0x00000200);
*data = longValue;
break; break;
case PR_MESSAGE_CLASS_UNICODE: case PR_MESSAGE_CLASS_UNICODE:
*data = talloc_strdup(memCtx, "IPM.Contact"); *data = talloc_strdup (memCtx, "IPM.Contact");
break; break;
// case PR_VD_NAME_UNICODE: // case PR_VD_NAME_UNICODE:
// *data = talloc_strdup(memCtx, "PR_VD_NAME_UNICODE"); // *data = talloc_strdup (memCtx, "PR_VD_NAME_UNICODE");
// break; // break;
// case PR_EMS_AB_DXA_REMOTE_CLIENT_UNICODE: "Home:" ??? // case PR_EMS_AB_DXA_REMOTE_CLIENT_UNICODE: "Home:" ???
// *data = talloc_strdup(memCtx, "PR_EMS..."); // *data = talloc_strdup (memCtx, "PR_EMS...");
// break; // break;
case PR_SUBJECT_UNICODE: case PR_SUBJECT_UNICODE:
*data = talloc_strdup(memCtx, "PR_SUBJECT..."); *data = talloc_strdup (memCtx, "PR_SUBJECT...");
break; break;
case PR_OAB_NAME_UNICODE: case PR_OAB_NAME_UNICODE:
*data = talloc_strdup(memCtx, "PR_OAB_NAME_UNICODE"); *data = talloc_strdup (memCtx, "PR_OAB_NAME_UNICODE");
break; break;
case PR_OAB_LANGID: case PR_OAB_LANGID:
longValue = talloc_zero(memCtx, uint32_t); /* English US */
*longValue = 1033; /* English US */ *data = MAPILongValue (memCtx, 1033);
*data = longValue;
break; break;
case PR_TITLE_UNICODE: case PR_TITLE_UNICODE:
@ -252,7 +249,7 @@ static Class SOGoUserFolderK;
// case PR_HOME2_TELEPHONE_NUMBER_UNICODE: // case PR_HOME2_TELEPHONE_NUMBER_UNICODE:
// case PR_TTYTDD_PHONE_NUMBER_UNICODE: // case PR_TTYTDD_PHONE_NUMBER_UNICODE:
// case PR_BUSINESS_HOME_PAGE_UNICODE: // case PR_BUSINESS_HOME_PAGE_UNICODE:
// *data = talloc_strdup(memCtx, "[Generic and fake unicode value]"); // *data = talloc_strdup (memCtx, "[Generic and fake unicode value]");
// break; // break;
// (18:54:45) Wolfgang-: 0x80a7001f ( Business: ) -> don't ask me which "business" // (18:54:45) Wolfgang-: 0x80a7001f ( Business: ) -> don't ask me which "business"

View File

@ -46,6 +46,10 @@
@class MAPIStoreAuthenticator; @class MAPIStoreAuthenticator;
extern uint8_t *MAPIBoolValue (void *, BOOL);
extern uint32_t *MAPILongValue (void *, uint32_t);
extern uint64_t *MAPILongLongValue (void *, uint64_t);
@interface MAPIStoreContext : NSObject @interface MAPIStoreContext : NSObject
{ {
NSMutableDictionary *objectCache; NSMutableDictionary *objectCache;

View File

@ -60,6 +60,39 @@
// SOGoMailFolderK = NSClassFromString (@"SOGoMailFolder"); // SOGoMailFolderK = NSClassFromString (@"SOGoMailFolder");
// SOGoUserFolderK = NSClassFromString (@"SOGoUserFolder"); // SOGoUserFolderK = NSClassFromString (@"SOGoUserFolder");
uint8_t *
MAPIBoolValue (void *memCtx, BOOL value)
{
uint8_t *boolValue;
boolValue = talloc_zero (memCtx, uint8_t);
*boolValue = value;
return boolValue;
}
uint32_t *
MAPILongValue (void *memCtx, uint32_t value)
{
uint32_t *longValue;
longValue = talloc_zero (memCtx, uint32_t);
*longValue = value;
return longValue;
}
uint64_t *
MAPILongLongValue (void *memCtx, uint64_t value)
{
uint64_t *llongValue;
llongValue = talloc_zero (memCtx, uint64_t);
*llongValue = value;
return llongValue;
}
static Class SOGoObjectK, SOGoMailAccountK, SOGoMailFolderK; static Class SOGoObjectK, SOGoMailAccountK, SOGoMailFolderK;
@interface SOGoFolder (MAPIStoreProtocol) @interface SOGoFolder (MAPIStoreProtocol)
@ -577,52 +610,40 @@ static MAPIStoreMapping *mapping = nil;
inFolder: (SOGoFolder *) folder inFolder: (SOGoFolder *) folder
withFID: (uint64_t) fid withFID: (uint64_t) fid
{ {
uint32_t *longValue;
uint64_t *llongValue;
int rc; int rc;
int64_t mappingId;
rc = MAPI_E_SUCCESS; rc = MAPI_E_SUCCESS;
switch (proptag) switch (proptag)
{ {
case PR_INST_ID: // TODO: DOUBT case PR_INST_ID: // TODO: DOUBT
llongValue = talloc_zero(memCtx, uint64_t); /* we return a unique id based on the url */
// *llongValue = 1; *data = MAPILongLongValue (memCtx, [childURL hash]);
*llongValue = [childURL hash]; /* we return a unique id based on the url */
*data = llongValue;
break; break;
// case PR_INST_ID: // TODO: DOUBT // case PR_INST_ID: // TODO: DOUBT
case PR_DEPTH: // TODO: DOUBT case PR_DEPTH: // TODO: DOUBT
longValue = talloc_zero(memCtx, uint32_t); *data = MAPILongLongValue (memCtx, 0);
*longValue = 0;
*data = longValue;
break; break;
case PR_ROW_TYPE: // TODO: DOUBT case PR_ROW_TYPE: // TODO: DOUBT
longValue = talloc_zero(memCtx, uint32_t); *data = MAPILongValue (memCtx, TBL_LEAF_ROW);
*longValue = TBL_LEAF_ROW;
*data = longValue;
break; break;
case PR_INSTANCE_NUM: // TODO: DOUBT case PR_INSTANCE_NUM: // TODO: DOUBT
longValue = talloc_zero(memCtx, uint32_t); *data = MAPILongValue (memCtx, 0);
*longValue = 0;
*data = longValue;
break; break;
case PR_VD_VERSION: case PR_VD_VERSION:
longValue = talloc_zero(memCtx, uint32_t); /* mandatory value... wtf? */
*longValue = 8; /* mandatory value... wtf? */ *data = MAPILongValue (memCtx, 8);
*data = longValue;
break; break;
case PR_FID: case PR_FID:
llongValue = talloc_zero(memCtx, uint64_t); *data = MAPILongLongValue (memCtx, fid);
*llongValue = fid;
*data = llongValue;
case PR_MID: case PR_MID:
llongValue = talloc_zero(memCtx, uint64_t); mappingId = [mapping idFromURL: childURL];
*llongValue = [mapping idFromURL: childURL]; if (mappingId == NSNotFound)
if (*llongValue == NSNotFound) { {
[mapping registerURL: childURL]; [mapping registerURL: childURL];
*llongValue = [mapping idFromURL: childURL]; mappingId = [mapping idFromURL: childURL];
} }
*data = llongValue; *data = MAPILongLongValue (memCtx, mappingId);
break; break;
/* those are queried while they really pertain to the /* those are queried while they really pertain to the
@ -672,10 +693,8 @@ static MAPIStoreMapping *mapping = nil;
withFID: (uint64_t) fid withFID: (uint64_t) fid
{ {
// id child; // id child;
uint64_t *llongValue;
uint8_t *boolValue;
uint32_t *longValue;
struct Binary_r *binaryValue; struct Binary_r *binaryValue;
int64_t mappingId;
int rc; int rc;
NSString *parentURL; NSString *parentURL;
@ -683,27 +702,25 @@ static MAPIStoreMapping *mapping = nil;
switch (proptag) switch (proptag)
{ {
case PR_FID: case PR_FID:
llongValue = talloc_zero(memCtx, uint64_t); mappingId = [mapping idFromURL: childURL];
*llongValue = [mapping idFromURL: childURL]; if (mappingId == NSNotFound)
if (*llongValue == NSNotFound)
{ {
[mapping registerURL: childURL]; [mapping registerURL: childURL];
*llongValue = [mapping idFromURL: childURL]; mappingId = [mapping idFromURL: childURL];
} }
*data = llongValue; *data = MAPILongLongValue (memCtx, mappingId);
break; break;
case PR_PARENT_FID: case PR_PARENT_FID:
llongValue = talloc_zero(memCtx, uint64_t);
parentURL = [self _parentURLFromURL: childURL]; parentURL = [self _parentURLFromURL: childURL];
if (parentURL) if (parentURL)
{ {
*llongValue = [mapping idFromURL: childURL]; mappingId = [mapping idFromURL: parentURL];
if (*llongValue == NSNotFound) if (mappingId == NSNotFound)
{ {
[mapping registerURL: childURL]; [mapping registerURL: parentURL];
*llongValue = [mapping idFromURL: childURL]; mappingId = [mapping idFromURL: parentURL];
} }
*data = llongValue; *data = MAPILongLongValue (memCtx, mappingId);
} }
else else
{ {
@ -714,21 +731,17 @@ static MAPIStoreMapping *mapping = nil;
case PR_ATTR_HIDDEN: case PR_ATTR_HIDDEN:
case PR_ATTR_SYSTEM: case PR_ATTR_SYSTEM:
case PR_ATTR_READONLY: case PR_ATTR_READONLY:
boolValue = talloc_zero(memCtx, uint8_t); *data = MAPIBoolValue (memCtx, NO);
*boolValue = NO;
*data = boolValue;
break; break;
case PR_SUBFOLDERS: case PR_SUBFOLDERS:
boolValue = talloc_zero(memCtx, uint8_t); *data = MAPIBoolValue (memCtx,
*boolValue = ([[self _subfolderKeysForFolderURL: childURL] [[self _subfolderKeysForFolderURL: childURL]
count] > 0); count] > 0);
*data = boolValue;
break; break;
case PR_CONTENT_COUNT: case PR_CONTENT_COUNT:
longValue = talloc_zero(memCtx, uint32_t); *data = MAPILongValue (memCtx,
*longValue = ([[self _messageKeysForFolderURL: childURL] [[self _messageKeysForFolderURL: childURL]
count] > 0); count]);
*data = longValue;
break; break;
case PR_EXTENDED_FOLDER_FLAGS: // TODO: DOUBT: how to indicate the case PR_EXTENDED_FOLDER_FLAGS: // TODO: DOUBT: how to indicate the
// number of subresponses ? // number of subresponses ?

View File

@ -108,8 +108,6 @@ static Class SOGoUserFolderK;
inFolder: (SOGoFolder *) folder inFolder: (SOGoFolder *) folder
withFID: (uint64_t) fid withFID: (uint64_t) fid
{ {
uint8_t *boolValue;
uint32_t *longValue;
SOGoMailObject *child; SOGoMailObject *child;
NSCalendarDate *offsetDate; NSCalendarDate *offsetDate;
int rc; int rc;
@ -118,21 +116,18 @@ static Class SOGoUserFolderK;
switch (proptag) switch (proptag)
{ {
case PR_ICON_INDEX: // TODO case PR_ICON_INDEX: // TODO
longValue = talloc_zero(memCtx, uint32_t); /* read mail, see http://msdn.microsoft.com/en-us/library/cc815472.aspx */
*longValue = 0x00000100; /* read mail, see http://msdn.microsoft.com/en-us/library/cc815472.aspx */ *data = MAPILongValue (memCtx, 0x00000100);
*data = longValue;
break; break;
case PR_SUBJECT_UNICODE: case PR_SUBJECT_UNICODE:
child = [self lookupObject: childURL]; child = [self lookupObject: childURL];
*data = [[child decodedSubject] asUnicodeInMemCtx: memCtx]; *data = [[child decodedSubject] asUnicodeInMemCtx: memCtx];
break; break;
case PR_MESSAGE_CLASS_UNICODE: case PR_MESSAGE_CLASS_UNICODE:
*data = talloc_strdup(memCtx, "IPM.Note"); *data = talloc_strdup (memCtx, "IPM.Note");
break; break;
case PR_HASATTACH: case PR_HASATTACH: // TODO
boolValue = talloc_zero(memCtx, uint8_t); *data = MAPIBoolValue (memCtx, NO);
*boolValue = NO;
*data = boolValue;
break; break;
case PR_MESSAGE_DELIVERY_TIME: case PR_MESSAGE_DELIVERY_TIME:
child = [self lookupObject: childURL]; child = [self lookupObject: childURL];
@ -144,21 +139,15 @@ static Class SOGoUserFolderK;
case PR_MSG_STATUS: // TODO case PR_MSG_STATUS: // TODO
case PR_MESSAGE_FLAGS: // TODO case PR_MESSAGE_FLAGS: // TODO
case PR_SENSITIVITY: // TODO case PR_SENSITIVITY: // TODO
longValue = talloc_zero(memCtx, uint32_t); *data = MAPILongValue (memCtx, 0);
*longValue = 0;
*data = longValue;
break; break;
case PR_IMPORTANCE: case PR_IMPORTANCE: // TODO
longValue = talloc_zero(memCtx, uint32_t); *data = MAPILongValue (memCtx, 1);
*longValue = 1;
*data = longValue;
break; break;
case PR_MESSAGE_SIZE: // TODO case PR_MESSAGE_SIZE: // TODO
child = [self lookupObject: childURL]; child = [self lookupObject: childURL];
longValue = talloc_zero(memCtx, uint32_t);
/* TODO: choose another name for that method */ /* TODO: choose another name for that method */
*longValue = [[child davContentLength] intValue]; *data = MAPILongValue (memCtx, [[child davContentLength] intValue]);
*data = longValue;
break; break;
// #define PR_REPLY_TIME PROP_TAG(PT_SYSTIME , 0x0030) /* 0x00300040 */ // #define PR_REPLY_TIME PROP_TAG(PT_SYSTIME , 0x0030) /* 0x00300040 */
// #define PR_EXPIRY_TIME PROP_TAG(PT_SYSTIME , 0x0015) /* 0x00150040 */ // #define PR_EXPIRY_TIME PROP_TAG(PT_SYSTIME , 0x0015) /* 0x00150040 */
@ -194,19 +183,16 @@ static Class SOGoUserFolderK;
inFolder: (SOGoFolder *) folder inFolder: (SOGoFolder *) folder
withFID: (uint64_t) fid withFID: (uint64_t) fid
{ {
uint32_t *longValue;
int rc; int rc;
rc = MAPI_E_SUCCESS; rc = MAPI_E_SUCCESS;
switch (proptag) switch (proptag)
{ {
case PR_CONTENT_UNREAD: case PR_CONTENT_UNREAD:
longValue = talloc_zero(memCtx, uint32_t); *data = MAPILongValue (memCtx, 0);
*longValue = 0;
*data = longValue;
break; break;
case PR_CONTAINER_CLASS_UNICODE: case PR_CONTAINER_CLASS_UNICODE:
*data = talloc_strdup(memCtx, "IPF.Note"); *data = talloc_strdup (memCtx, "IPF.Note");
break; break;
default: default:
rc = [super getFolderTableChildproperty: data rc = [super getFolderTableChildproperty: data

View File

@ -71,26 +71,24 @@ static Class SOGoUserFolderK;
inFolder: (SOGoFolder *) folder inFolder: (SOGoFolder *) folder
withFID: (uint64_t) fid withFID: (uint64_t) fid
{ {
uint32_t *longValue;
uint8_t *boolValue;
NSString *status; NSString *status;
// id child; // id child;
id task; id task;
int32_t statusValue;
int rc; int rc;
rc = MAPI_E_SUCCESS; rc = MAPI_E_SUCCESS;
switch (proptag) switch (proptag)
{ {
case PR_ICON_INDEX: // TODO case PR_ICON_INDEX: // TODO
longValue = talloc_zero(memCtx, uint32_t); /* see http://msdn.microsoft.com/en-us/library/cc815472.aspx */
*longValue = 0x00000500; /* see http://msdn.microsoft.com/en-us/library/cc815472.aspx */
// Unassigned recurring task 0x00000501 // Unassigned recurring task 0x00000501
// Assignee's task 0x00000502 // Assignee's task 0x00000502
// Assigner's task 0x00000503 // Assigner's task 0x00000503
// Task request 0x00000504 // Task request 0x00000504
// Task acceptance 0x00000505 // Task acceptance 0x00000505
// Task rejection 0x00000506 // Task rejection 0x00000506
*data = longValue; *data = MAPILongValue (memCtx, 0x00000500);
break; break;
case PR_MESSAGE_CLASS_UNICODE: case PR_MESSAGE_CLASS_UNICODE:
*data = talloc_strdup(memCtx, "IPM.Task"); *data = talloc_strdup(memCtx, "IPM.Task");
@ -102,10 +100,9 @@ static Class SOGoUserFolderK;
*data = [[task summary] asUnicodeInMemCtx: memCtx]; *data = [[task summary] asUnicodeInMemCtx: memCtx];
break; break;
case 0x8124000b: // completed case 0x8124000b: // completed
boolValue = talloc_zero(memCtx, uint8_t);
task = [[self lookupObject: childURL] component: NO secure: NO]; task = [[self lookupObject: childURL] component: NO secure: NO];
*boolValue = [[task status] isEqualToString: @"COMPLETED"]; *data = MAPIBoolValue (memCtx,
*data = boolValue; [[task status] isEqualToString: @"COMPLETED"]);
break; break;
case 0x81250040: // completion date case 0x81250040: // completion date
task = [[self lookupObject: childURL] component: NO secure: NO]; task = [[self lookupObject: childURL] component: NO secure: NO];
@ -123,17 +120,18 @@ static Class SOGoUserFolderK;
*data = [[task lastModified] asFileTimeInMemCtx: memCtx]; *data = [[task lastModified] asFileTimeInMemCtx: memCtx];
break; break;
case 0x81200003: // status case 0x81200003: // status
longValue = talloc_zero(memCtx, uint32_t);
task = [[self lookupObject: childURL] component: NO secure: NO]; task = [[self lookupObject: childURL] component: NO secure: NO];
status = [task status]; status = [task status];
if (![status length] if (![status length]
|| [status isEqualToString: @"NEEDS-ACTIONS"]) || [status isEqualToString: @"NEEDS-ACTIONS"])
*longValue = 0; statusValue = 0;
else if ([status isEqualToString: @"IN-PROCESS"]) else if ([status isEqualToString: @"IN-PROCESS"])
*longValue = 1; statusValue = 1;
else if ([status isEqualToString: @"COMPLETED"]) else if ([status isEqualToString: @"COMPLETED"])
*longValue = 2; statusValue = 2;
*data = longValue; else
statusValue = 0xff;
*data = MAPILongValue (memCtx, statusValue);
break; break;
/* Completed */ /* Completed */
// - 0x81380003 = -2000 // - 0x81380003 = -2000
@ -144,9 +142,7 @@ static Class SOGoUserFolderK;
case 0x68340003: case 0x68340003:
case 0x683a0003: case 0x683a0003:
case 0x68410003: case 0x68410003:
longValue = talloc_zero(memCtx, uint32_t); *data = MAPILongValue (memCtx, 0);
*longValue = 0;
*data = longValue;
break; break;
default: default: