Monotone-Parent: 535269ec26cac9e28483df1693160af134682680
Monotone-Revision: 4a2e7b98be9bf00419ec1e19e3bfda5b9b0a9f8f Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-10-06T14:27:09 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
bc5c6979a3
commit
e8debc37e3
|
@ -3,6 +3,8 @@
|
|||
* OpenChange/MAPIStoreContext.m:
|
||||
(-getMessageTableChildproperty:atURL:withTag:inFolder:withFID:)
|
||||
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>
|
||||
|
||||
|
|
|
@ -73,8 +73,6 @@ static Class SOGoUserFolderK;
|
|||
inFolder: (SOGoFolder *) folder
|
||||
withFID: (uint64_t) fid
|
||||
{
|
||||
uint32_t *longValue;
|
||||
uint8_t *boolValue;
|
||||
// id child;
|
||||
id event;
|
||||
int rc;
|
||||
|
@ -83,13 +81,12 @@ static Class SOGoUserFolderK;
|
|||
switch (proptag)
|
||||
{
|
||||
case PR_ICON_INDEX: // TODO
|
||||
longValue = talloc_zero(memCtx, uint32_t);
|
||||
*longValue = 0x00000400; /* see http://msdn.microsoft.com/en-us/library/cc815472.aspx */
|
||||
/* 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
|
||||
*data = longValue;
|
||||
*data = MAPILongValue (memCtx, 0x00000400);
|
||||
break;
|
||||
case PR_MESSAGE_CLASS_UNICODE:
|
||||
*data = talloc_strdup(memCtx, "IPM.Appointment");
|
||||
|
@ -103,9 +100,7 @@ static Class SOGoUserFolderK;
|
|||
*data = [[event endDate] asFileTimeInMemCtx: memCtx];
|
||||
break;
|
||||
case 0x82410003: // LABEL idx, should be saved in an X- property
|
||||
longValue = talloc_zero(memCtx, uint32_t);
|
||||
*longValue = 0;
|
||||
*data = longValue;
|
||||
*data = MAPILongValue (memCtx, 0);
|
||||
break;
|
||||
case PR_SUBJECT_UNICODE: // SUMMARY
|
||||
case PR_NORMALIZED_SUBJECT_UNICODE:
|
||||
|
@ -118,15 +113,11 @@ static Class SOGoUserFolderK;
|
|||
*data = [[event location] asUnicodeInMemCtx: memCtx];
|
||||
break;
|
||||
case 0x8224000b: // private (bool), should depend on CLASS
|
||||
boolValue = talloc_zero(memCtx, uint8_t);
|
||||
*boolValue = NO;
|
||||
*data = boolValue;
|
||||
*data = MAPIBoolValue (memCtx, NO);
|
||||
break;
|
||||
case PR_SENSITIVITY: // not implemented, depends on CLASS
|
||||
// normal = 0, private = 2
|
||||
longValue = talloc_zero(memCtx, uint32_t);
|
||||
*longValue = 0;
|
||||
*data = longValue;
|
||||
*data = MAPILongValue (memCtx, 0);
|
||||
break;
|
||||
|
||||
// case PR_VD_NAME_UNICODE:
|
||||
|
|
|
@ -138,7 +138,6 @@ static Class SOGoUserFolderK;
|
|||
withFID: (uint64_t) fid
|
||||
{
|
||||
NSString *stringValue;
|
||||
uint32_t *longValue;
|
||||
id child;
|
||||
int rc;
|
||||
|
||||
|
@ -146,29 +145,27 @@ static Class SOGoUserFolderK;
|
|||
switch (proptag)
|
||||
{
|
||||
case PR_ICON_INDEX: // TODO
|
||||
longValue = talloc_zero(memCtx, uint32_t);
|
||||
*longValue = 0x00000200; /* see http://msdn.microsoft.com/en-us/library/cc815472.aspx */
|
||||
*data = longValue;
|
||||
/* see http://msdn.microsoft.com/en-us/library/cc815472.aspx */
|
||||
*data = MAPILongValue (memCtx, 0x00000200);
|
||||
break;
|
||||
case PR_MESSAGE_CLASS_UNICODE:
|
||||
*data = talloc_strdup(memCtx, "IPM.Contact");
|
||||
*data = talloc_strdup (memCtx, "IPM.Contact");
|
||||
break;
|
||||
// case PR_VD_NAME_UNICODE:
|
||||
// *data = talloc_strdup(memCtx, "PR_VD_NAME_UNICODE");
|
||||
// *data = talloc_strdup (memCtx, "PR_VD_NAME_UNICODE");
|
||||
// break;
|
||||
// case PR_EMS_AB_DXA_REMOTE_CLIENT_UNICODE: "Home:" ???
|
||||
// *data = talloc_strdup(memCtx, "PR_EMS...");
|
||||
// *data = talloc_strdup (memCtx, "PR_EMS...");
|
||||
// break;
|
||||
case PR_SUBJECT_UNICODE:
|
||||
*data = talloc_strdup(memCtx, "PR_SUBJECT...");
|
||||
*data = talloc_strdup (memCtx, "PR_SUBJECT...");
|
||||
break;
|
||||
case PR_OAB_NAME_UNICODE:
|
||||
*data = talloc_strdup(memCtx, "PR_OAB_NAME_UNICODE");
|
||||
*data = talloc_strdup (memCtx, "PR_OAB_NAME_UNICODE");
|
||||
break;
|
||||
case PR_OAB_LANGID:
|
||||
longValue = talloc_zero(memCtx, uint32_t);
|
||||
*longValue = 1033; /* English US */
|
||||
*data = longValue;
|
||||
/* English US */
|
||||
*data = MAPILongValue (memCtx, 1033);
|
||||
break;
|
||||
|
||||
case PR_TITLE_UNICODE:
|
||||
|
@ -252,7 +249,7 @@ static Class SOGoUserFolderK;
|
|||
// case PR_HOME2_TELEPHONE_NUMBER_UNICODE:
|
||||
// case PR_TTYTDD_PHONE_NUMBER_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;
|
||||
|
||||
// (18:54:45) Wolfgang-: 0x80a7001f ( Business: ) -> don't ask me which "business"
|
||||
|
|
|
@ -46,6 +46,10 @@
|
|||
|
||||
@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
|
||||
{
|
||||
NSMutableDictionary *objectCache;
|
||||
|
|
|
@ -60,6 +60,39 @@
|
|||
// SOGoMailFolderK = NSClassFromString (@"SOGoMailFolder");
|
||||
// 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;
|
||||
|
||||
@interface SOGoFolder (MAPIStoreProtocol)
|
||||
|
@ -577,52 +610,40 @@ static MAPIStoreMapping *mapping = nil;
|
|||
inFolder: (SOGoFolder *) folder
|
||||
withFID: (uint64_t) fid
|
||||
{
|
||||
uint32_t *longValue;
|
||||
uint64_t *llongValue;
|
||||
int rc;
|
||||
int64_t mappingId;
|
||||
|
||||
rc = MAPI_E_SUCCESS;
|
||||
switch (proptag)
|
||||
{
|
||||
case PR_INST_ID: // TODO: DOUBT
|
||||
llongValue = talloc_zero(memCtx, uint64_t);
|
||||
// *llongValue = 1;
|
||||
*llongValue = [childURL hash]; /* we return a unique id based on the url */
|
||||
*data = llongValue;
|
||||
/* we return a unique id based on the url */
|
||||
*data = MAPILongLongValue (memCtx, [childURL hash]);
|
||||
break;
|
||||
// case PR_INST_ID: // TODO: DOUBT
|
||||
case PR_DEPTH: // TODO: DOUBT
|
||||
longValue = talloc_zero(memCtx, uint32_t);
|
||||
*longValue = 0;
|
||||
*data = longValue;
|
||||
*data = MAPILongLongValue (memCtx, 0);
|
||||
break;
|
||||
case PR_ROW_TYPE: // TODO: DOUBT
|
||||
longValue = talloc_zero(memCtx, uint32_t);
|
||||
*longValue = TBL_LEAF_ROW;
|
||||
*data = longValue;
|
||||
*data = MAPILongValue (memCtx, TBL_LEAF_ROW);
|
||||
break;
|
||||
case PR_INSTANCE_NUM: // TODO: DOUBT
|
||||
longValue = talloc_zero(memCtx, uint32_t);
|
||||
*longValue = 0;
|
||||
*data = longValue;
|
||||
*data = MAPILongValue (memCtx, 0);
|
||||
break;
|
||||
case PR_VD_VERSION:
|
||||
longValue = talloc_zero(memCtx, uint32_t);
|
||||
*longValue = 8; /* mandatory value... wtf? */
|
||||
*data = longValue;
|
||||
/* mandatory value... wtf? */
|
||||
*data = MAPILongValue (memCtx, 8);
|
||||
break;
|
||||
case PR_FID:
|
||||
llongValue = talloc_zero(memCtx, uint64_t);
|
||||
*llongValue = fid;
|
||||
*data = llongValue;
|
||||
*data = MAPILongLongValue (memCtx, fid);
|
||||
case PR_MID:
|
||||
llongValue = talloc_zero(memCtx, uint64_t);
|
||||
*llongValue = [mapping idFromURL: childURL];
|
||||
if (*llongValue == NSNotFound) {
|
||||
[mapping registerURL: childURL];
|
||||
*llongValue = [mapping idFromURL: childURL];
|
||||
}
|
||||
*data = llongValue;
|
||||
mappingId = [mapping idFromURL: childURL];
|
||||
if (mappingId == NSNotFound)
|
||||
{
|
||||
[mapping registerURL: childURL];
|
||||
mappingId = [mapping idFromURL: childURL];
|
||||
}
|
||||
*data = MAPILongLongValue (memCtx, mappingId);
|
||||
break;
|
||||
|
||||
/* those are queried while they really pertain to the
|
||||
|
@ -672,10 +693,8 @@ static MAPIStoreMapping *mapping = nil;
|
|||
withFID: (uint64_t) fid
|
||||
{
|
||||
// id child;
|
||||
uint64_t *llongValue;
|
||||
uint8_t *boolValue;
|
||||
uint32_t *longValue;
|
||||
struct Binary_r *binaryValue;
|
||||
int64_t mappingId;
|
||||
int rc;
|
||||
NSString *parentURL;
|
||||
|
||||
|
@ -683,27 +702,25 @@ static MAPIStoreMapping *mapping = nil;
|
|||
switch (proptag)
|
||||
{
|
||||
case PR_FID:
|
||||
llongValue = talloc_zero(memCtx, uint64_t);
|
||||
*llongValue = [mapping idFromURL: childURL];
|
||||
if (*llongValue == NSNotFound)
|
||||
mappingId = [mapping idFromURL: childURL];
|
||||
if (mappingId == NSNotFound)
|
||||
{
|
||||
[mapping registerURL: childURL];
|
||||
*llongValue = [mapping idFromURL: childURL];
|
||||
mappingId = [mapping idFromURL: childURL];
|
||||
}
|
||||
*data = llongValue;
|
||||
*data = MAPILongLongValue (memCtx, mappingId);
|
||||
break;
|
||||
case PR_PARENT_FID:
|
||||
llongValue = talloc_zero(memCtx, uint64_t);
|
||||
parentURL = [self _parentURLFromURL: childURL];
|
||||
if (parentURL)
|
||||
{
|
||||
*llongValue = [mapping idFromURL: childURL];
|
||||
if (*llongValue == NSNotFound)
|
||||
mappingId = [mapping idFromURL: parentURL];
|
||||
if (mappingId == NSNotFound)
|
||||
{
|
||||
[mapping registerURL: childURL];
|
||||
*llongValue = [mapping idFromURL: childURL];
|
||||
[mapping registerURL: parentURL];
|
||||
mappingId = [mapping idFromURL: parentURL];
|
||||
}
|
||||
*data = llongValue;
|
||||
*data = MAPILongLongValue (memCtx, mappingId);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -714,21 +731,17 @@ static MAPIStoreMapping *mapping = nil;
|
|||
case PR_ATTR_HIDDEN:
|
||||
case PR_ATTR_SYSTEM:
|
||||
case PR_ATTR_READONLY:
|
||||
boolValue = talloc_zero(memCtx, uint8_t);
|
||||
*boolValue = NO;
|
||||
*data = boolValue;
|
||||
*data = MAPIBoolValue (memCtx, NO);
|
||||
break;
|
||||
case PR_SUBFOLDERS:
|
||||
boolValue = talloc_zero(memCtx, uint8_t);
|
||||
*boolValue = ([[self _subfolderKeysForFolderURL: childURL]
|
||||
count] > 0);
|
||||
*data = boolValue;
|
||||
*data = MAPIBoolValue (memCtx,
|
||||
[[self _subfolderKeysForFolderURL: childURL]
|
||||
count] > 0);
|
||||
break;
|
||||
case PR_CONTENT_COUNT:
|
||||
longValue = talloc_zero(memCtx, uint32_t);
|
||||
*longValue = ([[self _messageKeysForFolderURL: childURL]
|
||||
count] > 0);
|
||||
*data = longValue;
|
||||
*data = MAPILongValue (memCtx,
|
||||
[[self _messageKeysForFolderURL: childURL]
|
||||
count]);
|
||||
break;
|
||||
case PR_EXTENDED_FOLDER_FLAGS: // TODO: DOUBT: how to indicate the
|
||||
// number of subresponses ?
|
||||
|
|
|
@ -108,8 +108,6 @@ static Class SOGoUserFolderK;
|
|||
inFolder: (SOGoFolder *) folder
|
||||
withFID: (uint64_t) fid
|
||||
{
|
||||
uint8_t *boolValue;
|
||||
uint32_t *longValue;
|
||||
SOGoMailObject *child;
|
||||
NSCalendarDate *offsetDate;
|
||||
int rc;
|
||||
|
@ -118,21 +116,18 @@ static Class SOGoUserFolderK;
|
|||
switch (proptag)
|
||||
{
|
||||
case PR_ICON_INDEX: // TODO
|
||||
longValue = talloc_zero(memCtx, uint32_t);
|
||||
*longValue = 0x00000100; /* read mail, see http://msdn.microsoft.com/en-us/library/cc815472.aspx */
|
||||
*data = longValue;
|
||||
/* read mail, see http://msdn.microsoft.com/en-us/library/cc815472.aspx */
|
||||
*data = MAPILongValue (memCtx, 0x00000100);
|
||||
break;
|
||||
case PR_SUBJECT_UNICODE:
|
||||
child = [self lookupObject: childURL];
|
||||
*data = [[child decodedSubject] asUnicodeInMemCtx: memCtx];
|
||||
break;
|
||||
case PR_MESSAGE_CLASS_UNICODE:
|
||||
*data = talloc_strdup(memCtx, "IPM.Note");
|
||||
*data = talloc_strdup (memCtx, "IPM.Note");
|
||||
break;
|
||||
case PR_HASATTACH:
|
||||
boolValue = talloc_zero(memCtx, uint8_t);
|
||||
*boolValue = NO;
|
||||
*data = boolValue;
|
||||
case PR_HASATTACH: // TODO
|
||||
*data = MAPIBoolValue (memCtx, NO);
|
||||
break;
|
||||
case PR_MESSAGE_DELIVERY_TIME:
|
||||
child = [self lookupObject: childURL];
|
||||
|
@ -144,21 +139,15 @@ static Class SOGoUserFolderK;
|
|||
case PR_MSG_STATUS: // TODO
|
||||
case PR_MESSAGE_FLAGS: // TODO
|
||||
case PR_SENSITIVITY: // TODO
|
||||
longValue = talloc_zero(memCtx, uint32_t);
|
||||
*longValue = 0;
|
||||
*data = longValue;
|
||||
*data = MAPILongValue (memCtx, 0);
|
||||
break;
|
||||
case PR_IMPORTANCE:
|
||||
longValue = talloc_zero(memCtx, uint32_t);
|
||||
*longValue = 1;
|
||||
*data = longValue;
|
||||
case PR_IMPORTANCE: // TODO
|
||||
*data = MAPILongValue (memCtx, 1);
|
||||
break;
|
||||
case PR_MESSAGE_SIZE: // TODO
|
||||
child = [self lookupObject: childURL];
|
||||
longValue = talloc_zero(memCtx, uint32_t);
|
||||
/* TODO: choose another name for that method */
|
||||
*longValue = [[child davContentLength] intValue];
|
||||
*data = longValue;
|
||||
*data = MAPILongValue (memCtx, [[child davContentLength] intValue]);
|
||||
break;
|
||||
// #define PR_REPLY_TIME PROP_TAG(PT_SYSTIME , 0x0030) /* 0x00300040 */
|
||||
// #define PR_EXPIRY_TIME PROP_TAG(PT_SYSTIME , 0x0015) /* 0x00150040 */
|
||||
|
@ -194,19 +183,16 @@ static Class SOGoUserFolderK;
|
|||
inFolder: (SOGoFolder *) folder
|
||||
withFID: (uint64_t) fid
|
||||
{
|
||||
uint32_t *longValue;
|
||||
int rc;
|
||||
|
||||
rc = MAPI_E_SUCCESS;
|
||||
switch (proptag)
|
||||
{
|
||||
case PR_CONTENT_UNREAD:
|
||||
longValue = talloc_zero(memCtx, uint32_t);
|
||||
*longValue = 0;
|
||||
*data = longValue;
|
||||
*data = MAPILongValue (memCtx, 0);
|
||||
break;
|
||||
case PR_CONTAINER_CLASS_UNICODE:
|
||||
*data = talloc_strdup(memCtx, "IPF.Note");
|
||||
*data = talloc_strdup (memCtx, "IPF.Note");
|
||||
break;
|
||||
default:
|
||||
rc = [super getFolderTableChildproperty: data
|
||||
|
|
|
@ -71,26 +71,24 @@ static Class SOGoUserFolderK;
|
|||
inFolder: (SOGoFolder *) folder
|
||||
withFID: (uint64_t) fid
|
||||
{
|
||||
uint32_t *longValue;
|
||||
uint8_t *boolValue;
|
||||
NSString *status;
|
||||
// id child;
|
||||
id task;
|
||||
int32_t statusValue;
|
||||
int rc;
|
||||
|
||||
rc = MAPI_E_SUCCESS;
|
||||
switch (proptag)
|
||||
{
|
||||
case PR_ICON_INDEX: // TODO
|
||||
longValue = talloc_zero(memCtx, uint32_t);
|
||||
*longValue = 0x00000500; /* see http://msdn.microsoft.com/en-us/library/cc815472.aspx */
|
||||
/* see http://msdn.microsoft.com/en-us/library/cc815472.aspx */
|
||||
// Unassigned recurring task 0x00000501
|
||||
// Assignee's task 0x00000502
|
||||
// Assigner's task 0x00000503
|
||||
// Task request 0x00000504
|
||||
// Task acceptance 0x00000505
|
||||
// Task rejection 0x00000506
|
||||
*data = longValue;
|
||||
*data = MAPILongValue (memCtx, 0x00000500);
|
||||
break;
|
||||
case PR_MESSAGE_CLASS_UNICODE:
|
||||
*data = talloc_strdup(memCtx, "IPM.Task");
|
||||
|
@ -102,10 +100,9 @@ static Class SOGoUserFolderK;
|
|||
*data = [[task summary] asUnicodeInMemCtx: memCtx];
|
||||
break;
|
||||
case 0x8124000b: // completed
|
||||
boolValue = talloc_zero(memCtx, uint8_t);
|
||||
task = [[self lookupObject: childURL] component: NO secure: NO];
|
||||
*boolValue = [[task status] isEqualToString: @"COMPLETED"];
|
||||
*data = boolValue;
|
||||
*data = MAPIBoolValue (memCtx,
|
||||
[[task status] isEqualToString: @"COMPLETED"]);
|
||||
break;
|
||||
case 0x81250040: // completion date
|
||||
task = [[self lookupObject: childURL] component: NO secure: NO];
|
||||
|
@ -123,17 +120,18 @@ static Class SOGoUserFolderK;
|
|||
*data = [[task lastModified] asFileTimeInMemCtx: memCtx];
|
||||
break;
|
||||
case 0x81200003: // status
|
||||
longValue = talloc_zero(memCtx, uint32_t);
|
||||
task = [[self lookupObject: childURL] component: NO secure: NO];
|
||||
status = [task status];
|
||||
if (![status length]
|
||||
|| [status isEqualToString: @"NEEDS-ACTIONS"])
|
||||
*longValue = 0;
|
||||
statusValue = 0;
|
||||
else if ([status isEqualToString: @"IN-PROCESS"])
|
||||
*longValue = 1;
|
||||
statusValue = 1;
|
||||
else if ([status isEqualToString: @"COMPLETED"])
|
||||
*longValue = 2;
|
||||
*data = longValue;
|
||||
statusValue = 2;
|
||||
else
|
||||
statusValue = 0xff;
|
||||
*data = MAPILongValue (memCtx, statusValue);
|
||||
break;
|
||||
/* Completed */
|
||||
// - 0x81380003 = -2000
|
||||
|
@ -144,9 +142,7 @@ static Class SOGoUserFolderK;
|
|||
case 0x68340003:
|
||||
case 0x683a0003:
|
||||
case 0x68410003:
|
||||
longValue = talloc_zero(memCtx, uint32_t);
|
||||
*longValue = 0;
|
||||
*data = longValue;
|
||||
*data = MAPILongValue (memCtx, 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
Loading…
Reference in New Issue