reindentation
Monotone-Parent: 215f30784ae8904703b5fa172c7a563bf8f3b464 Monotone-Revision: 2f37714ba202d0c2f6bc3c888440ea82ee601d66 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-10-01T20:35:29 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
43568edc76
commit
e4b127bb53
|
@ -1,6 +1,6 @@
|
|||
/* MAPIApplication.m - this file is part of $PROJECT_NAME_HERE$
|
||||
/* MAPIApplication.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2010 Wolfgang Sourdeau
|
||||
* Copyright (C) 2010 Inverse inc.
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
*
|
||||
|
@ -35,9 +35,9 @@ MAPIApplication *MAPIApp = nil;
|
|||
|
||||
@interface UnixSignalHandler : NSObject
|
||||
|
||||
+ sharedHandler;
|
||||
+ (id) sharedHandler;
|
||||
|
||||
- (void)removeObserver:(id)observer;
|
||||
- (void) removeObserver: (id) observer;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -45,61 +45,62 @@ MAPIApplication *MAPIApp = nil;
|
|||
|
||||
- (id) init
|
||||
{
|
||||
SOGoProductLoader *loader;
|
||||
NSUserDefaults *ud;
|
||||
SOGoSystemDefaults *sd;
|
||||
SOGoProductLoader *loader;
|
||||
NSUserDefaults *ud;
|
||||
SOGoSystemDefaults *sd;
|
||||
|
||||
if (!MAPIApp) {
|
||||
/* Here we work around a bug in GNUstep which decodes XML user
|
||||
defaults using the system encoding rather than honouring
|
||||
the encoding specified in the file. */
|
||||
putenv ("GNUSTEP_STRING_ENCODING=NSUTF8StringEncoding");
|
||||
if (!MAPIApp)
|
||||
{
|
||||
/* Here we work around a bug in GNUstep which decodes XML user
|
||||
defaults using the system encoding rather than honouring
|
||||
the encoding specified in the file. */
|
||||
putenv ("GNUSTEP_STRING_ENCODING=NSUTF8StringEncoding");
|
||||
|
||||
sd = [SOGoSystemDefaults sharedSystemDefaults];
|
||||
sd = [SOGoSystemDefaults sharedSystemDefaults];
|
||||
|
||||
// /* We force the plugin to base its configuration on the SOGo tree. */
|
||||
ud = [NSUserDefaults standardUserDefaults];
|
||||
[ud registerDefaults: [ud persistentDomainForName: @"sogod"]];
|
||||
// /* We force the plugin to base its configuration on the SOGo tree. */
|
||||
ud = [NSUserDefaults standardUserDefaults];
|
||||
[ud registerDefaults: [ud persistentDomainForName: @"sogod"]];
|
||||
|
||||
NSLog (@"(config check) imap server: %@", [sd imapServer]);
|
||||
NSLog (@"(config check) imap server: %@", [sd imapServer]);
|
||||
|
||||
// TODO publish
|
||||
loader = [SOGoProductLoader productLoader];
|
||||
[loader loadProducts: [NSArray arrayWithObjects:
|
||||
@"Contacts.SOGo",
|
||||
@"Appointments.SOGo",
|
||||
@"Mailer.SOGo",
|
||||
nil]];
|
||||
// TODO publish
|
||||
loader = [SOGoProductLoader productLoader];
|
||||
[loader loadProducts: [NSArray arrayWithObjects:
|
||||
@"Contacts.SOGo",
|
||||
@"Appointments.SOGo",
|
||||
@"Mailer.SOGo",
|
||||
nil]];
|
||||
|
||||
// TODO publish
|
||||
[iCalEntityObject initializeSOGoExtensions];
|
||||
// TODO publish
|
||||
[iCalEntityObject initializeSOGoExtensions];
|
||||
|
||||
MAPIApp = [super init];
|
||||
[MAPIApp retain];
|
||||
MAPIApp = [super init];
|
||||
[MAPIApp retain];
|
||||
|
||||
/* This is a hack to revert what is done in [WOCoreApplication
|
||||
init] */
|
||||
[[NSClassFromString(@"UnixSignalHandler") sharedHandler]
|
||||
/* This is a hack to revert what is done in [WOCoreApplication
|
||||
init] */
|
||||
[[NSClassFromString(@"UnixSignalHandler") sharedHandler]
|
||||
removeObserver: self];
|
||||
}
|
||||
}
|
||||
|
||||
return MAPIApp;
|
||||
return MAPIApp;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[mapiContext release];
|
||||
[super dealloc];
|
||||
[mapiContext release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void) setMAPIStoreContext: (MAPIStoreContext *) newMAPIStoreContext
|
||||
{
|
||||
ASSIGN (mapiContext, newMAPIStoreContext);
|
||||
ASSIGN (mapiContext, newMAPIStoreContext);
|
||||
}
|
||||
|
||||
- (id) authenticatorInContext: (id) context
|
||||
{
|
||||
return [mapiContext authenticator];
|
||||
return [mapiContext authenticator];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* MAPIStoreAuthenticator.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2010 Wolfgang Sourdeau
|
||||
* Copyright (C) 2010 Inverse inc.
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
*
|
||||
|
|
|
@ -41,22 +41,22 @@ static Class SOGoUserFolderK;
|
|||
|
||||
+ (void) initialize
|
||||
{
|
||||
SOGoUserFolderK = [SOGoUserFolderK class];
|
||||
SOGoUserFolderK = [SOGoUserFolder class];
|
||||
}
|
||||
|
||||
- (void) setupModuleFolder
|
||||
{
|
||||
id userFolder;
|
||||
id userFolder;
|
||||
|
||||
userFolder = [SOGoUserFolderK objectWithName: [authenticator username]
|
||||
inContainer: MAPIApp];
|
||||
[woContext setClientObject: userFolder];
|
||||
[userFolder retain]; // LEAK
|
||||
userFolder = [SOGoUserFolderK objectWithName: [authenticator username]
|
||||
inContainer: MAPIApp];
|
||||
[woContext setClientObject: userFolder];
|
||||
[userFolder retain]; // LEAK
|
||||
|
||||
moduleFolder = [userFolder lookupName: @"Calendar"
|
||||
inContext: woContext
|
||||
acquire: NO];
|
||||
[moduleFolder retain];
|
||||
moduleFolder = [userFolder lookupName: @"Calendar"
|
||||
inContext: woContext
|
||||
acquire: NO];
|
||||
[moduleFolder retain];
|
||||
}
|
||||
|
||||
- (int) getMessageTableChildproperty: (void **) data
|
||||
|
@ -65,97 +65,98 @@ static Class SOGoUserFolderK;
|
|||
inFolder: (SOGoFolder *) folder
|
||||
withFID: (uint64_t) fid
|
||||
{
|
||||
uint32_t *longValue;
|
||||
uint8_t *boolValue;
|
||||
// id child;
|
||||
id event;
|
||||
int rc;
|
||||
uint32_t *longValue;
|
||||
uint8_t *boolValue;
|
||||
// id child;
|
||||
id event;
|
||||
int rc;
|
||||
|
||||
rc = MAPI_E_SUCCESS;
|
||||
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 */
|
||||
// *longValue = 0x00000401 for recurring event
|
||||
// *longValue = 0x00000402 for meeting
|
||||
// *longValue = 0x00000403 for recurring meeting
|
||||
// *longValue = 0x00000404 for invitation
|
||||
*data = longValue;
|
||||
break;
|
||||
case PR_MESSAGE_CLASS_UNICODE:
|
||||
*data = talloc_strdup(memCtx, "IPM.Appointment");
|
||||
break;
|
||||
case 0x818f0040: // DTSTART
|
||||
event = [[self lookupObject: childURL] component: NO secure: NO];
|
||||
*data = [[event startDate] asFileTimeInMemCtx: memCtx];
|
||||
break;
|
||||
case 0x818a0040: // DTEND
|
||||
event = [[self lookupObject: childURL] component: NO secure: NO];
|
||||
*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;
|
||||
break;
|
||||
case PR_SUBJECT_UNICODE: // SUMMARY
|
||||
case PR_NORMALIZED_SUBJECT_UNICODE:
|
||||
case PR_CONVERSATION_TOPIC_UNICODE:
|
||||
event = [[self lookupObject: childURL] component: NO secure: NO];
|
||||
*data = [[event summary] asUnicodeInMemCtx: memCtx];
|
||||
break;
|
||||
case 0x810c001f: // LOCATION
|
||||
event = [[self lookupObject: childURL] component: NO secure: NO];
|
||||
*data = [[event location] asUnicodeInMemCtx: memCtx];
|
||||
break;
|
||||
case 0x8224000b: // private (bool), should depend on CLASS
|
||||
boolValue = talloc_zero(memCtx, uint8_t);
|
||||
*boolValue = NO;
|
||||
*data = boolValue;
|
||||
break;
|
||||
case PR_SENSITIVITY: // not implemented, depends on CLASS
|
||||
// normal = 0, private = 2
|
||||
longValue = talloc_zero(memCtx, uint32_t);
|
||||
*longValue = 0;
|
||||
*data = longValue;
|
||||
break;
|
||||
rc = MAPI_E_SUCCESS;
|
||||
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 */
|
||||
// *longValue = 0x00000401 for recurring event
|
||||
// *longValue = 0x00000402 for meeting
|
||||
// *longValue = 0x00000403 for recurring meeting
|
||||
// *longValue = 0x00000404 for invitation
|
||||
*data = longValue;
|
||||
break;
|
||||
case PR_MESSAGE_CLASS_UNICODE:
|
||||
*data = talloc_strdup(memCtx, "IPM.Appointment");
|
||||
break;
|
||||
case 0x818f0040: // DTSTART
|
||||
event = [[self lookupObject: childURL] component: NO secure: NO];
|
||||
*data = [[event startDate] asFileTimeInMemCtx: memCtx];
|
||||
break;
|
||||
case 0x818a0040: // DTEND
|
||||
event = [[self lookupObject: childURL] component: NO secure: NO];
|
||||
*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;
|
||||
break;
|
||||
case PR_SUBJECT_UNICODE: // SUMMARY
|
||||
case PR_NORMALIZED_SUBJECT_UNICODE:
|
||||
case PR_CONVERSATION_TOPIC_UNICODE:
|
||||
event = [[self lookupObject: childURL] component: NO secure: NO];
|
||||
*data = [[event summary] asUnicodeInMemCtx: memCtx];
|
||||
break;
|
||||
case 0x810c001f: // LOCATION
|
||||
event = [[self lookupObject: childURL] component: NO secure: NO];
|
||||
*data = [[event location] asUnicodeInMemCtx: memCtx];
|
||||
break;
|
||||
case 0x8224000b: // private (bool), should depend on CLASS
|
||||
boolValue = talloc_zero(memCtx, uint8_t);
|
||||
*boolValue = NO;
|
||||
*data = boolValue;
|
||||
break;
|
||||
case PR_SENSITIVITY: // not implemented, depends on CLASS
|
||||
// normal = 0, private = 2
|
||||
longValue = talloc_zero(memCtx, uint32_t);
|
||||
*longValue = 0;
|
||||
*data = longValue;
|
||||
break;
|
||||
|
||||
// case 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...");
|
||||
// break;
|
||||
default:
|
||||
rc = [super getMessageTableChildproperty: data
|
||||
atURL: childURL
|
||||
withTag: proptag
|
||||
inFolder: folder
|
||||
withFID: fid];
|
||||
}
|
||||
// case 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...");
|
||||
// break;
|
||||
default:
|
||||
rc = [super getMessageTableChildproperty: data
|
||||
atURL: childURL
|
||||
withTag: proptag
|
||||
inFolder: folder
|
||||
withFID: fid];
|
||||
}
|
||||
|
||||
// #define PR_REPLY_TIME PROP_TAG(PT_SYSTIME , 0x0030) /* 0x00300040 */
|
||||
// #define PR_MESSAGE_FLAGS PROP_TAG(PT_LONG , 0x0e07) /* 0x0e070003 */
|
||||
// #define PR_MSG_STATUS PROP_TAG(PT_LONG , 0x0e17) /* 0x0e170003 */
|
||||
// #define PR_INTERNET_MESSAGE_ID_UNICODE PROP_TAG(PT_UNICODE , 0x1035) /* 0x1035001f */
|
||||
// #define PR_FLAG_STATUS PROP_TAG(PT_LONG , 0x1090) /* 0x10900003 */
|
||||
// #define PR_CREATION_TIME PROP_TAG(PT_SYSTIME , 0x3007) /* 0x30070040 */
|
||||
// #define PR_SEARCH_KEY PROP_TAG(PT_BINARY , 0x300b) /* 0x300b0102 */
|
||||
// #define PR_REPLY_TIME PROP_TAG(PT_SYSTIME , 0x0030) /* 0x00300040 */
|
||||
// #define PR_MESSAGE_FLAGS PROP_TAG(PT_LONG , 0x0e07) /* 0x0e070003 */
|
||||
// #define PR_MSG_STATUS PROP_TAG(PT_LONG , 0x0e17) /* 0x0e170003 */
|
||||
// #define PR_INTERNET_MESSAGE_ID_UNICODE PROP_TAG(PT_UNICODE , 0x1035) /* 0x1035001f */
|
||||
// #define PR_FLAG_STATUS PROP_TAG(PT_LONG , 0x1090) /* 0x10900003 */
|
||||
// #define PR_CREATION_TIME PROP_TAG(PT_SYSTIME , 0x3007) /* 0x30070040 */
|
||||
// #define PR_SEARCH_KEY PROP_TAG(PT_BINARY , 0x300b) /* 0x300b0102 */
|
||||
|
||||
|
||||
// #define PR_EMS_AB_INCOMING_MSG_SIZE_LIMIT PROP_TAG(PT_LONG , 0x8190) /* 0x81900003 */
|
||||
// Not found: 81930003 // ?
|
||||
// Not found: 80fa000b // ?
|
||||
// Not found: 81c4000b // ?
|
||||
// Not found: 81e7000b // ?
|
||||
// Not found: 81ee000b // ?
|
||||
// #define PR_EMS_AB_INCOMING_MSG_SIZE_LIMIT PROP_TAG(PT_LONG , 0x8190) /* 0x81900003 */
|
||||
// Not found: 81930003 // ?
|
||||
// Not found: 80fa000b // ?
|
||||
// Not found: 81c4000b // ?
|
||||
// Not found: 81e7000b // ?
|
||||
// Not found: 81ee000b // ?
|
||||
|
||||
// Not found: 81f80003 //
|
||||
// Not found: 82020102 //
|
||||
// Not found: 818b0102 //
|
||||
// Not found: 81d1001f //
|
||||
// Not found: 81f80003 //
|
||||
// Not found: 82020102 //
|
||||
// Not found: 818b0102 //
|
||||
// Not found: 81d1001f //
|
||||
|
||||
return rc;
|
||||
return rc;
|
||||
}
|
||||
|
||||
// - (int) getFolderTableChildproperty: (void **) data
|
||||
|
|
|
@ -45,22 +45,22 @@ static Class SOGoUserFolderK;
|
|||
|
||||
+ (void) initialize
|
||||
{
|
||||
SOGoUserFolderK = [SOGoUserFolderK class];
|
||||
SOGoUserFolderK = [SOGoUserFolder class];
|
||||
}
|
||||
|
||||
- (void) setupModuleFolder
|
||||
{
|
||||
id userFolder;
|
||||
id userFolder;
|
||||
|
||||
userFolder = [SOGoUserFolderK objectWithName: [authenticator username]
|
||||
inContainer: MAPIApp];
|
||||
[woContext setClientObject: userFolder];
|
||||
[userFolder retain]; // LEAK
|
||||
userFolder = [SOGoUserFolderK objectWithName: [authenticator username]
|
||||
inContainer: MAPIApp];
|
||||
[woContext setClientObject: userFolder];
|
||||
[userFolder retain]; // LEAK
|
||||
|
||||
moduleFolder = [userFolder lookupName: @"Contacts"
|
||||
inContext: woContext
|
||||
acquire: NO];
|
||||
[moduleFolder retain];
|
||||
moduleFolder = [userFolder lookupName: @"Contacts"
|
||||
inContext: woContext
|
||||
acquire: NO];
|
||||
[moduleFolder retain];
|
||||
}
|
||||
|
||||
// - (int) getCommonTableChildproperty: (void **) data
|
||||
|
@ -120,7 +120,7 @@ static Class SOGoUserFolderK;
|
|||
}
|
||||
|
||||
if (!phone)
|
||||
phone = @"";
|
||||
phone = @"";
|
||||
|
||||
return phone;
|
||||
}
|
||||
|
@ -131,166 +131,168 @@ static Class SOGoUserFolderK;
|
|||
inFolder: (SOGoFolder *) folder
|
||||
withFID: (uint64_t) fid
|
||||
{
|
||||
NSString *stringValue;
|
||||
uint32_t *longValue;
|
||||
id child;
|
||||
int rc;
|
||||
NSString *stringValue;
|
||||
uint32_t *longValue;
|
||||
id child;
|
||||
int rc;
|
||||
|
||||
rc = MAPI_E_SUCCESS;
|
||||
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;
|
||||
break;
|
||||
case PR_MESSAGE_CLASS_UNICODE:
|
||||
*data = talloc_strdup(memCtx, "IPM.Contact");
|
||||
break;
|
||||
// case 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...");
|
||||
// break;
|
||||
case PR_SUBJECT_UNICODE:
|
||||
*data = talloc_strdup(memCtx, "PR_SUBJECT...");
|
||||
break;
|
||||
case 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;
|
||||
break;
|
||||
rc = MAPI_E_SUCCESS;
|
||||
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;
|
||||
break;
|
||||
case PR_MESSAGE_CLASS_UNICODE:
|
||||
*data = talloc_strdup(memCtx, "IPM.Contact");
|
||||
break;
|
||||
// case 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...");
|
||||
// break;
|
||||
case PR_SUBJECT_UNICODE:
|
||||
*data = talloc_strdup(memCtx, "PR_SUBJECT...");
|
||||
break;
|
||||
case 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;
|
||||
break;
|
||||
|
||||
case PR_TITLE_UNICODE:
|
||||
child = [self lookupObject: childURL];
|
||||
stringValue = [[child vCard] title];
|
||||
*data = [stringValue asUnicodeInMemCtx: memCtx];
|
||||
break;
|
||||
case PR_TITLE_UNICODE:
|
||||
child = [self lookupObject: childURL];
|
||||
stringValue = [[child vCard] title];
|
||||
*data = [stringValue asUnicodeInMemCtx: memCtx];
|
||||
break;
|
||||
|
||||
case PR_COMPANY_NAME_UNICODE:
|
||||
child = [self lookupObject: childURL];
|
||||
/* that's buggy but it's for the demo */
|
||||
stringValue = [[[child vCard] org] componentsJoinedByString: @", "];
|
||||
*data = [stringValue asUnicodeInMemCtx: memCtx];
|
||||
break;
|
||||
case PR_COMPANY_NAME_UNICODE:
|
||||
child = [self lookupObject: childURL];
|
||||
/* that's buggy but it's for the demo */
|
||||
stringValue = [[[child vCard] org] componentsJoinedByString: @", "];
|
||||
*data = [stringValue asUnicodeInMemCtx: memCtx];
|
||||
break;
|
||||
|
||||
case 0x3001001f: // Full Name
|
||||
case 0x81c2001f: // contact block title name
|
||||
rc = [super getMessageTableChildproperty: data
|
||||
atURL: childURL
|
||||
withTag: PR_DISPLAY_NAME_UNICODE
|
||||
inFolder: folder
|
||||
withFID: fid];
|
||||
break;
|
||||
case 0x81b0001f: // E-mail
|
||||
child = [self lookupObject: childURL];
|
||||
stringValue = [[child vCard] preferredEMail];
|
||||
*data = [stringValue asUnicodeInMemCtx: memCtx];
|
||||
break;
|
||||
case PR_BODY_UNICODE:
|
||||
child = [self lookupObject: childURL];
|
||||
stringValue = [[child vCard] note];
|
||||
*data = [stringValue asUnicodeInMemCtx: memCtx];
|
||||
break;
|
||||
case 0x3001001f: // Full Name
|
||||
case 0x81c2001f: // contact block title name
|
||||
rc = [super getMessageTableChildproperty: data
|
||||
atURL: childURL
|
||||
withTag: PR_DISPLAY_NAME_UNICODE
|
||||
inFolder: folder
|
||||
withFID: fid];
|
||||
break;
|
||||
case 0x81b0001f: // E-mail
|
||||
child = [self lookupObject: childURL];
|
||||
stringValue = [[child vCard] preferredEMail];
|
||||
*data = [stringValue asUnicodeInMemCtx: memCtx];
|
||||
break;
|
||||
case PR_BODY_UNICODE:
|
||||
child = [self lookupObject: childURL];
|
||||
stringValue = [[child vCard] note];
|
||||
*data = [stringValue asUnicodeInMemCtx: memCtx];
|
||||
break;
|
||||
|
||||
case PR_OFFICE_TELEPHONE_NUMBER_UNICODE:
|
||||
child = [self lookupObject: childURL];
|
||||
stringValue = [self _phoneOfType: @"work"
|
||||
excluding: @"fax"
|
||||
inCard: [child vCard]];
|
||||
*data = [stringValue asUnicodeInMemCtx: memCtx];
|
||||
break;
|
||||
case PR_HOME_TELEPHONE_NUMBER_UNICODE:
|
||||
child = [self lookupObject: childURL];
|
||||
stringValue = [self _phoneOfType: @"home"
|
||||
excluding: @"fax"
|
||||
inCard: [child vCard]];
|
||||
*data = [stringValue asUnicodeInMemCtx: memCtx];
|
||||
break;
|
||||
case PR_MOBILE_TELEPHONE_NUMBER_UNICODE:
|
||||
child = [self lookupObject: childURL];
|
||||
stringValue = [self _phoneOfType: @"cell"
|
||||
excluding: nil
|
||||
inCard: [child vCard]];
|
||||
*data = [stringValue asUnicodeInMemCtx: memCtx];
|
||||
break;
|
||||
case PR_PRIMARY_TELEPHONE_NUMBER_UNICODE:
|
||||
child = [self lookupObject: childURL];
|
||||
stringValue = [self _phoneOfType: @"pref"
|
||||
excluding: nil
|
||||
inCard: [child vCard]];
|
||||
*data = [stringValue asUnicodeInMemCtx: memCtx];
|
||||
break;
|
||||
case PR_OFFICE_TELEPHONE_NUMBER_UNICODE:
|
||||
child = [self lookupObject: childURL];
|
||||
stringValue = [self _phoneOfType: @"work"
|
||||
excluding: @"fax"
|
||||
inCard: [child vCard]];
|
||||
*data = [stringValue asUnicodeInMemCtx: memCtx];
|
||||
break;
|
||||
case PR_HOME_TELEPHONE_NUMBER_UNICODE:
|
||||
child = [self lookupObject: childURL];
|
||||
stringValue = [self _phoneOfType: @"home"
|
||||
excluding: @"fax"
|
||||
inCard: [child vCard]];
|
||||
*data = [stringValue asUnicodeInMemCtx: memCtx];
|
||||
break;
|
||||
case PR_MOBILE_TELEPHONE_NUMBER_UNICODE:
|
||||
child = [self lookupObject: childURL];
|
||||
stringValue = [self _phoneOfType: @"cell"
|
||||
excluding: nil
|
||||
inCard: [child vCard]];
|
||||
*data = [stringValue asUnicodeInMemCtx: memCtx];
|
||||
break;
|
||||
case PR_PRIMARY_TELEPHONE_NUMBER_UNICODE:
|
||||
child = [self lookupObject: childURL];
|
||||
stringValue = [self _phoneOfType: @"pref"
|
||||
excluding: nil
|
||||
inCard: [child vCard]];
|
||||
*data = [stringValue asUnicodeInMemCtx: memCtx];
|
||||
break;
|
||||
|
||||
// case PR_POSTAL_ADDRESS_UNICODE:
|
||||
// case PR_INTERNET_MESSAGE_ID_UNICODE:
|
||||
// case PR_CAR_TELEPHONE_NUMBER_UNICODE:
|
||||
// case PR_OTHER_TELEPHONE_NUMBER_UNICODE:
|
||||
// case PR_BUSINESS_FAX_NUMBER_UNICODE:
|
||||
// case PR_HOME_FAX_NUMBER_UNICODE:
|
||||
// case PR_COMPANY_MAIN_PHONE_NUMBER_UNICODE:
|
||||
// case PR_EMS_AB_GROUP_BY_ATTR_4_UNICODE:
|
||||
// case PR_CALLBACK_TELEPHONE_NUMBER_UNICODE:
|
||||
// case PR_DEPARTMENT_NAME_UNICODE:
|
||||
// case PR_OFFICE2_TELEPHONE_NUMBER_UNICODE:
|
||||
// case PR_RADIO_TELEPHONE_NUMBER_UNICODE:
|
||||
// case PR_PAGER_TELEPHONE_NUMBER_UNICODE:
|
||||
// case PR_PRIMARY_FAX_NUMBER_UNICODE:
|
||||
// case PR_TELEX_NUMBER_UNICODE:
|
||||
// case PR_ISDN_NUMBER_UNICODE:
|
||||
// case PR_ASSISTANT_TELEPHONE_NUMBER_UNICODE:
|
||||
// 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]");
|
||||
// break;
|
||||
// case PR_POSTAL_ADDRESS_UNICODE:
|
||||
// case PR_INTERNET_MESSAGE_ID_UNICODE:
|
||||
// case PR_CAR_TELEPHONE_NUMBER_UNICODE:
|
||||
// case PR_OTHER_TELEPHONE_NUMBER_UNICODE:
|
||||
// case PR_BUSINESS_FAX_NUMBER_UNICODE:
|
||||
// case PR_HOME_FAX_NUMBER_UNICODE:
|
||||
// case PR_COMPANY_MAIN_PHONE_NUMBER_UNICODE:
|
||||
// case PR_EMS_AB_GROUP_BY_ATTR_4_UNICODE:
|
||||
// case PR_CALLBACK_TELEPHONE_NUMBER_UNICODE:
|
||||
// case PR_DEPARTMENT_NAME_UNICODE:
|
||||
// case PR_OFFICE2_TELEPHONE_NUMBER_UNICODE:
|
||||
// case PR_RADIO_TELEPHONE_NUMBER_UNICODE:
|
||||
// case PR_PAGER_TELEPHONE_NUMBER_UNICODE:
|
||||
// case PR_PRIMARY_FAX_NUMBER_UNICODE:
|
||||
// case PR_TELEX_NUMBER_UNICODE:
|
||||
// case PR_ISDN_NUMBER_UNICODE:
|
||||
// case PR_ASSISTANT_TELEPHONE_NUMBER_UNICODE:
|
||||
// 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]");
|
||||
// break;
|
||||
|
||||
// (18:54:45) Wolfgang-: 0x80a7001f ( Business: ) -> don't ask me which "business"
|
||||
// (18:55:05) Wolfgang-: 0x809c001f ( Other: )
|
||||
// (18:55:58) Wolfgang-: 0x81b5001f: E-mail 2
|
||||
// (18:54:45) Wolfgang-: 0x80a7001f ( Business: ) -> don't ask me which "business"
|
||||
// (18:55:05) Wolfgang-: 0x809c001f ( Other: )
|
||||
// (18:55:58) Wolfgang-: 0x81b5001f: E-mail 2
|
||||
|
||||
|
||||
// #define PR_REPLY_TIME PROP_TAG(PT_SYSTIME , 0x0030) /* 0x00300040 */
|
||||
// #define PR_SENSITIVITY PROP_TAG(PT_LONG , 0x0036) /* 0x00360003 */
|
||||
// #define PR_FOLLOWUP_ICON PROP_TAG(PT_LONG , 0x1095) /* 0x10950003 */
|
||||
// #define PR_SEARCH_KEY PROP_TAG(PT_BINARY , 0x300b) /* 0x300b0102 */
|
||||
// #define PR_VIEW_STYLE PROP_TAG(PT_LONG , 0x6834) /* 0x68340003 */
|
||||
// #define PR_VD_VERSION PROP_TAG(PT_LONG , 0x7007) /* 0x70070003 */
|
||||
// #define PR_REPLY_TIME PROP_TAG(PT_SYSTIME , 0x0030) /* 0x00300040 */
|
||||
// #define PR_SENSITIVITY PROP_TAG(PT_LONG , 0x0036) /* 0x00360003 */
|
||||
// #define PR_FOLLOWUP_ICON PROP_TAG(PT_LONG , 0x1095) /* 0x10950003 */
|
||||
// #define PR_SEARCH_KEY PROP_TAG(PT_BINARY , 0x300b) /* 0x300b0102 */
|
||||
// #define PR_VIEW_STYLE PROP_TAG(PT_LONG , 0x6834) /* 0x68340003 */
|
||||
// #define PR_VD_VERSION PROP_TAG(PT_LONG , 0x7007) /* 0x70070003 */
|
||||
|
||||
default:
|
||||
rc = [super getMessageTableChildproperty: data
|
||||
atURL: childURL
|
||||
withTag: proptag
|
||||
inFolder: folder
|
||||
withFID: fid];
|
||||
}
|
||||
default:
|
||||
rc = [super getMessageTableChildproperty: data
|
||||
atURL: childURL
|
||||
withTag: proptag
|
||||
inFolder: folder
|
||||
withFID: fid];
|
||||
}
|
||||
|
||||
return rc;
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (int) getFolderTableChildproperty: (void **) data
|
||||
atURL: (NSString *) childURL
|
||||
withTag: (uint32_t) proptag
|
||||
inFolder: (SOGoFolder *) folder
|
||||
withFID: (uint64_t) fid
|
||||
{
|
||||
int rc;
|
||||
// - (int) getFolderTableChildproperty: (void **) data
|
||||
// atURL: (NSString *) childURL
|
||||
// withTag: (uint32_t) proptag
|
||||
// inFolder: (SOGoFolder *) folder
|
||||
// withFID: (uint64_t) fid
|
||||
// {
|
||||
// int rc;
|
||||
|
||||
[self logWithFormat: @"XXXXX unexpected!!!!!!!!!"];
|
||||
rc = MAPI_E_SUCCESS;
|
||||
switch (proptag) {
|
||||
default:
|
||||
rc = [super getFolderTableChildproperty: data
|
||||
atURL: childURL
|
||||
withTag: proptag
|
||||
inFolder: folder
|
||||
withFID: fid];
|
||||
}
|
||||
// [self logWithFormat: @"XXXXX unexpected!!!!!!!!!"];
|
||||
// rc = MAPI_E_SUCCESS;
|
||||
// switch (proptag)
|
||||
// {
|
||||
// default:
|
||||
// rc = [super getFolderTableChildproperty: data
|
||||
// atURL: childURL
|
||||
// withTag: proptag
|
||||
// inFolder: folder
|
||||
// withFID: fid];
|
||||
// }
|
||||
|
||||
return rc;
|
||||
}
|
||||
// return rc;
|
||||
// }
|
||||
|
||||
@end
|
||||
|
|
|
@ -42,13 +42,15 @@
|
|||
|
||||
@interface MAPIStoreContext : NSObject
|
||||
{
|
||||
NSMutableDictionary *objectCache;
|
||||
MAPIStoreAuthenticator *authenticator;
|
||||
WOContext *woContext;
|
||||
NSMutableDictionary *messageCache;
|
||||
NSMutableDictionary *subfolderCache;
|
||||
SOGoFolder *moduleFolder;
|
||||
void *memCtx;
|
||||
NSMutableDictionary *objectCache;
|
||||
MAPIStoreAuthenticator *authenticator;
|
||||
WOContext *woContext;
|
||||
NSMutableDictionary *messageCache;
|
||||
NSMutableDictionary *subfolderCache;
|
||||
SOGoFolder *moduleFolder;
|
||||
void *memCtx;
|
||||
NSString *lastObjectURL;
|
||||
id lastObject;
|
||||
}
|
||||
|
||||
+ (id) contextFromURI: (const char *) newUri;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -39,32 +39,41 @@
|
|||
|
||||
static Class SOGoUserFolderK;
|
||||
|
||||
@implementation SOGoObject (LeakD)
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation MAPIStoreMailContext
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
SOGoUserFolderK = [SOGoUserFolderK class];
|
||||
SOGoUserFolderK = [SOGoUserFolder class];
|
||||
}
|
||||
|
||||
- (void) setupModuleFolder
|
||||
{
|
||||
id userFolder, accountsFolder;
|
||||
id userFolder, accountsFolder;
|
||||
|
||||
userFolder = [SOGoUserFolderK objectWithName: [authenticator username]
|
||||
inContainer: MAPIApp];
|
||||
[woContext setClientObject: userFolder];
|
||||
[userFolder retain]; // LEAK
|
||||
userFolder = [SOGoUserFolderK objectWithName: [authenticator username]
|
||||
inContainer: MAPIApp];
|
||||
[woContext setClientObject: userFolder];
|
||||
[userFolder retain]; // LEAK
|
||||
|
||||
accountsFolder = [userFolder lookupName: @"Mail"
|
||||
inContext: woContext
|
||||
acquire: NO];
|
||||
[woContext setClientObject: accountsFolder];
|
||||
[accountsFolder retain]; // LEAK
|
||||
accountsFolder = [userFolder lookupName: @"Mail"
|
||||
inContext: woContext
|
||||
acquire: NO];
|
||||
[woContext setClientObject: accountsFolder];
|
||||
[accountsFolder retain]; // LEAK
|
||||
|
||||
moduleFolder = [accountsFolder lookupName: @"0"
|
||||
inContext: woContext
|
||||
acquire: NO];
|
||||
[moduleFolder retain];
|
||||
moduleFolder = [accountsFolder lookupName: @"0"
|
||||
inContext: woContext
|
||||
acquire: NO];
|
||||
[moduleFolder retain];
|
||||
}
|
||||
|
||||
// - (int) getCommonTableChildproperty: (void **) data
|
||||
|
@ -94,88 +103,89 @@ static Class SOGoUserFolderK;
|
|||
inFolder: (SOGoFolder *) folder
|
||||
withFID: (uint64_t) fid
|
||||
{
|
||||
uint8_t *boolValue;
|
||||
uint32_t *longValue;
|
||||
SOGoMailObject *child;
|
||||
NSCalendarDate *offsetDate;
|
||||
int rc;
|
||||
uint8_t *boolValue;
|
||||
uint32_t *longValue;
|
||||
SOGoMailObject *child;
|
||||
NSCalendarDate *offsetDate;
|
||||
int rc;
|
||||
|
||||
rc = MAPI_E_SUCCESS;
|
||||
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;
|
||||
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");
|
||||
break;
|
||||
case PR_HASATTACH:
|
||||
boolValue = talloc_zero(memCtx, uint8_t);
|
||||
*boolValue = NO;
|
||||
*data = boolValue;
|
||||
break;
|
||||
case PR_MESSAGE_DELIVERY_TIME:
|
||||
child = [self lookupObject: childURL];
|
||||
offsetDate = [[child date] addYear: -1 month: 0 day: 0
|
||||
hour: 0 minute: 0 second: 0];
|
||||
*data = [offsetDate asFileTimeInMemCtx: memCtx];
|
||||
break;
|
||||
// case PR_ROW_TYPE: // TODO: DOUBT
|
||||
// longValue = talloc_zero(memCtx, uint32_t);
|
||||
// *longValue = 1;
|
||||
// *data = longValue;
|
||||
// break;
|
||||
case PR_FLAG_STATUS: // TODO
|
||||
case PR_MSG_STATUS: // TODO
|
||||
case PR_MESSAGE_FLAGS: // TODO
|
||||
case PR_SENSITIVITY: // TODO
|
||||
longValue = talloc_zero(memCtx, uint32_t);
|
||||
*longValue = 0;
|
||||
*data = longValue;
|
||||
break;
|
||||
case PR_IMPORTANCE:
|
||||
longValue = talloc_zero(memCtx, uint32_t);
|
||||
*longValue = 1;
|
||||
*data = longValue;
|
||||
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;
|
||||
break;
|
||||
// #define PR_REPLY_TIME PROP_TAG(PT_SYSTIME , 0x0030) /* 0x00300040 */
|
||||
// #define PR_EXPIRY_TIME PROP_TAG(PT_SYSTIME , 0x0015) /* 0x00150040 */
|
||||
// #define PR_MESSAGE_DELIVERY_TIME PROP_TAG(PT_SYSTIME , 0x0e06) /* 0x0e060040 */
|
||||
// #define PR_FOLLOWUP_ICON PROP_TAG(PT_LONG , 0x1095) /* 0x10950003 */
|
||||
// #define PR_ITEM_TEMPORARY_FLAGS PROP_TAG(PT_LONG , 0x1097) /* 0x10970003 */
|
||||
// #define PR_SEARCH_KEY PROP_TAG(PT_BINARY , 0x300b) /* 0x300b0102 */
|
||||
rc = MAPI_E_SUCCESS;
|
||||
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;
|
||||
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");
|
||||
break;
|
||||
case PR_HASATTACH:
|
||||
boolValue = talloc_zero(memCtx, uint8_t);
|
||||
*boolValue = NO;
|
||||
*data = boolValue;
|
||||
break;
|
||||
case PR_MESSAGE_DELIVERY_TIME:
|
||||
child = [self lookupObject: childURL];
|
||||
offsetDate = [[child date] addYear: -1 month: 0 day: 0
|
||||
hour: 0 minute: 0 second: 0];
|
||||
*data = [offsetDate asFileTimeInMemCtx: memCtx];
|
||||
break;
|
||||
// case PR_ROW_TYPE: // TODO: DOUBT
|
||||
// longValue = talloc_zero(memCtx, uint32_t);
|
||||
// *longValue = 1;
|
||||
// *data = longValue;
|
||||
// break;
|
||||
case PR_FLAG_STATUS: // TODO
|
||||
case PR_MSG_STATUS: // TODO
|
||||
case PR_MESSAGE_FLAGS: // TODO
|
||||
case PR_SENSITIVITY: // TODO
|
||||
longValue = talloc_zero(memCtx, uint32_t);
|
||||
*longValue = 0;
|
||||
*data = longValue;
|
||||
break;
|
||||
case PR_IMPORTANCE:
|
||||
longValue = talloc_zero(memCtx, uint32_t);
|
||||
*longValue = 1;
|
||||
*data = longValue;
|
||||
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;
|
||||
break;
|
||||
// #define PR_REPLY_TIME PROP_TAG(PT_SYSTIME , 0x0030) /* 0x00300040 */
|
||||
// #define PR_EXPIRY_TIME PROP_TAG(PT_SYSTIME , 0x0015) /* 0x00150040 */
|
||||
// #define PR_MESSAGE_DELIVERY_TIME PROP_TAG(PT_SYSTIME , 0x0e06) /* 0x0e060040 */
|
||||
// #define PR_FOLLOWUP_ICON PROP_TAG(PT_LONG , 0x1095) /* 0x10950003 */
|
||||
// #define PR_ITEM_TEMPORARY_FLAGS PROP_TAG(PT_LONG , 0x1097) /* 0x10970003 */
|
||||
// #define PR_SEARCH_KEY PROP_TAG(PT_BINARY , 0x300b) /* 0x300b0102 */
|
||||
|
||||
|
||||
|
||||
case PR_SENT_REPRESENTING_NAME_UNICODE:
|
||||
child = [self lookupObject: childURL];
|
||||
*data = [[child from] asUnicodeInMemCtx: memCtx];
|
||||
break;
|
||||
case PR_INTERNET_MESSAGE_ID_UNICODE:
|
||||
child = [self lookupObject: childURL];
|
||||
*data = [[child messageId] asUnicodeInMemCtx: memCtx];
|
||||
break;
|
||||
default:
|
||||
rc = [super getMessageTableChildproperty: data
|
||||
atURL: childURL
|
||||
withTag: proptag
|
||||
inFolder: folder
|
||||
withFID: fid];
|
||||
}
|
||||
case PR_SENT_REPRESENTING_NAME_UNICODE:
|
||||
child = [self lookupObject: childURL];
|
||||
*data = [[child from] asUnicodeInMemCtx: memCtx];
|
||||
break;
|
||||
case PR_INTERNET_MESSAGE_ID_UNICODE:
|
||||
child = [self lookupObject: childURL];
|
||||
*data = [[child messageId] asUnicodeInMemCtx: memCtx];
|
||||
break;
|
||||
default:
|
||||
rc = [super getMessageTableChildproperty: data
|
||||
atURL: childURL
|
||||
withTag: proptag
|
||||
inFolder: folder
|
||||
withFID: fid];
|
||||
}
|
||||
|
||||
return rc;
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (int) getFolderTableChildproperty: (void **) data
|
||||
|
@ -184,28 +194,29 @@ static Class SOGoUserFolderK;
|
|||
inFolder: (SOGoFolder *) folder
|
||||
withFID: (uint64_t) fid
|
||||
{
|
||||
uint32_t *longValue;
|
||||
int rc;
|
||||
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;
|
||||
break;
|
||||
case PR_CONTAINER_CLASS_UNICODE:
|
||||
*data = talloc_strdup(memCtx, "IPF.Note");
|
||||
break;
|
||||
default:
|
||||
rc = [super getFolderTableChildproperty: data
|
||||
atURL: childURL
|
||||
withTag: proptag
|
||||
inFolder: folder
|
||||
withFID: fid];
|
||||
}
|
||||
|
||||
return rc;
|
||||
rc = MAPI_E_SUCCESS;
|
||||
switch (proptag)
|
||||
{
|
||||
case PR_CONTENT_UNREAD:
|
||||
longValue = talloc_zero(memCtx, uint32_t);
|
||||
*longValue = 0;
|
||||
*data = longValue;
|
||||
break;
|
||||
case PR_CONTAINER_CLASS_UNICODE:
|
||||
*data = talloc_strdup(memCtx, "IPF.Note");
|
||||
break;
|
||||
default:
|
||||
rc = [super getFolderTableChildproperty: data
|
||||
atURL: childURL
|
||||
withTag: proptag
|
||||
inFolder: folder
|
||||
withFID: fid];
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* MAPIStoreMapping.m - this file is part of $PROJECT_NAME_HERE$
|
||||
/* MAPIStoreMapping.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2010 Inverse inc.
|
||||
*
|
||||
|
@ -35,102 +35,111 @@ static uint64_t idCounter = 0x200001;
|
|||
|
||||
- (id) init
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
mapping = [NSMutableDictionary new];
|
||||
reverseMapping = [NSMutableDictionary new];
|
||||
}
|
||||
|
||||
return self;
|
||||
if ((self = [super init]))
|
||||
{
|
||||
mapping = [NSMutableDictionary new];
|
||||
reverseMapping = [NSMutableDictionary new];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[mapping release];
|
||||
[reverseMapping release];
|
||||
[super dealloc];
|
||||
[mapping release];
|
||||
[reverseMapping release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSString *) urlFromID: (uint64_t) idNbr
|
||||
{
|
||||
NSNumber *key;
|
||||
|
||||
key = [NSNumber numberWithUnsignedLongLong: idNbr];
|
||||
|
||||
return [mapping objectForKey: key];
|
||||
NSNumber *key;
|
||||
|
||||
key = [NSNumber numberWithUnsignedLongLong: idNbr];
|
||||
|
||||
return [mapping objectForKey: key];
|
||||
}
|
||||
|
||||
- (uint64_t) idFromURL: (NSString *) url
|
||||
{
|
||||
NSNumber *idKey;
|
||||
uint64_t idNbr;
|
||||
|
||||
idKey = [reverseMapping objectForKey: url];
|
||||
if (idKey)
|
||||
idNbr = [idKey unsignedLongLongValue];
|
||||
else
|
||||
idNbr = NSNotFound;
|
||||
|
||||
return idNbr;
|
||||
NSNumber *idKey;
|
||||
uint64_t idNbr;
|
||||
|
||||
idKey = [reverseMapping objectForKey: url];
|
||||
if (idKey)
|
||||
idNbr = [idKey unsignedLongLongValue];
|
||||
else
|
||||
idNbr = NSNotFound;
|
||||
|
||||
return idNbr;
|
||||
}
|
||||
|
||||
- (BOOL) registerURL: (NSString *) urlString
|
||||
withID: (uint64_t) idNbr
|
||||
{
|
||||
NSNumber *idKey;
|
||||
BOOL rc;
|
||||
NSNumber *idKey;
|
||||
BOOL rc;
|
||||
|
||||
idKey = [NSNumber numberWithUnsignedLongLong: idNbr];
|
||||
if ([mapping objectForKey: idKey] || [reverseMapping objectForKey: urlString]) {
|
||||
[self errorWithFormat: @"attempt to double register an entry ('%@', %lld)",
|
||||
urlString, idNbr];
|
||||
rc = NO;
|
||||
}
|
||||
else {
|
||||
[mapping setObject: urlString forKey: idKey];
|
||||
[reverseMapping setObject: idKey forKey: urlString];
|
||||
rc = YES;
|
||||
[self logWithFormat: @"registered url '%@' with id %lld (0x%.8x)",
|
||||
urlString, idNbr, (uint32_t) idNbr];
|
||||
}
|
||||
idKey = [NSNumber numberWithUnsignedLongLong: idNbr];
|
||||
if ([mapping objectForKey: idKey]
|
||||
|| [reverseMapping objectForKey: urlString])
|
||||
{
|
||||
[self errorWithFormat: @"attempt to double register an entry ('%@', %lld)",
|
||||
urlString, idNbr];
|
||||
rc = NO;
|
||||
}
|
||||
else
|
||||
{
|
||||
[mapping setObject: urlString forKey: idKey];
|
||||
[reverseMapping setObject: idKey forKey: urlString];
|
||||
rc = YES;
|
||||
[self logWithFormat: @"registered url '%@' with id %lld (0x%.8x)",
|
||||
urlString, idNbr, (uint32_t) idNbr];
|
||||
}
|
||||
|
||||
return rc;
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (void) registerURL: (NSString *) urlString
|
||||
{
|
||||
uint64_t idNbr;
|
||||
|
||||
// newID = openchangedb_get_new_folderID();
|
||||
if (![reverseMapping objectForKey: urlString]) {
|
||||
if ([urlString isEqualToString: @"sogo://openchange:openchange@mail/folderINBOX"]) {
|
||||
idNbr = 0x160001;
|
||||
if (![self registerURL: urlString withID: idNbr])
|
||||
[self errorWithFormat: @"Unable to register root folder: %@",
|
||||
urlString];
|
||||
}
|
||||
// else if ([urlString isEqualToString: @"sogo://openchange:openchange@mail/folderSent"]) {
|
||||
// idNbr = 0x140001;
|
||||
// idCounter = idNbr;
|
||||
// }
|
||||
else if ([urlString isEqualToString: @"sogo://openchange:openchange@contacts/personal"]) {
|
||||
idNbr = 0x1a0001;
|
||||
if (![self registerURL: urlString withID: idNbr])
|
||||
[self errorWithFormat: @"Unable to register root folder: %@",
|
||||
urlString];
|
||||
}
|
||||
else if ([urlString isEqualToString: @"sogo://openchange:openchange@calendar/personal"]) {
|
||||
idNbr = 0x190001;
|
||||
if (![self registerURL: urlString withID: idNbr])
|
||||
[self errorWithFormat: @"Unable to register root folder: %@",
|
||||
urlString];
|
||||
}
|
||||
else {
|
||||
idCounter += idIncrement;
|
||||
while (![self registerURL: urlString withID: idCounter])
|
||||
idCounter += idIncrement;
|
||||
}
|
||||
// [self _registerURL: urlString withID: newID];
|
||||
uint64_t idNbr;
|
||||
|
||||
// newID = openchangedb_get_new_folderID();
|
||||
if (![reverseMapping objectForKey: urlString])
|
||||
{
|
||||
if ([urlString isEqualToString: @"sogo://openchange:openchange@mail/folderINBOX"])
|
||||
{
|
||||
idNbr = 0x160001;
|
||||
if (![self registerURL: urlString withID: idNbr])
|
||||
[self errorWithFormat: @"Unable to register root folder: %@",
|
||||
urlString];
|
||||
}
|
||||
// else if ([urlString isEqualToString: @"sogo://openchange:openchange@mail/folderSent"]) {
|
||||
// idNbr = 0x140001;
|
||||
// idCounter = idNbr;
|
||||
// }
|
||||
else if ([urlString isEqualToString: @"sogo://openchange:openchange@contacts/personal"])
|
||||
{
|
||||
idNbr = 0x1a0001;
|
||||
if (![self registerURL: urlString withID: idNbr])
|
||||
[self errorWithFormat: @"Unable to register root folder: %@",
|
||||
urlString];
|
||||
}
|
||||
else if ([urlString isEqualToString: @"sogo://openchange:openchange@calendar/personal"])
|
||||
{
|
||||
idNbr = 0x190001;
|
||||
if (![self registerURL: urlString withID: idNbr])
|
||||
[self errorWithFormat: @"Unable to register root folder: %@",
|
||||
urlString];
|
||||
}
|
||||
else
|
||||
{
|
||||
idCounter += idIncrement;
|
||||
while (![self registerURL: urlString withID: idCounter])
|
||||
idCounter += idIncrement;
|
||||
}
|
||||
// [self _registerURL: urlString withID: newID];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -1,25 +1,27 @@
|
|||
/*
|
||||
OpenChange Storage Abstraction Layer library
|
||||
SOGo backend
|
||||
|
||||
OpenChange Project
|
||||
|
||||
Copyright (C)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/* MAPIStoreSOGo.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2010 Inverse inc.
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* OpenChange SOGo storage backend */
|
||||
|
||||
#import <Foundation/NSAutoreleasePool.h>
|
||||
|
||||
#import "MAPIApplication.h"
|
||||
|
@ -36,13 +38,13 @@
|
|||
*/
|
||||
static int sogo_init(void)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
NSAutoreleasePool *pool;
|
||||
|
||||
pool = [NSAutoreleasePool new];
|
||||
[MAPIApplication new];
|
||||
[pool release];
|
||||
pool = [NSAutoreleasePool new];
|
||||
[MAPIApplication new];
|
||||
[pool release];
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -51,29 +53,29 @@ static int sogo_init(void)
|
|||
\param mem_ctx pointer to the memory context
|
||||
\param uri pointer to the sogo path
|
||||
\param private_data pointer to the private backend context
|
||||
*/
|
||||
*/
|
||||
|
||||
static int sogo_create_context(TALLOC_CTX *mem_ctx, const char *uri, void **private_data)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
sogo_context *cContext;
|
||||
MAPIStoreContext *context;
|
||||
NSAutoreleasePool *pool;
|
||||
sogo_context *cContext;
|
||||
MAPIStoreContext *context;
|
||||
|
||||
pool = [NSAutoreleasePool new];
|
||||
pool = [NSAutoreleasePool new];
|
||||
|
||||
DEBUG(0, ("[%s:%d]\n", __FUNCTION__, __LINE__));
|
||||
DEBUG(0, ("[%s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
context = [MAPIStoreContext contextFromURI: uri];
|
||||
[context setMemCtx: mem_ctx];
|
||||
[context retain];
|
||||
context = [MAPIStoreContext contextFromURI: uri];
|
||||
[context setMemCtx: mem_ctx];
|
||||
[context retain];
|
||||
|
||||
cContext = talloc_zero(mem_ctx, sogo_context);
|
||||
cContext->objcContext = context;
|
||||
*private_data = cContext;
|
||||
cContext = talloc_zero(mem_ctx, sogo_context);
|
||||
cContext->objcContext = context;
|
||||
*private_data = cContext;
|
||||
|
||||
[pool release];
|
||||
[pool release];
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
@ -83,24 +85,24 @@ static int sogo_create_context(TALLOC_CTX *mem_ctx, const char *uri, void **priv
|
|||
\param private_data pointer to the current sogo context
|
||||
|
||||
\return MAPISTORE_SUCCESS on success, otherwise MAPISTORE_ERROR
|
||||
*/
|
||||
*/
|
||||
static int sogo_delete_context(void *private_data)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
sogo_context *cContext;
|
||||
NSAutoreleasePool *pool;
|
||||
sogo_context *cContext;
|
||||
|
||||
pool = [NSAutoreleasePool new];
|
||||
pool = [NSAutoreleasePool new];
|
||||
|
||||
DEBUG(5, ("[%s:%d]\n", __FUNCTION__, __LINE__));
|
||||
DEBUG(5, ("[%s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
cContext = private_data;
|
||||
[cContext->objcContext release];
|
||||
cContext = private_data;
|
||||
[cContext->objcContext release];
|
||||
|
||||
[pool release];
|
||||
[pool release];
|
||||
|
||||
talloc_free (cContext);
|
||||
talloc_free (cContext);
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -109,25 +111,25 @@ static int sogo_delete_context(void *private_data)
|
|||
\param private_data pointer to the current sogo context
|
||||
|
||||
\return MAPISTORE_SUCCESS on success, otherwise MAPISTORE_ERROR
|
||||
*/
|
||||
*/
|
||||
static int sogo_release_record(void *private_data, uint64_t fmid, uint8_t type)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
NSAutoreleasePool *pool;
|
||||
|
||||
pool = [NSAutoreleasePool new];
|
||||
pool = [NSAutoreleasePool new];
|
||||
|
||||
DEBUG(5, ("[%s:%d]\n", __FUNCTION__, __LINE__));
|
||||
DEBUG(5, ("[%s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
switch (type) {
|
||||
case MAPISTORE_FOLDER:
|
||||
break;
|
||||
case MAPISTORE_MESSAGE:
|
||||
break;
|
||||
}
|
||||
switch (type) {
|
||||
case MAPISTORE_FOLDER:
|
||||
break;
|
||||
case MAPISTORE_MESSAGE:
|
||||
break;
|
||||
}
|
||||
|
||||
[pool release];
|
||||
[pool release];
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
@ -141,47 +143,47 @@ static int sogo_release_record(void *private_data, uint64_t fmid, uint8_t type)
|
|||
\param path pointer on pointer to the path to return
|
||||
|
||||
\return MAPISTORE_SUCCESS on success, otherwise MAPISTORE error
|
||||
*/
|
||||
*/
|
||||
static int sogo_get_path(void *private_data, uint64_t fmid,
|
||||
uint8_t type, char **path)
|
||||
uint8_t type, char **path)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
NSAutoreleasePool *pool;
|
||||
|
||||
pool = [NSAutoreleasePool new];
|
||||
pool = [NSAutoreleasePool new];
|
||||
|
||||
DEBUG(5, ("[%s:%d]\n", __FUNCTION__, __LINE__));
|
||||
DEBUG(5, ("[%s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
switch (type) {
|
||||
case MAPISTORE_FOLDER:
|
||||
break;
|
||||
case MAPISTORE_MESSAGE:
|
||||
break;
|
||||
}
|
||||
switch (type) {
|
||||
case MAPISTORE_FOLDER:
|
||||
break;
|
||||
case MAPISTORE_MESSAGE:
|
||||
break;
|
||||
}
|
||||
|
||||
[pool release];
|
||||
[pool release];
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
static int sogo_op_get_fid_by_name(void *private_data, uint64_t parent_fid, const char* foldername, uint64_t *fid)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
sogo_context *cContext;
|
||||
MAPIStoreContext *context;
|
||||
int rc;
|
||||
NSAutoreleasePool *pool;
|
||||
sogo_context *cContext;
|
||||
MAPIStoreContext *context;
|
||||
int rc;
|
||||
|
||||
pool = [NSAutoreleasePool new];
|
||||
pool = [NSAutoreleasePool new];
|
||||
|
||||
cContext = private_data;
|
||||
context = cContext->objcContext;
|
||||
[context setupRequest];
|
||||
cContext = private_data;
|
||||
context = cContext->objcContext;
|
||||
[context setupRequest];
|
||||
|
||||
rc = [context getFID: fid byName: foldername inParentFID: parent_fid];
|
||||
rc = [context getFID: fid byName: foldername inParentFID: parent_fid];
|
||||
|
||||
[context tearDownRequest];
|
||||
[pool release];
|
||||
[context tearDownRequest];
|
||||
[pool release];
|
||||
|
||||
return rc;
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
|
@ -191,27 +193,27 @@ static int sogo_op_get_fid_by_name(void *private_data, uint64_t parent_fid, cons
|
|||
\param private_data pointer to the current sogo context
|
||||
|
||||
\return MAPISTORE_SUCCESS on success, otherwise MAPISTORE_ERROR
|
||||
*/
|
||||
*/
|
||||
static int sogo_op_mkdir(void *private_data, uint64_t parent_fid, uint64_t fid,
|
||||
struct SRow *aRow)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
sogo_context *cContext;
|
||||
MAPIStoreContext *context;
|
||||
int rc;
|
||||
NSAutoreleasePool *pool;
|
||||
sogo_context *cContext;
|
||||
MAPIStoreContext *context;
|
||||
int rc;
|
||||
|
||||
pool = [NSAutoreleasePool new];
|
||||
pool = [NSAutoreleasePool new];
|
||||
|
||||
cContext = private_data;
|
||||
context = cContext->objcContext;
|
||||
[context setupRequest];
|
||||
cContext = private_data;
|
||||
context = cContext->objcContext;
|
||||
[context setupRequest];
|
||||
|
||||
rc = [context mkDir: aRow withFID: fid inParentFID: parent_fid];
|
||||
rc = [context mkDir: aRow withFID: fid inParentFID: parent_fid];
|
||||
|
||||
[context tearDownRequest];
|
||||
[pool release];
|
||||
[context tearDownRequest];
|
||||
[pool release];
|
||||
|
||||
return rc;
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
|
@ -223,26 +225,26 @@ static int sogo_op_mkdir(void *private_data, uint64_t parent_fid, uint64_t fid,
|
|||
\param fid the FID for the folder to delete
|
||||
|
||||
\return MAPISTORE_SUCCESS on success, otherwise MAPISTORE_ERROR
|
||||
*/
|
||||
*/
|
||||
static int sogo_op_rmdir(void *private_data, uint64_t parent_fid, uint64_t fid)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
sogo_context *cContext;
|
||||
MAPIStoreContext *context;
|
||||
int rc;
|
||||
NSAutoreleasePool *pool;
|
||||
sogo_context *cContext;
|
||||
MAPIStoreContext *context;
|
||||
int rc;
|
||||
|
||||
pool = [NSAutoreleasePool new];
|
||||
pool = [NSAutoreleasePool new];
|
||||
|
||||
cContext = private_data;
|
||||
context = cContext->objcContext;
|
||||
[context setupRequest];
|
||||
cContext = private_data;
|
||||
context = cContext->objcContext;
|
||||
[context setupRequest];
|
||||
|
||||
rc = [context rmDirWithFID: fid inParentFID: parent_fid];
|
||||
rc = [context rmDirWithFID: fid inParentFID: parent_fid];
|
||||
|
||||
[context tearDownRequest];
|
||||
[pool release];
|
||||
[context tearDownRequest];
|
||||
[pool release];
|
||||
|
||||
return rc;
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
|
@ -254,26 +256,26 @@ static int sogo_op_rmdir(void *private_data, uint64_t parent_fid, uint64_t fid)
|
|||
\param fid the identifier of the colder to open
|
||||
|
||||
\return MAPISTORE_SUCCESS on success, otherwise MAPISTORE_ERROR
|
||||
*/
|
||||
*/
|
||||
static int sogo_op_opendir(void *private_data, uint64_t parent_fid, uint64_t fid)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
sogo_context *cContext;
|
||||
MAPIStoreContext *context;
|
||||
int rc;
|
||||
NSAutoreleasePool *pool;
|
||||
sogo_context *cContext;
|
||||
MAPIStoreContext *context;
|
||||
int rc;
|
||||
|
||||
pool = [NSAutoreleasePool new];
|
||||
pool = [NSAutoreleasePool new];
|
||||
|
||||
cContext = private_data;
|
||||
context = cContext->objcContext;
|
||||
[context setupRequest];
|
||||
cContext = private_data;
|
||||
context = cContext->objcContext;
|
||||
[context setupRequest];
|
||||
|
||||
rc = [context openDir: fid inParentFID: parent_fid];
|
||||
rc = [context openDir: fid inParentFID: parent_fid];
|
||||
|
||||
[context tearDownRequest];
|
||||
[pool release];
|
||||
[context tearDownRequest];
|
||||
[pool release];
|
||||
|
||||
return rc;
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
|
@ -283,26 +285,26 @@ static int sogo_op_opendir(void *private_data, uint64_t parent_fid, uint64_t fid
|
|||
\param private_data pointer to the current sogo context
|
||||
|
||||
\return MAPISTORE_SUCCESS on success, otherwise MAPISTORE_ERROR
|
||||
*/
|
||||
*/
|
||||
static int sogo_op_closedir(void *private_data)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
sogo_context *cContext;
|
||||
MAPIStoreContext *context;
|
||||
int rc;
|
||||
NSAutoreleasePool *pool;
|
||||
sogo_context *cContext;
|
||||
MAPIStoreContext *context;
|
||||
int rc;
|
||||
|
||||
pool = [NSAutoreleasePool new];
|
||||
pool = [NSAutoreleasePool new];
|
||||
|
||||
cContext = private_data;
|
||||
context = cContext->objcContext;
|
||||
[context setupRequest];
|
||||
cContext = private_data;
|
||||
context = cContext->objcContext;
|
||||
[context setupRequest];
|
||||
|
||||
rc = [context closeDir];
|
||||
rc = [context closeDir];
|
||||
|
||||
[context tearDownRequest];
|
||||
[pool release];
|
||||
[context tearDownRequest];
|
||||
[pool release];
|
||||
|
||||
return rc;
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
|
@ -312,57 +314,57 @@ static int sogo_op_closedir(void *private_data)
|
|||
\param private_data pointer to the current sogo context
|
||||
|
||||
\return MAPISTORE_SUCCESS on success, otherwise MAPISTORE_ERROR
|
||||
*/
|
||||
*/
|
||||
static int sogo_op_readdir_count(void *private_data,
|
||||
uint64_t fid,
|
||||
uint8_t table_type,
|
||||
uint32_t *RowCount)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
sogo_context *cContext;
|
||||
MAPIStoreContext *context;
|
||||
int rc;
|
||||
NSAutoreleasePool *pool;
|
||||
sogo_context *cContext;
|
||||
MAPIStoreContext *context;
|
||||
int rc;
|
||||
|
||||
pool = [NSAutoreleasePool new];
|
||||
pool = [NSAutoreleasePool new];
|
||||
|
||||
cContext = private_data;
|
||||
context = cContext->objcContext;
|
||||
[context setupRequest];
|
||||
cContext = private_data;
|
||||
context = cContext->objcContext;
|
||||
[context setupRequest];
|
||||
|
||||
rc = [context readCount: RowCount ofTableType: table_type inFID: fid];
|
||||
rc = [context readCount: RowCount ofTableType: table_type inFID: fid];
|
||||
|
||||
[context tearDownRequest];
|
||||
[pool release];
|
||||
[context tearDownRequest];
|
||||
[pool release];
|
||||
|
||||
return rc;
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
static int sogo_op_get_table_property(void *private_data,
|
||||
uint64_t fid,
|
||||
uint8_t table_type,
|
||||
uint32_t pos,
|
||||
uint32_t proptag,
|
||||
void **data)
|
||||
uint64_t fid,
|
||||
uint8_t table_type,
|
||||
uint32_t pos,
|
||||
uint32_t proptag,
|
||||
void **data)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
sogo_context *cContext;
|
||||
MAPIStoreContext *context;
|
||||
int rc;
|
||||
NSAutoreleasePool *pool;
|
||||
sogo_context *cContext;
|
||||
MAPIStoreContext *context;
|
||||
int rc;
|
||||
|
||||
pool = [NSAutoreleasePool new];
|
||||
pool = [NSAutoreleasePool new];
|
||||
|
||||
cContext = private_data;
|
||||
context = cContext->objcContext;
|
||||
[context setupRequest];
|
||||
cContext = private_data;
|
||||
context = cContext->objcContext;
|
||||
[context setupRequest];
|
||||
|
||||
rc = [context getTableProperty: data withTag: proptag atPosition: pos
|
||||
withTableType: table_type inFID: fid];
|
||||
rc = [context getTableProperty: data withTag: proptag atPosition: pos
|
||||
withTableType: table_type inFID: fid];
|
||||
|
||||
[context tearDownRequest];
|
||||
[pool release];
|
||||
[context tearDownRequest];
|
||||
[pool release];
|
||||
|
||||
return rc;
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
|
@ -371,23 +373,23 @@ static int sogo_op_openmessage(void *private_data,
|
|||
uint64_t mid,
|
||||
struct mapistore_message *msg)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
sogo_context *cContext;
|
||||
MAPIStoreContext *context;
|
||||
int rc;
|
||||
NSAutoreleasePool *pool;
|
||||
sogo_context *cContext;
|
||||
MAPIStoreContext *context;
|
||||
int rc;
|
||||
|
||||
pool = [NSAutoreleasePool new];
|
||||
pool = [NSAutoreleasePool new];
|
||||
|
||||
cContext = private_data;
|
||||
context = cContext->objcContext;
|
||||
[context setupRequest];
|
||||
cContext = private_data;
|
||||
context = cContext->objcContext;
|
||||
[context setupRequest];
|
||||
|
||||
rc = [context openMessage: msg withMID: mid inFID: fid];
|
||||
rc = [context openMessage: msg withMID: mid inFID: fid];
|
||||
|
||||
[context tearDownRequest];
|
||||
[pool release];
|
||||
[context tearDownRequest];
|
||||
[pool release];
|
||||
|
||||
return rc;
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
|
@ -395,69 +397,69 @@ static int sogo_op_createmessage(void *private_data,
|
|||
uint64_t fid,
|
||||
uint64_t mid)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
sogo_context *cContext;
|
||||
MAPIStoreContext *context;
|
||||
int rc;
|
||||
NSAutoreleasePool *pool;
|
||||
sogo_context *cContext;
|
||||
MAPIStoreContext *context;
|
||||
int rc;
|
||||
|
||||
pool = [NSAutoreleasePool new];
|
||||
pool = [NSAutoreleasePool new];
|
||||
|
||||
cContext = private_data;
|
||||
context = cContext->objcContext;
|
||||
[context setupRequest];
|
||||
cContext = private_data;
|
||||
context = cContext->objcContext;
|
||||
[context setupRequest];
|
||||
|
||||
rc = [context createMessageWithMID: mid inFID: fid];
|
||||
rc = [context createMessageWithMID: mid inFID: fid];
|
||||
|
||||
[context tearDownRequest];
|
||||
[pool release];
|
||||
[context tearDownRequest];
|
||||
[pool release];
|
||||
|
||||
return rc;
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int sogo_op_savechangesmessage(void *private_data,
|
||||
uint64_t mid,
|
||||
uint8_t flags)
|
||||
uint64_t mid,
|
||||
uint8_t flags)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
sogo_context *cContext;
|
||||
MAPIStoreContext *context;
|
||||
int rc;
|
||||
NSAutoreleasePool *pool;
|
||||
sogo_context *cContext;
|
||||
MAPIStoreContext *context;
|
||||
int rc;
|
||||
|
||||
pool = [NSAutoreleasePool new];
|
||||
pool = [NSAutoreleasePool new];
|
||||
|
||||
cContext = private_data;
|
||||
context = cContext->objcContext;
|
||||
[context setupRequest];
|
||||
cContext = private_data;
|
||||
context = cContext->objcContext;
|
||||
[context setupRequest];
|
||||
|
||||
rc = [context saveChangesInMessageWithMID: mid andFlags: flags];
|
||||
rc = [context saveChangesInMessageWithMID: mid andFlags: flags];
|
||||
|
||||
[context tearDownRequest];
|
||||
[pool release];
|
||||
[context tearDownRequest];
|
||||
[pool release];
|
||||
|
||||
return rc;
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int sogo_op_submitmessage(void *private_data,
|
||||
uint64_t mid,
|
||||
uint8_t flags)
|
||||
uint64_t mid,
|
||||
uint8_t flags)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
sogo_context *cContext;
|
||||
MAPIStoreContext *context;
|
||||
int rc;
|
||||
NSAutoreleasePool *pool;
|
||||
sogo_context *cContext;
|
||||
MAPIStoreContext *context;
|
||||
int rc;
|
||||
|
||||
pool = [NSAutoreleasePool new];
|
||||
pool = [NSAutoreleasePool new];
|
||||
|
||||
cContext = private_data;
|
||||
context = cContext->objcContext;
|
||||
[context setupRequest];
|
||||
cContext = private_data;
|
||||
context = cContext->objcContext;
|
||||
[context setupRequest];
|
||||
|
||||
rc = [context submitMessageWithMID: mid andFlags: flags];
|
||||
rc = [context submitMessageWithMID: mid andFlags: flags];
|
||||
|
||||
[context tearDownRequest];
|
||||
[pool release];
|
||||
[context tearDownRequest];
|
||||
[pool release];
|
||||
|
||||
return rc;
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int sogo_op_getprops(void *private_data,
|
||||
|
@ -466,115 +468,125 @@ static int sogo_op_getprops(void *private_data,
|
|||
struct SPropTagArray *SPropTagArray,
|
||||
struct SRow *aRow)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
sogo_context *cContext;
|
||||
MAPIStoreContext *context;
|
||||
int rc;
|
||||
NSAutoreleasePool *pool;
|
||||
sogo_context *cContext;
|
||||
MAPIStoreContext *context;
|
||||
int rc;
|
||||
|
||||
pool = [NSAutoreleasePool new];
|
||||
pool = [NSAutoreleasePool new];
|
||||
|
||||
cContext = private_data;
|
||||
context = cContext->objcContext;
|
||||
[context setupRequest];
|
||||
cContext = private_data;
|
||||
context = cContext->objcContext;
|
||||
[context setupRequest];
|
||||
|
||||
rc = [context getProperties: SPropTagArray inRow: aRow withMID: fmid type: type];
|
||||
rc = [context getProperties: SPropTagArray inRow: aRow withMID: fmid type: type];
|
||||
|
||||
[context tearDownRequest];
|
||||
[pool release];
|
||||
[context tearDownRequest];
|
||||
[pool release];
|
||||
|
||||
return rc;
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
static int sogo_op_setprops(void *private_data,
|
||||
uint64_t fmid,
|
||||
uint8_t type,
|
||||
struct SRow *aRow)
|
||||
uint64_t fmid,
|
||||
uint8_t type,
|
||||
struct SRow *aRow)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
sogo_context *cContext;
|
||||
MAPIStoreContext *context;
|
||||
int rc;
|
||||
NSAutoreleasePool *pool;
|
||||
sogo_context *cContext;
|
||||
MAPIStoreContext *context;
|
||||
int rc;
|
||||
|
||||
pool = [NSAutoreleasePool new];
|
||||
pool = [NSAutoreleasePool new];
|
||||
|
||||
cContext = private_data;
|
||||
context = cContext->objcContext;
|
||||
[context setupRequest];
|
||||
cContext = private_data;
|
||||
context = cContext->objcContext;
|
||||
[context setupRequest];
|
||||
|
||||
rc = [context setPropertiesWithMID: fmid type: type inRow: aRow];
|
||||
rc = [context setPropertiesWithMID: fmid type: type inRow: aRow];
|
||||
|
||||
[context tearDownRequest];
|
||||
[pool release];
|
||||
[context tearDownRequest];
|
||||
[pool release];
|
||||
|
||||
return rc;
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int sogo_op_deletemessage(void *private_data,
|
||||
uint64_t mid,
|
||||
uint8_t flags)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
sogo_context *cContext;
|
||||
MAPIStoreContext *context;
|
||||
int rc;
|
||||
NSAutoreleasePool *pool;
|
||||
sogo_context *cContext;
|
||||
MAPIStoreContext *context;
|
||||
int rc;
|
||||
|
||||
pool = [NSAutoreleasePool new];
|
||||
pool = [NSAutoreleasePool new];
|
||||
|
||||
cContext = private_data;
|
||||
context = cContext->objcContext;
|
||||
[context setupRequest];
|
||||
cContext = private_data;
|
||||
context = cContext->objcContext;
|
||||
[context setupRequest];
|
||||
|
||||
rc = [context deleteMessageWithMID: mid withFlags: flags];
|
||||
rc = [context deleteMessageWithMID: mid withFlags: flags];
|
||||
|
||||
[context tearDownRequest];
|
||||
[pool release];
|
||||
[context tearDownRequest];
|
||||
[pool release];
|
||||
|
||||
return rc;
|
||||
return rc;
|
||||
}
|
||||
|
||||
/**
|
||||
\details Entry point for mapistore SOGO backend
|
||||
|
||||
\return MAPI_E_SUCCESS on success, otherwise MAPISTORE error
|
||||
*/
|
||||
*/
|
||||
int mapistore_init_backend(void)
|
||||
{
|
||||
struct mapistore_backend backend;
|
||||
int ret;
|
||||
struct mapistore_backend backend;
|
||||
int ret;
|
||||
static BOOL registered = NO;
|
||||
|
||||
/* Fill in our name */
|
||||
backend.name = "sogo";
|
||||
backend.description = "mapistore sogo backend";
|
||||
backend.namespace = "sogo://";
|
||||
if (registered)
|
||||
{
|
||||
ret = MAPISTORE_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
registered = YES;
|
||||
|
||||
/* Fill in our name */
|
||||
backend.name = "SOGo";
|
||||
backend.description = "mapistore SOGo backend";
|
||||
backend.namespace = "sogo://";
|
||||
|
||||
/* Fill in all the operations */
|
||||
backend.init = sogo_init;
|
||||
backend.create_context = sogo_create_context;
|
||||
backend.delete_context = sogo_delete_context;
|
||||
backend.release_record = sogo_release_record;
|
||||
backend.get_path = sogo_get_path;
|
||||
/* Fill in all the operations */
|
||||
backend.init = sogo_init;
|
||||
backend.create_context = sogo_create_context;
|
||||
backend.delete_context = sogo_delete_context;
|
||||
backend.release_record = sogo_release_record;
|
||||
backend.get_path = sogo_get_path;
|
||||
|
||||
backend.op_mkdir = sogo_op_mkdir;
|
||||
backend.op_rmdir = sogo_op_rmdir;
|
||||
backend.op_opendir = sogo_op_opendir;
|
||||
backend.op_closedir = sogo_op_closedir;
|
||||
backend.op_readdir_count = sogo_op_readdir_count;
|
||||
backend.op_get_table_property = sogo_op_get_table_property;
|
||||
backend.op_openmessage = sogo_op_openmessage;
|
||||
backend.op_createmessage = sogo_op_createmessage;
|
||||
backend.op_savechangesmessage = sogo_op_savechangesmessage;
|
||||
backend.op_submitmessage = sogo_op_submitmessage;
|
||||
backend.op_getprops = sogo_op_getprops;
|
||||
backend.op_get_fid_by_name = sogo_op_get_fid_by_name;
|
||||
backend.op_setprops = sogo_op_setprops;
|
||||
backend.op_deletemessage = sogo_op_deletemessage;
|
||||
backend.op_mkdir = sogo_op_mkdir;
|
||||
backend.op_rmdir = sogo_op_rmdir;
|
||||
backend.op_opendir = sogo_op_opendir;
|
||||
backend.op_closedir = sogo_op_closedir;
|
||||
backend.op_readdir_count = sogo_op_readdir_count;
|
||||
backend.op_get_table_property = sogo_op_get_table_property;
|
||||
backend.op_openmessage = sogo_op_openmessage;
|
||||
backend.op_createmessage = sogo_op_createmessage;
|
||||
backend.op_savechangesmessage = sogo_op_savechangesmessage;
|
||||
backend.op_submitmessage = sogo_op_submitmessage;
|
||||
backend.op_getprops = sogo_op_getprops;
|
||||
backend.op_get_fid_by_name = sogo_op_get_fid_by_name;
|
||||
backend.op_setprops = sogo_op_setprops;
|
||||
backend.op_deletemessage = sogo_op_deletemessage;
|
||||
|
||||
/* Register ourselves with the MAPISTORE subsystem */
|
||||
ret = mapistore_backend_register(&backend);
|
||||
if (ret != MAPISTORE_SUCCESS) {
|
||||
DEBUG(0, ("Failed to register the '%s' mapistore backend!\n", backend.name));
|
||||
}
|
||||
/* Register ourselves with the MAPISTORE subsystem */
|
||||
ret = mapistore_backend_register(&backend);
|
||||
if (ret != MAPISTORE_SUCCESS) {
|
||||
DEBUG(0, ("Failed to register the '%s' mapistore backend!\n", backend.name));
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -38,13 +38,14 @@
|
|||
NSTimeZone *utc;
|
||||
uint64_t interval;
|
||||
|
||||
if (!refDate) {
|
||||
utc = [NSTimeZone timeZoneWithName: @"UTC"];
|
||||
refDate = [NSCalendarDate dateWithYear: 1601 month: 1 day: 1
|
||||
hour: 0 minute: 0 second: 0
|
||||
timeZone: utc];
|
||||
[refDate retain];
|
||||
}
|
||||
if (!refDate)
|
||||
{
|
||||
utc = [NSTimeZone timeZoneWithName: @"UTC"];
|
||||
refDate = [NSCalendarDate dateWithYear: 1601 month: 1 day: 1
|
||||
hour: 0 minute: 0 second: 0
|
||||
timeZone: utc];
|
||||
[refDate retain];
|
||||
}
|
||||
interval = (((uint64_t) [self timeIntervalSinceDate: refDate]) * 10000000);
|
||||
timeValue = talloc_zero(memCtx, struct FILETIME);
|
||||
timeValue->dwLowDateTime = (uint32_t) (interval & 0xffffffff);
|
||||
|
|
|
@ -28,11 +28,11 @@
|
|||
|
||||
- (char *) asUnicodeInMemCtx: (void *) memCtx
|
||||
{
|
||||
char *unicode;
|
||||
char *unicode;
|
||||
|
||||
unicode = talloc_strdup(memCtx, [self UTF8String]);
|
||||
unicode = talloc_strdup (memCtx, [self UTF8String]);
|
||||
|
||||
return unicode;
|
||||
return unicode;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in New Issue