Monotone-Parent: 4e23e038f2b0b7eddf8b30700b8c9a8910768f98
Monotone-Revision: 9235e5dc4d151a3cba8ad842ac39e1b2d18c8201 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-01-29T19:55:21 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
parent
a7da84c804
commit
4b81cb167d
31
ChangeLog
31
ChangeLog
|
@ -1,5 +1,36 @@
|
||||||
2012-01-29 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
2012-01-29 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
|
* OpenChange/MAPIStoreMailContext.[hm]: removed
|
||||||
|
"MAPIStoreInboxContext", "MAPIStoreSentItemsContext",
|
||||||
|
and child folders."MAPIStoreDraftsContext" and
|
||||||
|
"MAPIStoreOutboxContext" which have made obsolete by the new
|
||||||
|
provisioning and instantiation mechanisms.
|
||||||
|
|
||||||
|
* OpenChange/MAPIStoreContext.m (-woContext:, -mapping)
|
||||||
|
(-authenticator): those methods are now part of
|
||||||
|
MAPIStoreUserContext.
|
||||||
|
(-setupBaseFolder:): removed method, obsoleted by those below.
|
||||||
|
(-getRootFolder:withFID:): the "root folder" is now instantiated
|
||||||
|
by lookups from the root folder provided by the user context and
|
||||||
|
the chain of folders listed in the context url path.
|
||||||
|
(-MAPIStoreFolderClass): new method returning the Class object
|
||||||
|
representing the context's class of objects.
|
||||||
|
(-rootSOGoFolder): new method that returns the proper root folder
|
||||||
|
depending on the context's class of objects.
|
||||||
|
|
||||||
|
* OpenChange/MAPIStoreFolder.m (-initWithURL:inContext:): all
|
||||||
|
folders are now instantiated the same way since root objects are
|
||||||
|
now stored in the MAPIStoreUserContext instancesB.
|
||||||
|
(-setContext:): new setter to provide a reference to the folder's
|
||||||
|
mapistore context instance from the topmost parent.
|
||||||
|
(-setupVersionsMessage:): new helper method invoked during the
|
||||||
|
folder instantiations, from the moment its parent context has been
|
||||||
|
made available, which does not occur at the same moment for parent
|
||||||
|
and child folders...
|
||||||
|
|
||||||
|
* OpenChange/MAPIApplication.m (-init): removed the "mapiContext"
|
||||||
|
but added the "userContext" ivars.
|
||||||
|
|
||||||
* SoObjects/SOGo/SOGoFolder.m (-outlookFolderClass): removed
|
* SoObjects/SOGo/SOGoFolder.m (-outlookFolderClass): removed
|
||||||
useless method.
|
useless method.
|
||||||
|
|
||||||
|
|
|
@ -25,16 +25,16 @@
|
||||||
|
|
||||||
#import <NGObjWeb/SoApplication.h>
|
#import <NGObjWeb/SoApplication.h>
|
||||||
|
|
||||||
@class MAPIStoreContext;
|
@class MAPIStoreUserContext;
|
||||||
|
|
||||||
@interface MAPIApplication : SoApplication
|
@interface MAPIApplication : SoApplication
|
||||||
{
|
{
|
||||||
MAPIStoreContext *mapiContext;
|
MAPIStoreUserContext *userContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) authenticatorInContext: (id) context;
|
- (id) authenticatorInContext: (id) context;
|
||||||
|
|
||||||
- (void) setMAPIStoreContext: (MAPIStoreContext *) newMAPIStoreContext;
|
- (void) setUserContext: (MAPIStoreUserContext *) newContext;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
#import <Appointments/iCalEntityObject+SOGo.h>
|
#import <Appointments/iCalEntityObject+SOGo.h>
|
||||||
|
|
||||||
#import "MAPIStoreContext.h"
|
#import "MAPIStoreUserContext.h"
|
||||||
|
|
||||||
#import "MAPIApplication.h"
|
#import "MAPIApplication.h"
|
||||||
|
|
||||||
|
@ -69,18 +69,18 @@ MAPIApplication *MAPIApp = nil;
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
[mapiContext release];
|
[userContext release];
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setMAPIStoreContext: (MAPIStoreContext *) newMAPIStoreContext
|
- (void) setUserContext: (MAPIStoreUserContext *) newContext
|
||||||
{
|
{
|
||||||
ASSIGN (mapiContext, newMAPIStoreContext);
|
ASSIGN (userContext, newContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) authenticatorInContext: (id) context
|
- (id) authenticatorInContext: (id) context
|
||||||
{
|
{
|
||||||
return [mapiContext authenticator];
|
return [userContext authenticator];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -100,7 +100,7 @@
|
||||||
|
|
||||||
mapistoreMsg = talloc_zero (memCtx, struct mapistore_message);
|
mapistoreMsg = talloc_zero (memCtx, struct mapistore_message);
|
||||||
|
|
||||||
mapping = [[self context] mapping];
|
mapping = [self mapping];
|
||||||
|
|
||||||
attMessage = [self openEmbeddedMessage];
|
attMessage = [self openEmbeddedMessage];
|
||||||
if (attMessage)
|
if (attMessage)
|
||||||
|
|
|
@ -21,29 +21,39 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#import <Foundation/NSString.h>
|
#import <Foundation/NSString.h>
|
||||||
|
#import <Appointments/SOGoAppointmentFolders.h>
|
||||||
|
|
||||||
#import "MAPIStoreMapping.h"
|
#import "MAPIStoreMapping.h"
|
||||||
#import "MAPIStoreCalendarFolder.h"
|
#import "MAPIStoreCalendarFolder.h"
|
||||||
|
#import "MAPIStoreUserContext.h"
|
||||||
|
|
||||||
#import "MAPIStoreCalendarContext.h"
|
#import "MAPIStoreCalendarContext.h"
|
||||||
|
|
||||||
#undef DEBUG
|
#undef DEBUG
|
||||||
#include <mapistore/mapistore.h>
|
#include <mapistore/mapistore.h>
|
||||||
|
|
||||||
|
static Class MAPIStoreCalendarFolderK;
|
||||||
|
|
||||||
@implementation MAPIStoreCalendarContext
|
@implementation MAPIStoreCalendarContext
|
||||||
|
|
||||||
|
+ (void) initialize
|
||||||
|
{
|
||||||
|
MAPIStoreCalendarFolderK = [MAPIStoreCalendarFolder class];
|
||||||
|
}
|
||||||
|
|
||||||
+ (NSString *) MAPIModuleName
|
+ (NSString *) MAPIModuleName
|
||||||
{
|
{
|
||||||
return @"calendar";
|
return @"calendar";
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
||||||
|
withTDBIndexing: (struct tdb_wrap *) indexingTdb
|
||||||
inMemCtx: (TALLOC_CTX *) memCtx
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
{
|
{
|
||||||
struct mapistore_contexts_list *context;
|
struct mapistore_contexts_list *context;
|
||||||
|
|
||||||
context = talloc_zero(memCtx, struct mapistore_contexts_list);
|
context = talloc_zero(memCtx, struct mapistore_contexts_list);
|
||||||
context->url = talloc_asprintf (context, "sogo://%s@calendar/",
|
context->url = talloc_asprintf (context, "sogo://%s@calendar/personal",
|
||||||
[userName UTF8String]);
|
[userName UTF8String]);
|
||||||
// context->name = "Agenda personnel";
|
// context->name = "Agenda personnel";
|
||||||
context->main_folder = true;
|
context->main_folder = true;
|
||||||
|
@ -54,11 +64,14 @@
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setupBaseFolder: (NSURL *) newURL
|
- (Class) MAPIStoreFolderClass
|
||||||
{
|
{
|
||||||
baseFolder = [MAPIStoreCalendarFolder baseFolderWithURL: newURL
|
return MAPIStoreCalendarFolderK;
|
||||||
inContext: self];
|
}
|
||||||
[baseFolder retain];
|
|
||||||
|
- (id) rootSOGoFolder
|
||||||
|
{
|
||||||
|
return [userContext calendarRoot];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -43,37 +43,6 @@
|
||||||
|
|
||||||
@implementation MAPIStoreCalendarFolder
|
@implementation MAPIStoreCalendarFolder
|
||||||
|
|
||||||
- (id) initWithURL: (NSURL *) newURL
|
|
||||||
inContext: (MAPIStoreContext *) newContext
|
|
||||||
{
|
|
||||||
SOGoUserFolder *userFolder;
|
|
||||||
SOGoAppointmentFolders *parentFolder;
|
|
||||||
WOContext *woContext;
|
|
||||||
|
|
||||||
if ((self = [super initWithURL: newURL
|
|
||||||
inContext: newContext]))
|
|
||||||
{
|
|
||||||
woContext = [newContext woContext];
|
|
||||||
userFolder = [SOGoUserFolder objectWithName: [newURL user]
|
|
||||||
inContainer: MAPIApp];
|
|
||||||
[parentContainersBag addObject: userFolder];
|
|
||||||
[woContext setClientObject: userFolder];
|
|
||||||
|
|
||||||
parentFolder = [userFolder lookupName: @"Calendar"
|
|
||||||
inContext: woContext
|
|
||||||
acquire: NO];
|
|
||||||
[parentContainersBag addObject: parentFolder];
|
|
||||||
[woContext setClientObject: parentFolder];
|
|
||||||
|
|
||||||
sogoObject = [parentFolder lookupName: @"personal"
|
|
||||||
inContext: woContext
|
|
||||||
acquire: NO];
|
|
||||||
[sogoObject retain];
|
|
||||||
}
|
|
||||||
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (MAPIStoreMessageTable *) messageTable
|
- (MAPIStoreMessageTable *) messageTable
|
||||||
{
|
{
|
||||||
[self synchroniseCache];
|
[self synchroniseCache];
|
||||||
|
|
|
@ -56,6 +56,7 @@
|
||||||
#import "MAPIStoreMapping.h"
|
#import "MAPIStoreMapping.h"
|
||||||
#import "MAPIStoreRecurrenceUtils.h"
|
#import "MAPIStoreRecurrenceUtils.h"
|
||||||
#import "MAPIStoreTypes.h"
|
#import "MAPIStoreTypes.h"
|
||||||
|
#import "MAPIStoreUserContext.h"
|
||||||
#import "NSDate+MAPIStore.h"
|
#import "NSDate+MAPIStore.h"
|
||||||
#import "NSData+MAPIStore.h"
|
#import "NSData+MAPIStore.h"
|
||||||
#import "NSObject+MAPIStore.h"
|
#import "NSObject+MAPIStore.h"
|
||||||
|
@ -106,14 +107,16 @@
|
||||||
{
|
{
|
||||||
iCalEvent *event;
|
iCalEvent *event;
|
||||||
MAPIStoreContext *context;
|
MAPIStoreContext *context;
|
||||||
|
MAPIStoreUserContext *userContext;
|
||||||
|
|
||||||
if (!appointmentWrapper)
|
if (!appointmentWrapper)
|
||||||
{
|
{
|
||||||
event = [sogoObject component: NO secure: YES];
|
event = [sogoObject component: NO secure: YES];
|
||||||
context = [self context];
|
context = [self context];
|
||||||
|
userContext = [self userContext];
|
||||||
ASSIGN (appointmentWrapper,
|
ASSIGN (appointmentWrapper,
|
||||||
[MAPIStoreAppointmentWrapper wrapperWithICalEvent: event
|
[MAPIStoreAppointmentWrapper wrapperWithICalEvent: event
|
||||||
andUser: [context ownerUser]
|
andUser: [userContext sogoUser]
|
||||||
andSenderEmail: nil
|
andSenderEmail: nil
|
||||||
inTimeZone: [self ownerTimeZone]
|
inTimeZone: [self ownerTimeZone]
|
||||||
withConnectionInfo: [context connectionInfo]]);
|
withConnectionInfo: [context connectionInfo]]);
|
||||||
|
@ -551,7 +554,7 @@
|
||||||
existingCName = [[container sogoObject] resourceNameForEventUID: uid];
|
existingCName = [[container sogoObject] resourceNameForEventUID: uid];
|
||||||
if (existingCName)
|
if (existingCName)
|
||||||
{
|
{
|
||||||
mapping = [[self context] mapping];
|
mapping = [self mapping];
|
||||||
|
|
||||||
/* dissociate the object url from the old object's id */
|
/* dissociate the object url from the old object's id */
|
||||||
existingURL = [NSString stringWithFormat: @"%@%@",
|
existingURL = [NSString stringWithFormat: @"%@%@",
|
||||||
|
@ -568,7 +571,7 @@
|
||||||
[mapping registerURL: existingURL withID: objectId];
|
[mapping registerURL: existingURL withID: objectId];
|
||||||
|
|
||||||
/* reinstantiate the old sogo object and attach it to self */
|
/* reinstantiate the old sogo object and attach it to self */
|
||||||
woContext = [[self context] woContext];
|
woContext = [[self userContext] woContext];
|
||||||
existingObject = [[container sogoObject] lookupName: existingCName
|
existingObject = [[container sogoObject] lookupName: existingCName
|
||||||
inContext: woContext
|
inContext: woContext
|
||||||
acquire: NO];
|
acquire: NO];
|
||||||
|
@ -686,7 +689,7 @@
|
||||||
vCalendar = [iCalCalendar parseSingleFromSource: content];
|
vCalendar = [iCalCalendar parseSingleFromSource: content];
|
||||||
newEvent = [[vCalendar events] objectAtIndex: 0];
|
newEvent = [[vCalendar events] objectAtIndex: 0];
|
||||||
|
|
||||||
ownerUser = [[self context] ownerUser];
|
ownerUser = [[self userContext] sogoUser];
|
||||||
userPerson = [newEvent userAsAttendee: ownerUser];
|
userPerson = [newEvent userAsAttendee: ownerUser];
|
||||||
[newEvent setTimeStampAsDate: now];
|
[newEvent setTimeStampAsDate: now];
|
||||||
|
|
||||||
|
|
|
@ -22,28 +22,38 @@
|
||||||
|
|
||||||
#import <Foundation/NSString.h>
|
#import <Foundation/NSString.h>
|
||||||
|
|
||||||
|
#import <Contacts/SOGoContactFolders.h>
|
||||||
|
|
||||||
#import "MAPIStoreContactsFolder.h"
|
#import "MAPIStoreContactsFolder.h"
|
||||||
#import "MAPIStoreMapping.h"
|
#import "MAPIStoreUserContext.h"
|
||||||
|
|
||||||
#import "MAPIStoreContactsContext.h"
|
#import "MAPIStoreContactsContext.h"
|
||||||
|
|
||||||
#undef DEBUG
|
#undef DEBUG
|
||||||
#include <mapistore/mapistore.h>
|
#include <mapistore/mapistore.h>
|
||||||
|
|
||||||
|
static Class MAPIStoreContactsFolderK;
|
||||||
|
|
||||||
@implementation MAPIStoreContactsContext
|
@implementation MAPIStoreContactsContext
|
||||||
|
|
||||||
|
+ (void) initialize
|
||||||
|
{
|
||||||
|
MAPIStoreContactsFolderK = [MAPIStoreContactsFolder class];
|
||||||
|
}
|
||||||
|
|
||||||
+ (NSString *) MAPIModuleName
|
+ (NSString *) MAPIModuleName
|
||||||
{
|
{
|
||||||
return @"contacts";
|
return @"contacts";
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
||||||
|
withTDBIndexing: (struct tdb_wrap *) indexingTdb
|
||||||
inMemCtx: (TALLOC_CTX *) memCtx
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
{
|
{
|
||||||
struct mapistore_contexts_list *context;
|
struct mapistore_contexts_list *context;
|
||||||
|
|
||||||
context = talloc_zero(memCtx, struct mapistore_contexts_list);
|
context = talloc_zero(memCtx, struct mapistore_contexts_list);
|
||||||
context->url = talloc_asprintf (context, "sogo://%s@contacts/",
|
context->url = talloc_asprintf (context, "sogo://%s@contacts/personal",
|
||||||
[userName UTF8String]);
|
[userName UTF8String]);
|
||||||
// context->name = "Carnet d'adresses personnel";
|
// context->name = "Carnet d'adresses personnel";
|
||||||
context->main_folder = true;
|
context->main_folder = true;
|
||||||
|
@ -54,11 +64,14 @@
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setupBaseFolder: (NSURL *) newURL
|
- (Class) MAPIStoreFolderClass
|
||||||
{
|
{
|
||||||
baseFolder = [MAPIStoreContactsFolder baseFolderWithURL: newURL
|
return MAPIStoreContactsFolderK;
|
||||||
inContext: self];
|
}
|
||||||
[baseFolder retain];
|
|
||||||
|
- (id) rootSOGoFolder
|
||||||
|
{
|
||||||
|
return [userContext contactsRoot];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -39,37 +39,6 @@
|
||||||
|
|
||||||
@implementation MAPIStoreContactsFolder
|
@implementation MAPIStoreContactsFolder
|
||||||
|
|
||||||
- (id) initWithURL: (NSURL *) newURL
|
|
||||||
inContext: (MAPIStoreContext *) newContext
|
|
||||||
{
|
|
||||||
SOGoUserFolder *userFolder;
|
|
||||||
SOGoContactFolders *parentFolder;
|
|
||||||
WOContext *woContext;
|
|
||||||
|
|
||||||
if ((self = [super initWithURL: newURL
|
|
||||||
inContext: newContext]))
|
|
||||||
{
|
|
||||||
woContext = [newContext woContext];
|
|
||||||
userFolder = [SOGoUserFolder objectWithName: [newURL user]
|
|
||||||
inContainer: MAPIApp];
|
|
||||||
[parentContainersBag addObject: userFolder];
|
|
||||||
[woContext setClientObject: userFolder];
|
|
||||||
|
|
||||||
parentFolder = [userFolder lookupName: @"Contacts"
|
|
||||||
inContext: woContext
|
|
||||||
acquire: NO];
|
|
||||||
[parentContainersBag addObject: parentFolder];
|
|
||||||
[woContext setClientObject: parentFolder];
|
|
||||||
|
|
||||||
sogoObject = [parentFolder lookupName: @"personal"
|
|
||||||
inContext: woContext
|
|
||||||
acquire: NO];
|
|
||||||
[sogoObject retain];
|
|
||||||
}
|
|
||||||
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (MAPIStoreMessageTable *) messageTable
|
- (MAPIStoreMessageTable *) messageTable
|
||||||
{
|
{
|
||||||
[self synchroniseCache];
|
[self synchroniseCache];
|
||||||
|
|
|
@ -47,31 +47,26 @@
|
||||||
@class MAPIStoreAttachment;
|
@class MAPIStoreAttachment;
|
||||||
@class MAPIStoreAttachmentTable;
|
@class MAPIStoreAttachmentTable;
|
||||||
@class MAPIStoreFolder;
|
@class MAPIStoreFolder;
|
||||||
@class MAPIStoreMapping;
|
|
||||||
@class MAPIStoreMessage;
|
@class MAPIStoreMessage;
|
||||||
@class MAPIStoreTable;
|
@class MAPIStoreTable;
|
||||||
|
@class MAPIStoreUserContext;
|
||||||
|
|
||||||
@interface MAPIStoreContext : NSObject
|
@interface MAPIStoreContext : NSObject
|
||||||
{
|
{
|
||||||
struct mapistore_context *mstoreCtx;
|
|
||||||
struct mapistore_connection_info *connInfo;
|
struct mapistore_connection_info *connInfo;
|
||||||
|
|
||||||
SOGoUser *activeUser;
|
SOGoUser *activeUser;
|
||||||
SOGoUser *ownerUser;
|
|
||||||
|
MAPIStoreUserContext *userContext;
|
||||||
|
|
||||||
NSURL *contextUrl;
|
NSURL *contextUrl;
|
||||||
|
|
||||||
MAPIStoreMapping *mapping;
|
|
||||||
|
|
||||||
MAPIStoreAuthenticator *authenticator;
|
|
||||||
WOContext *woContext;
|
|
||||||
|
|
||||||
MAPIStoreFolder *baseFolder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (struct mapistore_contexts_list *) listAllContextsForUser: (NSString *) userName
|
+ (struct mapistore_contexts_list *) listAllContextsForUser: (NSString *) userName
|
||||||
|
withTDBIndexing: (struct tdb_wrap *) indexingTdb
|
||||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||||
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
||||||
|
withTDBIndexing: (struct tdb_wrap *) indexingTdb
|
||||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||||
|
|
||||||
+ (int) openContext: (MAPIStoreContext **) contextPtr
|
+ (int) openContext: (MAPIStoreContext **) contextPtr
|
||||||
|
@ -83,20 +78,12 @@
|
||||||
withConnectionInfo: (struct mapistore_connection_info *) newConnInfo
|
withConnectionInfo: (struct mapistore_connection_info *) newConnInfo
|
||||||
andTDBIndexing: (struct tdb_wrap *) indexingTdb;
|
andTDBIndexing: (struct tdb_wrap *) indexingTdb;
|
||||||
|
|
||||||
- (void) setAuthenticator: (MAPIStoreAuthenticator *) newAuthenticator;
|
|
||||||
- (MAPIStoreAuthenticator *) authenticator;
|
|
||||||
|
|
||||||
- (NSURL *) url;
|
- (NSURL *) url;
|
||||||
- (struct mapistore_connection_info *) connectionInfo;
|
- (struct mapistore_connection_info *) connectionInfo;
|
||||||
|
|
||||||
- (WOContext *) woContext;
|
- (MAPIStoreUserContext *) userContext;
|
||||||
- (MAPIStoreMapping *) mapping;
|
|
||||||
|
|
||||||
- (void) setupRequest;
|
|
||||||
- (void) tearDownRequest;
|
|
||||||
|
|
||||||
- (SOGoUser *) activeUser;
|
- (SOGoUser *) activeUser;
|
||||||
- (SOGoUser *) ownerUser;
|
|
||||||
|
|
||||||
// - (id) lookupObject: (NSString *) objectURLString;
|
// - (id) lookupObject: (NSString *) objectURLString;
|
||||||
|
|
||||||
|
@ -117,7 +104,11 @@
|
||||||
|
|
||||||
/* subclass methods */
|
/* subclass methods */
|
||||||
+ (NSString *) MAPIModuleName;
|
+ (NSString *) MAPIModuleName;
|
||||||
- (void) setupBaseFolder: (NSURL *) newURL;
|
- (Class) MAPIStoreFolderClass;
|
||||||
|
|
||||||
|
/* the top-most parent of the context folder: SOGoMailAccount,
|
||||||
|
SOGoCalendarFolders, ... */
|
||||||
|
- (id) rootSOGoFolder;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
|
@ -25,9 +25,7 @@
|
||||||
#import <Foundation/NSURL.h>
|
#import <Foundation/NSURL.h>
|
||||||
#import <Foundation/NSThread.h>
|
#import <Foundation/NSThread.h>
|
||||||
|
|
||||||
#import <NGObjWeb/WOContext.h>
|
|
||||||
#import <NGObjWeb/WOContext+SoObjects.h>
|
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||||
|
|
||||||
#import <NGExtensions/NSObject+Logs.h>
|
#import <NGExtensions/NSObject+Logs.h>
|
||||||
|
|
||||||
#import <SOGo/SOGoUser.h>
|
#import <SOGo/SOGoUser.h>
|
||||||
|
@ -35,10 +33,8 @@
|
||||||
#import "SOGoMAPIFSFolder.h"
|
#import "SOGoMAPIFSFolder.h"
|
||||||
#import "SOGoMAPIFSMessage.h"
|
#import "SOGoMAPIFSMessage.h"
|
||||||
|
|
||||||
#import "MAPIApplication.h"
|
|
||||||
#import "MAPIStoreAttachment.h"
|
#import "MAPIStoreAttachment.h"
|
||||||
// #import "MAPIStoreAttachmentTable.h"
|
// #import "MAPIStoreAttachmentTable.h"
|
||||||
#import "MAPIStoreAuthenticator.h"
|
|
||||||
#import "MAPIStoreFolder.h"
|
#import "MAPIStoreFolder.h"
|
||||||
#import "MAPIStoreFolderTable.h"
|
#import "MAPIStoreFolderTable.h"
|
||||||
#import "MAPIStoreMapping.h"
|
#import "MAPIStoreMapping.h"
|
||||||
|
@ -47,6 +43,7 @@
|
||||||
#import "MAPIStoreFAIMessage.h"
|
#import "MAPIStoreFAIMessage.h"
|
||||||
#import "MAPIStoreFAIMessageTable.h"
|
#import "MAPIStoreFAIMessageTable.h"
|
||||||
#import "MAPIStoreTypes.h"
|
#import "MAPIStoreTypes.h"
|
||||||
|
#import "MAPIStoreUserContext.h"
|
||||||
#import "NSArray+MAPIStore.h"
|
#import "NSArray+MAPIStore.h"
|
||||||
#import "NSObject+MAPIStore.h"
|
#import "NSObject+MAPIStore.h"
|
||||||
#import "NSString+MAPIStore.h"
|
#import "NSString+MAPIStore.h"
|
||||||
|
@ -69,7 +66,7 @@
|
||||||
|
|
||||||
/* sogo://username:password@{contacts,calendar,tasks,journal,notes,mail}/dossier/id */
|
/* sogo://username:password@{contacts,calendar,tasks,journal,notes,mail}/dossier/id */
|
||||||
|
|
||||||
static Class NSDataK, NSStringK, MAPIStoreFAIMessageK;
|
static Class NSExceptionK;
|
||||||
|
|
||||||
static NSMutableDictionary *contextClassMapping;
|
static NSMutableDictionary *contextClassMapping;
|
||||||
|
|
||||||
|
@ -80,9 +77,7 @@ static NSMutableDictionary *contextClassMapping;
|
||||||
NSUInteger count, max;
|
NSUInteger count, max;
|
||||||
NSString *moduleName;
|
NSString *moduleName;
|
||||||
|
|
||||||
NSDataK = [NSData class];
|
NSExceptionK = [NSException class];
|
||||||
NSStringK = [NSString class];
|
|
||||||
MAPIStoreFAIMessageK = [MAPIStoreFAIMessage class];
|
|
||||||
|
|
||||||
contextClassMapping = [NSMutableDictionary new];
|
contextClassMapping = [NSMutableDictionary new];
|
||||||
classes = GSObjCAllSubclassesOfClass (self);
|
classes = GSObjCAllSubclassesOfClass (self);
|
||||||
|
@ -101,15 +96,19 @@ static NSMutableDictionary *contextClassMapping;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
+ (struct mapistore_contexts_list *) listAllContextsForUser: (NSString *) userName
|
+ (struct mapistore_contexts_list *) listAllContextsForUser: (NSString *) userName
|
||||||
|
withTDBIndexing: (struct tdb_wrap *) indexingTdb
|
||||||
inMemCtx: (TALLOC_CTX *) memCtx
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
{
|
{
|
||||||
struct mapistore_contexts_list *list, *current;
|
struct mapistore_contexts_list *list, *current;
|
||||||
NSArray *classes;
|
NSArray *classes;
|
||||||
Class currentClass;
|
Class currentClass;
|
||||||
NSUInteger count, max;
|
NSUInteger count, max;
|
||||||
|
MAPIStoreUserContext *userContext;
|
||||||
|
|
||||||
|
userContext = [MAPIStoreUserContext userContextWithUsername: userName
|
||||||
|
andTDBIndexing: indexingTdb];
|
||||||
|
[userContext activateWithUser: [userContext sogoUser]];
|
||||||
list = NULL;
|
list = NULL;
|
||||||
|
|
||||||
classes = GSObjCAllSubclassesOfClass (self);
|
classes = GSObjCAllSubclassesOfClass (self);
|
||||||
|
@ -118,6 +117,7 @@ static NSMutableDictionary *contextClassMapping;
|
||||||
{
|
{
|
||||||
currentClass = [classes objectAtIndex: count];
|
currentClass = [classes objectAtIndex: count];
|
||||||
current = [currentClass listContextsForUser: userName
|
current = [currentClass listContextsForUser: userName
|
||||||
|
withTDBIndexing: indexingTdb
|
||||||
inMemCtx: memCtx];
|
inMemCtx: memCtx];
|
||||||
if (current)
|
if (current)
|
||||||
{
|
{
|
||||||
|
@ -130,49 +130,24 @@ static NSMutableDictionary *contextClassMapping;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
||||||
|
withTDBIndexing: (struct tdb_wrap *) indexingTdb
|
||||||
inMemCtx: (TALLOC_CTX *) memCtx
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline enum mapistore_error
|
static inline NSURL *CompleteURLFromMapistoreURI (const char *uri)
|
||||||
_prepareContextClass (Class contextClass,
|
|
||||||
struct mapistore_connection_info *connInfo,
|
|
||||||
struct tdb_wrap *indexingTdb, NSURL *url,
|
|
||||||
MAPIStoreContext **contextP)
|
|
||||||
{
|
{
|
||||||
MAPIStoreContext *context;
|
NSString *urlString;
|
||||||
MAPIStoreAuthenticator *authenticator;
|
NSURL *completeURL;
|
||||||
enum mapistore_error rc;
|
|
||||||
|
|
||||||
context = [[contextClass alloc] initFromURL: url
|
urlString = [NSString stringWithFormat: @"sogo://%@",
|
||||||
withConnectionInfo: connInfo
|
[NSString stringWithUTF8String: uri]];
|
||||||
andTDBIndexing: indexingTdb];
|
if (![urlString hasSuffix: @"/"])
|
||||||
if (context)
|
urlString = [urlString stringByAppendingString: @"/"];
|
||||||
{
|
completeURL = [NSURL URLWithString: [urlString stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]];
|
||||||
[context autorelease];
|
|
||||||
|
|
||||||
authenticator = [MAPIStoreAuthenticator new];
|
return completeURL;
|
||||||
[authenticator setUsername: [url user]];
|
|
||||||
[authenticator setPassword: [url password]];
|
|
||||||
[context setAuthenticator: authenticator];
|
|
||||||
[authenticator release];
|
|
||||||
|
|
||||||
[context setupRequest];
|
|
||||||
[context setupBaseFolder: url];
|
|
||||||
[context tearDownRequest];
|
|
||||||
if (context->baseFolder && [context->baseFolder sogoObject])
|
|
||||||
{
|
|
||||||
*contextP = context;
|
|
||||||
rc = MAPISTORE_SUCCESS;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
rc = MAPISTORE_ERR_DENIED;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
rc = MAPISTORE_ERROR;
|
|
||||||
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (int) openContext: (MAPIStoreContext **) contextPtr
|
+ (int) openContext: (MAPIStoreContext **) contextPtr
|
||||||
|
@ -182,7 +157,7 @@ _prepareContextClass (Class contextClass,
|
||||||
{
|
{
|
||||||
MAPIStoreContext *context;
|
MAPIStoreContext *context;
|
||||||
Class contextClass;
|
Class contextClass;
|
||||||
NSString *module, *completeURLString, *urlString;
|
NSString *module;
|
||||||
NSURL *baseURL;
|
NSURL *baseURL;
|
||||||
int rc = MAPISTORE_ERR_NOT_FOUND;
|
int rc = MAPISTORE_ERR_NOT_FOUND;
|
||||||
|
|
||||||
|
@ -190,41 +165,31 @@ _prepareContextClass (Class contextClass,
|
||||||
|
|
||||||
context = nil;
|
context = nil;
|
||||||
|
|
||||||
urlString = [NSString stringWithUTF8String: newUri];
|
baseURL = CompleteURLFromMapistoreURI (newUri);
|
||||||
if (urlString)
|
if (baseURL)
|
||||||
{
|
{
|
||||||
completeURLString = [@"sogo://" stringByAppendingString: urlString];
|
module = [baseURL host];
|
||||||
if (![completeURLString hasSuffix: @"/"])
|
if (module)
|
||||||
completeURLString = [completeURLString stringByAppendingString: @"/"];
|
|
||||||
baseURL = [NSURL URLWithString: [completeURLString stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]];
|
|
||||||
if (baseURL)
|
|
||||||
{
|
{
|
||||||
module = [baseURL host];
|
contextClass = [contextClassMapping objectForKey: module];
|
||||||
if (module)
|
if (contextClass)
|
||||||
{
|
{
|
||||||
contextClass = [contextClassMapping objectForKey: module];
|
context = [[contextClass alloc] initFromURL: baseURL
|
||||||
if (contextClass)
|
withConnectionInfo: newConnInfo
|
||||||
|
andTDBIndexing: indexingTdb];
|
||||||
|
if (context)
|
||||||
{
|
{
|
||||||
rc = _prepareContextClass (contextClass,
|
[context autorelease];
|
||||||
newConnInfo, indexingTdb,
|
rc = MAPISTORE_SUCCESS;
|
||||||
baseURL, &context);
|
*contextPtr = context;
|
||||||
if (rc == MAPISTORE_SUCCESS)
|
|
||||||
{
|
|
||||||
*contextPtr = context;
|
|
||||||
mapistore_mgmt_backend_register_user (newConnInfo,
|
|
||||||
"SOGo",
|
|
||||||
[[[context authenticator] username] UTF8String]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
NSLog (@"ERROR: unrecognized module name '%@'", module);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
NSLog (@"ERROR: unrecognized module name '%@'", module);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
NSLog (@"ERROR: url could not be parsed");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
NSLog (@"ERROR: url is an invalid UTF-8 string");
|
NSLog (@"ERROR: url could not be parsed");
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -233,9 +198,8 @@ _prepareContextClass (Class contextClass,
|
||||||
{
|
{
|
||||||
if ((self = [super init]))
|
if ((self = [super init]))
|
||||||
{
|
{
|
||||||
woContext = [WOContext contextWithRequest: nil];
|
activeUser = nil;
|
||||||
[woContext retain];
|
userContext = nil;
|
||||||
baseFolder = nil;
|
|
||||||
contextUrl = nil;
|
contextUrl = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,6 +214,26 @@ _prepareContextClass (Class contextClass,
|
||||||
|
|
||||||
if ((self = [self init]))
|
if ((self = [self init]))
|
||||||
{
|
{
|
||||||
|
ASSIGN (contextUrl, newUrl);
|
||||||
|
|
||||||
|
username = [newUrl user];
|
||||||
|
if ([username length] == 0)
|
||||||
|
{
|
||||||
|
[self errorWithFormat:
|
||||||
|
@"attempt to instantiate a context with an empty owner"];
|
||||||
|
[self release];
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
ASSIGN (userContext,
|
||||||
|
[MAPIStoreUserContext userContextWithUsername: username
|
||||||
|
andTDBIndexing: indexingTdb]);
|
||||||
|
|
||||||
|
mapistore_mgmt_backend_register_user (newConnInfo,
|
||||||
|
"SOGo",
|
||||||
|
[username UTF8String]);
|
||||||
|
|
||||||
|
connInfo = newConnInfo;
|
||||||
username = [NSString stringWithUTF8String: newConnInfo->username];
|
username = [NSString stringWithUTF8String: newConnInfo->username];
|
||||||
ASSIGN (activeUser, [SOGoUser userWithLogin: username]);
|
ASSIGN (activeUser, [SOGoUser userWithLogin: username]);
|
||||||
if (!activeUser)
|
if (!activeUser)
|
||||||
|
@ -259,29 +243,6 @@ _prepareContextClass (Class contextClass,
|
||||||
[self release];
|
[self release];
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
[woContext setActiveUser: activeUser];
|
|
||||||
username = [newUrl user];
|
|
||||||
if ([username length] == 0)
|
|
||||||
{
|
|
||||||
[self errorWithFormat:
|
|
||||||
@"attempt to instantiate a context with an empty owner"];
|
|
||||||
[self release];
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
ASSIGN (ownerUser, [SOGoUser userWithLogin: username]);
|
|
||||||
if (!ownerUser)
|
|
||||||
{
|
|
||||||
[self errorWithFormat:
|
|
||||||
@"attempt to instantiate a context without a valid owner"];
|
|
||||||
[self release];
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
ASSIGN (mapping, [MAPIStoreMapping mappingForUsername: username
|
|
||||||
withIndexing: indexingTdb]);
|
|
||||||
[mapping increaseUseCount];
|
|
||||||
ASSIGN (contextUrl, newUrl);
|
|
||||||
mstoreCtx = newConnInfo->mstore_ctx;
|
|
||||||
connInfo = newConnInfo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
@ -290,36 +251,17 @@ _prepareContextClass (Class contextClass,
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
mapistore_mgmt_backend_unregister_user ([self connectionInfo], "SOGo",
|
mapistore_mgmt_backend_unregister_user ([self connectionInfo], "SOGo",
|
||||||
[[[self authenticator] username]
|
[[userContext username]
|
||||||
UTF8String]);
|
UTF8String]);
|
||||||
[baseFolder release];
|
|
||||||
[woContext release];
|
|
||||||
[authenticator release];
|
|
||||||
[mapping decreaseUseCount];
|
|
||||||
[mapping release];
|
|
||||||
[contextUrl release];
|
[contextUrl release];
|
||||||
|
[userContext release];
|
||||||
|
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (WOContext *) woContext
|
- (MAPIStoreUserContext *) userContext
|
||||||
{
|
{
|
||||||
return woContext;
|
return userContext;
|
||||||
}
|
|
||||||
|
|
||||||
- (MAPIStoreMapping *) mapping
|
|
||||||
{
|
|
||||||
return mapping;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) setAuthenticator: (MAPIStoreAuthenticator *) newAuthenticator
|
|
||||||
{
|
|
||||||
ASSIGN (authenticator, newAuthenticator);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (MAPIStoreAuthenticator *) authenticator
|
|
||||||
{
|
|
||||||
return authenticator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSURL *) url
|
- (NSURL *) url
|
||||||
|
@ -332,34 +274,11 @@ _prepareContextClass (Class contextClass,
|
||||||
return connInfo;
|
return connInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setupRequest
|
|
||||||
{
|
|
||||||
NSMutableDictionary *info;
|
|
||||||
|
|
||||||
[MAPIApp setMAPIStoreContext: self];
|
|
||||||
info = [[NSThread currentThread] threadDictionary];
|
|
||||||
[info setObject: woContext forKey: @"WOContext"];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) tearDownRequest
|
|
||||||
{
|
|
||||||
NSMutableDictionary *info;
|
|
||||||
|
|
||||||
info = [[NSThread currentThread] threadDictionary];
|
|
||||||
[info removeObjectForKey: @"WOContext"];
|
|
||||||
[MAPIApp setMAPIStoreContext: nil];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (SOGoUser *) activeUser
|
- (SOGoUser *) activeUser
|
||||||
{
|
{
|
||||||
return activeUser;
|
return activeUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (SOGoUser *) ownerUser
|
|
||||||
{
|
|
||||||
return ownerUser;
|
|
||||||
}
|
|
||||||
|
|
||||||
// - (void) logRestriction: (struct mapi_SRestriction *) res
|
// - (void) logRestriction: (struct mapi_SRestriction *) res
|
||||||
// withState: (MAPIRestrictionState) state
|
// withState: (MAPIRestrictionState) state
|
||||||
// {
|
// {
|
||||||
|
@ -379,7 +298,7 @@ _prepareContextClass (Class contextClass,
|
||||||
// TDB_DATA key, dbuf;
|
// TDB_DATA key, dbuf;
|
||||||
|
|
||||||
url = [contextUrl absoluteString];
|
url = [contextUrl absoluteString];
|
||||||
objectURL = [mapping urlFromID: fmid];
|
objectURL = [[userContext mapping] urlFromID: fmid];
|
||||||
if (objectURL)
|
if (objectURL)
|
||||||
{
|
{
|
||||||
if ([objectURL hasPrefix: url])
|
if ([objectURL hasPrefix: url])
|
||||||
|
@ -417,15 +336,64 @@ _prepareContextClass (Class contextClass,
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) ensureContextFolder
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
- (int) getRootFolder: (MAPIStoreFolder **) folderPtr
|
- (int) getRootFolder: (MAPIStoreFolder **) folderPtr
|
||||||
withFID: (uint64_t) newFid
|
withFID: (uint64_t) newFid
|
||||||
{
|
{
|
||||||
|
enum mapistore_error rc;
|
||||||
|
MAPIStoreMapping *mapping;
|
||||||
|
MAPIStoreFolder *baseFolder;
|
||||||
|
SOGoFolder *currentFolder;
|
||||||
|
WOContext *woContext;
|
||||||
|
NSString *path;
|
||||||
|
NSArray *pathComponents;
|
||||||
|
NSUInteger count, max;
|
||||||
|
|
||||||
|
mapping = [userContext mapping];
|
||||||
if (![mapping urlFromID: newFid])
|
if (![mapping urlFromID: newFid])
|
||||||
[mapping registerURL: [contextUrl absoluteString]
|
[mapping registerURL: [contextUrl absoluteString]
|
||||||
withID: newFid];
|
withID: newFid];
|
||||||
*folderPtr = baseFolder;
|
|
||||||
|
|
||||||
return (baseFolder) ? MAPISTORE_SUCCESS: MAPISTORE_ERROR;
|
[userContext activateWithUser: activeUser];
|
||||||
|
woContext = [userContext woContext];
|
||||||
|
|
||||||
|
[self ensureContextFolder];
|
||||||
|
currentFolder = [self rootSOGoFolder];
|
||||||
|
path = [contextUrl path];
|
||||||
|
if ([path hasPrefix: @"/"])
|
||||||
|
path = [path substringFromIndex: 1];
|
||||||
|
if ([path hasSuffix: @"/"])
|
||||||
|
path = [path substringToIndex: [path length] - 1];
|
||||||
|
pathComponents = [path componentsSeparatedByString: @"/"];
|
||||||
|
max = [pathComponents count];
|
||||||
|
for (count = 0; currentFolder && count < max; count++)
|
||||||
|
{
|
||||||
|
[woContext setClientObject: currentFolder];
|
||||||
|
currentFolder
|
||||||
|
= [currentFolder lookupName: [pathComponents objectAtIndex: count]
|
||||||
|
inContext: woContext
|
||||||
|
acquire: NO];
|
||||||
|
if ([currentFolder isKindOfClass: NSExceptionK])
|
||||||
|
currentFolder = nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentFolder)
|
||||||
|
{
|
||||||
|
baseFolder = [[self MAPIStoreFolderClass]
|
||||||
|
mapiStoreObjectWithSOGoObject: currentFolder
|
||||||
|
inContainer: nil];
|
||||||
|
[baseFolder setContext: self];
|
||||||
|
|
||||||
|
*folderPtr = baseFolder;
|
||||||
|
rc = MAPISTORE_SUCCESS;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
rc = MAPISTORE_ERR_NOT_FOUND;
|
||||||
|
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* utils */
|
/* utils */
|
||||||
|
@ -460,6 +428,7 @@ _prepareContextClass (Class contextClass,
|
||||||
inFolderURL: (NSString *) folderURL
|
inFolderURL: (NSString *) folderURL
|
||||||
{
|
{
|
||||||
NSString *childURL, *owner;
|
NSString *childURL, *owner;
|
||||||
|
MAPIStoreMapping *mapping;
|
||||||
uint64_t mappingId;
|
uint64_t mappingId;
|
||||||
uint32_t contextId;
|
uint32_t contextId;
|
||||||
void *rootObject;
|
void *rootObject;
|
||||||
|
@ -468,6 +437,7 @@ _prepareContextClass (Class contextClass,
|
||||||
childURL = [NSString stringWithFormat: @"%@%@", folderURL, key];
|
childURL = [NSString stringWithFormat: @"%@%@", folderURL, key];
|
||||||
else
|
else
|
||||||
childURL = folderURL;
|
childURL = folderURL;
|
||||||
|
mapping = [userContext mapping];
|
||||||
mappingId = [mapping idFromURL: childURL];
|
mappingId = [mapping idFromURL: childURL];
|
||||||
if (mappingId == NSNotFound)
|
if (mappingId == NSNotFound)
|
||||||
{
|
{
|
||||||
|
@ -476,11 +446,10 @@ _prepareContextClass (Class contextClass,
|
||||||
[mapping registerURL: childURL withID: mappingId];
|
[mapping registerURL: childURL withID: mappingId];
|
||||||
contextId = 0;
|
contextId = 0;
|
||||||
|
|
||||||
// FIXME: + 7 to skip the BOM or what?
|
mapistore_search_context_by_uri (connInfo->mstore_ctx, [folderURL UTF8String] + 7,
|
||||||
mapistore_search_context_by_uri (mstoreCtx, [folderURL UTF8String] + 7,
|
|
||||||
&contextId, &rootObject);
|
&contextId, &rootObject);
|
||||||
owner = [ownerUser login];
|
owner = [userContext username];
|
||||||
mapistore_indexing_record_add_mid (mstoreCtx, contextId,
|
mapistore_indexing_record_add_mid (connInfo->mstore_ctx, contextId,
|
||||||
[owner UTF8String], mappingId);
|
[owner UTF8String], mappingId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -507,9 +476,18 @@ _prepareContextClass (Class contextClass,
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setupBaseFolder: (NSURL *) newURL
|
- (Class) MAPIStoreFolderClass
|
||||||
{
|
{
|
||||||
[self subclassResponsibility: _cmd];
|
[self subclassResponsibility: _cmd];
|
||||||
|
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id) rootSOGoFolder
|
||||||
|
{
|
||||||
|
[self subclassResponsibility: _cmd];
|
||||||
|
|
||||||
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#import "MAPIStoreActiveTables.h"
|
#import "MAPIStoreActiveTables.h"
|
||||||
#import "MAPIStoreContext.h"
|
#import "MAPIStoreContext.h"
|
||||||
|
#import "MAPIStoreUserContext.h"
|
||||||
#import "NSObject+MAPIStore.h"
|
#import "NSObject+MAPIStore.h"
|
||||||
|
|
||||||
#import "MAPIStoreFAIMessage.h"
|
#import "MAPIStoreFAIMessage.h"
|
||||||
|
@ -51,9 +52,11 @@
|
||||||
{
|
{
|
||||||
enum mapistore_error rc;
|
enum mapistore_error rc;
|
||||||
MAPIStoreContext *context;
|
MAPIStoreContext *context;
|
||||||
|
SOGoUser *ownerUser;
|
||||||
|
|
||||||
context = [self context];
|
context = [self context];
|
||||||
if ([[context activeUser] isEqual: [context ownerUser]])
|
ownerUser = [[self userContext] sogoUser];
|
||||||
|
if ([[context activeUser] isEqual: ownerUser])
|
||||||
rc = [super saveMessage];
|
rc = [super saveMessage];
|
||||||
else
|
else
|
||||||
rc = MAPISTORE_ERR_DENIED;
|
rc = MAPISTORE_ERR_DENIED;
|
||||||
|
|
|
@ -30,10 +30,14 @@
|
||||||
|
|
||||||
#import "MAPIStoreFSFolder.h"
|
#import "MAPIStoreFSFolder.h"
|
||||||
#import "MAPIStoreMapping.h"
|
#import "MAPIStoreMapping.h"
|
||||||
|
#import "MAPIStoreUserContext.h"
|
||||||
#import "SOGoMAPIFSFolder.h"
|
#import "SOGoMAPIFSFolder.h"
|
||||||
|
|
||||||
#import "MAPIStoreFSBaseContext.h"
|
#import "MAPIStoreFSBaseContext.h"
|
||||||
|
|
||||||
|
#undef DEBUG
|
||||||
|
#include <mapistore/mapistore.h>
|
||||||
|
|
||||||
static Class MAPIStoreFSFolderK;
|
static Class MAPIStoreFSFolderK;
|
||||||
|
|
||||||
@implementation MAPIStoreFSBaseContext
|
@implementation MAPIStoreFSBaseContext
|
||||||
|
@ -48,12 +52,28 @@ static Class MAPIStoreFSFolderK;
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setupBaseFolder: (NSURL *) newURL
|
- (Class) MAPIStoreFolderClass
|
||||||
{
|
{
|
||||||
[self logWithFormat: @"invoked %s", __PRETTY_FUNCTION__];
|
return MAPIStoreFSFolderK;
|
||||||
baseFolder = [MAPIStoreFSFolderK baseFolderWithURL: newURL
|
}
|
||||||
inContext: self];
|
|
||||||
[baseFolder retain];
|
- (void) ensureContextFolder
|
||||||
|
{
|
||||||
|
SOGoMAPIFSFolder *contextFolder;
|
||||||
|
|
||||||
|
contextFolder = [SOGoMAPIFSFolder folderWithURL: contextUrl
|
||||||
|
andTableType: MAPISTORE_MESSAGE_TABLE];
|
||||||
|
[contextFolder ensureDirectory];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id) rootSOGoFolder
|
||||||
|
{
|
||||||
|
NSString *urlString;
|
||||||
|
|
||||||
|
urlString = [NSString stringWithFormat: @"sogo://%@@%@/",
|
||||||
|
[userContext username], [isa MAPIModuleName]];
|
||||||
|
return [SOGoMAPIFSFolder folderWithURL: [NSURL URLWithString: urlString]
|
||||||
|
andTableType: MAPISTORE_MESSAGE_TABLE];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#import "MAPIStoreFSMessage.h"
|
#import "MAPIStoreFSMessage.h"
|
||||||
#import "MAPIStoreFSMessageTable.h"
|
#import "MAPIStoreFSMessageTable.h"
|
||||||
#import "MAPIStoreTypes.h"
|
#import "MAPIStoreTypes.h"
|
||||||
|
#import "MAPIStoreUserContext.h"
|
||||||
#import "SOGoMAPIFSFolder.h"
|
#import "SOGoMAPIFSFolder.h"
|
||||||
#import "SOGoMAPIFSMessage.h"
|
#import "SOGoMAPIFSMessage.h"
|
||||||
|
|
||||||
|
@ -64,20 +65,6 @@ static NSString *MAPIStoreRightFolderContact = @"RightsFolderContact";
|
||||||
EOKeyValueQualifierK = [EOKeyValueQualifier class];
|
EOKeyValueQualifierK = [EOKeyValueQualifier class];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) initWithURL: (NSURL *) newURL
|
|
||||||
inContext: (MAPIStoreContext *) newContext
|
|
||||||
{
|
|
||||||
if ((self = [super initWithURL: newURL
|
|
||||||
inContext: newContext]))
|
|
||||||
{
|
|
||||||
sogoObject = [SOGoMAPIFSFolder folderWithURL: newURL
|
|
||||||
andTableType: MAPISTORE_MESSAGE_TABLE];
|
|
||||||
[sogoObject retain];
|
|
||||||
}
|
|
||||||
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (MAPIStoreMessageTable *) messageTable
|
- (MAPIStoreMessageTable *) messageTable
|
||||||
{
|
{
|
||||||
return [MAPIStoreFSMessageTable tableForContainer: self];
|
return [MAPIStoreFSMessageTable tableForContainer: self];
|
||||||
|
@ -126,8 +113,10 @@ static NSString *MAPIStoreRightFolderContact = @"RightsFolderContact";
|
||||||
andSortOrderings: (NSArray *) sortOrderings
|
andSortOrderings: (NSArray *) sortOrderings
|
||||||
{
|
{
|
||||||
NSArray *keys;
|
NSArray *keys;
|
||||||
|
SOGoUser *ownerUser;
|
||||||
|
|
||||||
if ([[context activeUser] isEqual: [context ownerUser]]
|
ownerUser = [[self userContext] sogoUser];
|
||||||
|
if ([[context activeUser] isEqual: ownerUser]
|
||||||
|| [self subscriberCanReadMessages])
|
|| [self subscriberCanReadMessages])
|
||||||
keys = [(SOGoMAPIFSFolder *) sogoObject
|
keys = [(SOGoMAPIFSFolder *) sogoObject
|
||||||
toOneRelationshipKeysMatchingQualifier: qualifier
|
toOneRelationshipKeysMatchingQualifier: qualifier
|
||||||
|
|
|
@ -22,8 +22,6 @@
|
||||||
|
|
||||||
#import <Foundation/NSString.h>
|
#import <Foundation/NSString.h>
|
||||||
|
|
||||||
#import "MAPIStoreFSFolder.h"
|
|
||||||
|
|
||||||
#import "MAPIStoreFallbackContext.h"
|
#import "MAPIStoreFallbackContext.h"
|
||||||
|
|
||||||
#undef DEBUG
|
#undef DEBUG
|
||||||
|
@ -37,6 +35,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
||||||
|
withTDBIndexing: (struct tdb_wrap *) indexingTdb
|
||||||
inMemCtx: (TALLOC_CTX *) memCtx
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
{
|
{
|
||||||
struct mapistore_contexts_list *context;
|
struct mapistore_contexts_list *context;
|
||||||
|
@ -53,10 +52,4 @@
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setupBaseFolder: (NSURL *) newURL
|
|
||||||
{
|
|
||||||
baseFolder = [MAPIStoreFSFolder baseFolderWithURL: newURL inContext: self];
|
|
||||||
[baseFolder retain];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
@class NSArray;
|
@class NSArray;
|
||||||
@class NSMutableArray;
|
@class NSMutableArray;
|
||||||
@class NSNumber;
|
@class NSNumber;
|
||||||
@class NSURL;
|
|
||||||
|
|
||||||
@class EOQualifier;
|
@class EOQualifier;
|
||||||
|
|
||||||
|
@ -46,7 +45,6 @@
|
||||||
|
|
||||||
@interface MAPIStoreFolder : MAPIStoreObject
|
@interface MAPIStoreFolder : MAPIStoreObject
|
||||||
{
|
{
|
||||||
NSURL *folderURL;
|
|
||||||
MAPIStoreContext *context;
|
MAPIStoreContext *context;
|
||||||
NSArray *messageKeys;
|
NSArray *messageKeys;
|
||||||
NSArray *faiMessageKeys;
|
NSArray *faiMessageKeys;
|
||||||
|
@ -57,10 +55,7 @@
|
||||||
SOGoMAPIFSMessage *propsMessage;
|
SOGoMAPIFSMessage *propsMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (id) baseFolderWithURL: (NSURL *) newURL
|
- (void) setContext: (MAPIStoreContext *) newContext;
|
||||||
inContext: (MAPIStoreContext *) newContext;
|
|
||||||
- (id) initWithURL: (NSURL *) newURL
|
|
||||||
inContext: (MAPIStoreContext *) newContext;
|
|
||||||
|
|
||||||
- (NSArray *) activeMessageTables;
|
- (NSArray *) activeMessageTables;
|
||||||
- (NSArray *) activeFAIMessageTables;
|
- (NSArray *) activeFAIMessageTables;
|
||||||
|
@ -168,6 +163,7 @@
|
||||||
- (BOOL) supportsSubFolders; /* capability */
|
- (BOOL) supportsSubFolders; /* capability */
|
||||||
|
|
||||||
/* subclass helpers */
|
/* subclass helpers */
|
||||||
|
- (void) setupVersionsMessage;
|
||||||
- (void) postNotificationsForMoveCopyMessagesWithMIDs: (uint64_t *) srcMids
|
- (void) postNotificationsForMoveCopyMessagesWithMIDs: (uint64_t *) srcMids
|
||||||
andMessageURLs: (NSArray *) oldMessageURLs
|
andMessageURLs: (NSArray *) oldMessageURLs
|
||||||
andCount: (uint32_t) midCount
|
andCount: (uint32_t) midCount
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
#import "MAPIStorePermissionsTable.h"
|
#import "MAPIStorePermissionsTable.h"
|
||||||
#import "MAPIStoreSamDBUtils.h"
|
#import "MAPIStoreSamDBUtils.h"
|
||||||
#import "MAPIStoreTypes.h"
|
#import "MAPIStoreTypes.h"
|
||||||
|
#import "MAPIStoreUserContext.h"
|
||||||
#import "NSDate+MAPIStore.h"
|
#import "NSDate+MAPIStore.h"
|
||||||
#import "NSString+MAPIStore.h"
|
#import "NSString+MAPIStore.h"
|
||||||
#import "NSObject+MAPIStore.h"
|
#import "NSObject+MAPIStore.h"
|
||||||
|
@ -71,17 +72,6 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||||
MAPIStoreFolderTableK = [MAPIStoreFolderTable class];
|
MAPIStoreFolderTableK = [MAPIStoreFolderTable class];
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (id) baseFolderWithURL: (NSURL *) newURL
|
|
||||||
inContext: (MAPIStoreContext *) newContext
|
|
||||||
{
|
|
||||||
id newFolder;
|
|
||||||
|
|
||||||
newFolder = [[self alloc] initWithURL: newURL inContext: newContext];
|
|
||||||
[newFolder autorelease];
|
|
||||||
|
|
||||||
return newFolder;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) init
|
- (id) init
|
||||||
{
|
{
|
||||||
if ((self = [super init]))
|
if ((self = [super init]))
|
||||||
|
@ -90,7 +80,6 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||||
faiMessageKeys = nil;
|
faiMessageKeys = nil;
|
||||||
folderKeys = nil;
|
folderKeys = nil;
|
||||||
faiFolder = nil;
|
faiFolder = nil;
|
||||||
folderURL = nil;
|
|
||||||
context = nil;
|
context = nil;
|
||||||
|
|
||||||
propsFolder = nil;
|
propsFolder = nil;
|
||||||
|
@ -100,54 +89,72 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* from context */
|
- (void) _setupAuxiliaryObjects
|
||||||
- (id) initWithURL: (NSURL *) newURL
|
|
||||||
inContext: (MAPIStoreContext *) newContext
|
|
||||||
{
|
|
||||||
if ((self = [self init]))
|
|
||||||
{
|
|
||||||
context = newContext;
|
|
||||||
ASSIGN (folderURL, newURL);
|
|
||||||
ASSIGN (faiFolder,
|
|
||||||
[SOGoMAPIFSFolder folderWithURL: newURL
|
|
||||||
andTableType: MAPISTORE_FAI_TABLE]);
|
|
||||||
ASSIGN (propsFolder,
|
|
||||||
[SOGoMAPIFSFolder folderWithURL: newURL
|
|
||||||
andTableType: MAPISTORE_FOLDER_TABLE]);
|
|
||||||
ASSIGN (propsMessage,
|
|
||||||
[SOGoMAPIFSMessage objectWithName: @"properties.plist"
|
|
||||||
inContainer: propsFolder]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* from parent folder */
|
|
||||||
- (id) initWithSOGoObject: (id) newSOGoObject
|
|
||||||
inContainer: (MAPIStoreObject *) newContainer
|
|
||||||
{
|
{
|
||||||
NSURL *propsURL;
|
NSURL *propsURL;
|
||||||
NSString *urlString;
|
NSString *urlString;
|
||||||
|
|
||||||
if ((self = [super initWithSOGoObject: newSOGoObject inContainer: newContainer]))
|
urlString = [[self url] stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
|
||||||
|
propsURL = [NSURL URLWithString: urlString];
|
||||||
|
[self logWithFormat: @"_setupAuxiliaryObjects: %@", propsURL];
|
||||||
|
ASSIGN (faiFolder,
|
||||||
|
[SOGoMAPIFSFolder folderWithURL: propsURL
|
||||||
|
andTableType: MAPISTORE_FAI_TABLE]);
|
||||||
|
ASSIGN (propsFolder,
|
||||||
|
[SOGoMAPIFSFolder folderWithURL: propsURL
|
||||||
|
andTableType: MAPISTORE_FOLDER_TABLE]);
|
||||||
|
ASSIGN (propsMessage,
|
||||||
|
[SOGoMAPIFSMessage objectWithName: @"properties.plist"
|
||||||
|
inContainer: propsFolder]);
|
||||||
|
[self setupVersionsMessage];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id) initWithSOGoObject: (id) newSOGoObject
|
||||||
|
inContainer: (MAPIStoreObject *) newContainer
|
||||||
|
{
|
||||||
|
/* The instantiation of auxiliary folders is postponed when newContainer is
|
||||||
|
nil since there is no way to deduce the parent url. When setContext: is
|
||||||
|
invoked, it becomes possible again. */
|
||||||
|
if ((self = [super initWithSOGoObject: newSOGoObject
|
||||||
|
inContainer: newContainer])
|
||||||
|
&& newContainer)
|
||||||
{
|
{
|
||||||
urlString = [[self url] stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
|
[self _setupAuxiliaryObjects];
|
||||||
propsURL = [NSURL URLWithString: urlString];
|
|
||||||
ASSIGN (faiFolder,
|
|
||||||
[SOGoMAPIFSFolder folderWithURL: propsURL
|
|
||||||
andTableType: MAPISTORE_FAI_TABLE]);
|
|
||||||
ASSIGN (propsFolder,
|
|
||||||
[SOGoMAPIFSFolder folderWithURL: propsURL
|
|
||||||
andTableType: MAPISTORE_FOLDER_TABLE]);
|
|
||||||
ASSIGN (propsMessage,
|
|
||||||
[SOGoMAPIFSMessage objectWithName: @"properties.plist"
|
|
||||||
inContainer: propsFolder]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) setContext: (MAPIStoreContext *) newContext
|
||||||
|
{
|
||||||
|
ASSIGN (context, newContext);
|
||||||
|
if (newContext)
|
||||||
|
[self _setupAuxiliaryObjects];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (MAPIStoreContext *) context
|
||||||
|
{
|
||||||
|
if (!context)
|
||||||
|
[self setContext: [container context]];
|
||||||
|
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) dealloc
|
||||||
|
{
|
||||||
|
[propsMessage release];
|
||||||
|
[propsFolder release];
|
||||||
|
[messageKeys release];
|
||||||
|
[faiMessageKeys release];
|
||||||
|
[folderKeys release];
|
||||||
|
[faiFolder release];
|
||||||
|
[context release];
|
||||||
|
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
|
|
||||||
/* backend interface */
|
/* backend interface */
|
||||||
|
|
||||||
- (SOGoMAPIFSMessage *) propertiesMessage
|
- (SOGoMAPIFSMessage *) propertiesMessage
|
||||||
{
|
{
|
||||||
return propsMessage;
|
return propsMessage;
|
||||||
|
@ -185,7 +192,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||||
|
|
||||||
if ([[self folderKeys] containsObject: folderKey])
|
if ([[self folderKeys] containsObject: folderKey])
|
||||||
{
|
{
|
||||||
woContext = [[self context] woContext];
|
woContext = [[self userContext] woContext];
|
||||||
sogoFolder = [sogoObject lookupName: folderKey
|
sogoFolder = [sogoObject lookupName: folderKey
|
||||||
inContext: woContext
|
inContext: woContext
|
||||||
acquire: NO];
|
acquire: NO];
|
||||||
|
@ -237,7 +244,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||||
acquire: NO];
|
acquire: NO];
|
||||||
if (msgObject && ![msgObject isKindOfClass: NSExceptionK])
|
if (msgObject && ![msgObject isKindOfClass: NSExceptionK])
|
||||||
{
|
{
|
||||||
[msgObject setContext: [[self context] woContext]];
|
[msgObject setContext: [[self userContext] woContext]];
|
||||||
messageClass = [msgObject mapistoreMessageClass];
|
messageClass = [msgObject mapistoreMessageClass];
|
||||||
childMessage
|
childMessage
|
||||||
= [messageClass mapiStoreObjectWithSOGoObject: msgObject
|
= [messageClass mapiStoreObjectWithSOGoObject: msgObject
|
||||||
|
@ -310,7 +317,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||||
|
|
||||||
[self logWithFormat: @"METHOD '%s' (%d)", __FUNCTION__, __LINE__];
|
[self logWithFormat: @"METHOD '%s' (%d)", __FUNCTION__, __LINE__];
|
||||||
|
|
||||||
mapping = [[self context] mapping];
|
mapping = [self mapping];
|
||||||
childURL = [mapping urlFromID: fid];
|
childURL = [mapping urlFromID: fid];
|
||||||
if (childURL)
|
if (childURL)
|
||||||
{
|
{
|
||||||
|
@ -333,13 +340,15 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||||
MAPIStoreMapping *mapping;
|
MAPIStoreMapping *mapping;
|
||||||
NSString *baseURL, *childURL, *folderKey;
|
NSString *baseURL, *childURL, *folderKey;
|
||||||
MAPIStoreFolder *childFolder;
|
MAPIStoreFolder *childFolder;
|
||||||
|
SOGoUser *ownerUser;
|
||||||
|
|
||||||
[self logWithFormat: @"METHOD '%s' (%d)", __FUNCTION__, __LINE__];
|
[self logWithFormat: @"METHOD '%s' (%d)", __FUNCTION__, __LINE__];
|
||||||
|
|
||||||
if ([[context activeUser] isEqual: [context ownerUser]]
|
ownerUser = [[self userContext] sogoUser];
|
||||||
|
if ([[context activeUser] isEqual: ownerUser]
|
||||||
|| [self subscriberCanCreateSubFolders])
|
|| [self subscriberCanCreateSubFolders])
|
||||||
{
|
{
|
||||||
mapping = [[self context] mapping];
|
mapping = [self mapping];
|
||||||
childURL = [mapping urlFromID: fid];
|
childURL = [mapping urlFromID: fid];
|
||||||
if (childURL)
|
if (childURL)
|
||||||
rc = MAPISTORE_ERR_EXIST;
|
rc = MAPISTORE_ERR_EXIST;
|
||||||
|
@ -415,16 +424,18 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||||
NSString *messageURL;
|
NSString *messageURL;
|
||||||
MAPIStoreMapping *mapping;
|
MAPIStoreMapping *mapping;
|
||||||
MAPIStoreMessage *message;
|
MAPIStoreMessage *message;
|
||||||
|
SOGoUser *ownerUser;
|
||||||
int rc = MAPISTORE_ERR_NOT_FOUND;
|
int rc = MAPISTORE_ERR_NOT_FOUND;
|
||||||
|
|
||||||
mapping = [[self context] mapping];
|
mapping = [self mapping];
|
||||||
messageURL = [mapping urlFromID: mid];
|
messageURL = [mapping urlFromID: mid];
|
||||||
if (messageURL)
|
if (messageURL)
|
||||||
{
|
{
|
||||||
message = [self lookupMessageByURL: messageURL];
|
message = [self lookupMessageByURL: messageURL];
|
||||||
if (message)
|
if (message)
|
||||||
{
|
{
|
||||||
if ([[context activeUser] isEqual: [context ownerUser]]
|
ownerUser = [[self userContext] sogoUser];
|
||||||
|
if ([[context activeUser] isEqual: ownerUser]
|
||||||
|| (readWrite && [message subscriberCanModifyMessage])
|
|| (readWrite && [message subscriberCanModifyMessage])
|
||||||
|| (!readWrite && [message subscriberCanReadMessage]))
|
|| (!readWrite && [message subscriberCanReadMessage]))
|
||||||
{
|
{
|
||||||
|
@ -447,15 +458,18 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||||
MAPIStoreMessage *message;
|
MAPIStoreMessage *message;
|
||||||
NSString *baseURL, *childURL;
|
NSString *baseURL, *childURL;
|
||||||
MAPIStoreMapping *mapping;
|
MAPIStoreMapping *mapping;
|
||||||
|
SOGoUser *ownerUser;
|
||||||
|
|
||||||
[self logWithFormat: @"METHOD '%s' -- mid: 0x%.16llx associated: %d",
|
[self logWithFormat: @"METHOD '%s' -- mid: 0x%.16llx associated: %d",
|
||||||
__FUNCTION__, mid, isAssociated];
|
__FUNCTION__, mid, isAssociated];
|
||||||
|
|
||||||
context = [self context];
|
context = [self context];
|
||||||
if ([[context activeUser] isEqual: [context ownerUser]]
|
ownerUser = [[self userContext] sogoUser];
|
||||||
|
|
||||||
|
if ([[context activeUser] isEqual: ownerUser]
|
||||||
|| (!isAssociated && [self subscriberCanCreateMessages]))
|
|| (!isAssociated && [self subscriberCanCreateMessages]))
|
||||||
{
|
{
|
||||||
mapping = [[self context] mapping];
|
mapping = [self mapping];
|
||||||
if ([mapping urlFromID: mid])
|
if ([mapping urlFromID: mid])
|
||||||
rc = MAPISTORE_ERR_EXIST;
|
rc = MAPISTORE_ERR_EXIST;
|
||||||
else
|
else
|
||||||
|
@ -491,20 +505,23 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||||
NSArray *activeTables;
|
NSArray *activeTables;
|
||||||
NSUInteger count, max;
|
NSUInteger count, max;
|
||||||
id msgObject;
|
id msgObject;
|
||||||
|
SOGoUser *ownerUser;
|
||||||
struct mapistore_connection_info *connInfo;
|
struct mapistore_connection_info *connInfo;
|
||||||
struct mapistore_object_notification_parameters *notif_parameters;
|
struct mapistore_object_notification_parameters *notif_parameters;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
[self logWithFormat: @"-deleteMessageWithMID: mid: 0x%.16llx flags: %d", mid, flags];
|
[self logWithFormat: @"-deleteMessageWithMID: mid: 0x%.16llx flags: %d", mid, flags];
|
||||||
|
|
||||||
mapping = [[self context] mapping];
|
mapping = [self mapping];
|
||||||
childURL = [mapping urlFromID: mid];
|
childURL = [mapping urlFromID: mid];
|
||||||
if (childURL)
|
if (childURL)
|
||||||
{
|
{
|
||||||
message = [self lookupMessageByURL: childURL];
|
message = [self lookupMessageByURL: childURL];
|
||||||
if (message)
|
if (message)
|
||||||
{
|
{
|
||||||
if ([[context activeUser] isEqual: [context ownerUser]]
|
ownerUser = [[self userContext] sogoUser];
|
||||||
|
|
||||||
|
if ([[context activeUser] isEqual: ownerUser]
|
||||||
|| (![message isKindOfClass: MAPIStoreFAIMessageK]
|
|| (![message isKindOfClass: MAPIStoreFAIMessageK]
|
||||||
&& [self subscriberCanDeleteMessages]))
|
&& [self subscriberCanDeleteMessages]))
|
||||||
{
|
{
|
||||||
|
@ -685,16 +702,19 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||||
NSMutableArray *oldMessageURLs;
|
NSMutableArray *oldMessageURLs;
|
||||||
NSString *oldMessageURL;
|
NSString *oldMessageURL;
|
||||||
MAPIStoreMapping *mapping;
|
MAPIStoreMapping *mapping;
|
||||||
|
SOGoUser *ownerUser;
|
||||||
struct Binary_r *targetChangeKey;
|
struct Binary_r *targetChangeKey;
|
||||||
|
|
||||||
if (wantCopy || [[context activeUser] isEqual: [context ownerUser]])
|
ownerUser = [[self userContext] sogoUser];
|
||||||
|
|
||||||
|
if (wantCopy || [[context activeUser] isEqual: ownerUser])
|
||||||
{
|
{
|
||||||
if ([sourceFolder isKindOfClass: isa]
|
if ([sourceFolder isKindOfClass: isa]
|
||||||
|| [self isKindOfClass: [sourceFolder class]])
|
|| [self isKindOfClass: [sourceFolder class]])
|
||||||
[self logWithFormat: @"%s: this class could probably implement"
|
[self logWithFormat: @"%s: this class could probably implement"
|
||||||
@" a specialized/optimized version", __FUNCTION__];
|
@" a specialized/optimized version", __FUNCTION__];
|
||||||
oldMessageURLs = [NSMutableArray arrayWithCapacity: midCount];
|
oldMessageURLs = [NSMutableArray arrayWithCapacity: midCount];
|
||||||
mapping = [[self context] mapping];
|
mapping = [self mapping];
|
||||||
for (count = 0; rc == MAPISTORE_SUCCESS && count < midCount; count++)
|
for (count = 0; rc == MAPISTORE_SUCCESS && count < midCount; count++)
|
||||||
{
|
{
|
||||||
oldMessageURL = [mapping urlFromID: srcMids[count]];
|
oldMessageURL = [mapping urlFromID: srcMids[count]];
|
||||||
|
@ -753,6 +773,10 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||||
[aclFolder setRoles: roles forUser: user];
|
[aclFolder setRoles: roles forUser: user];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) setupVersionsMessage
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
- (void) postNotificationsForMoveCopyMessagesWithMIDs: (uint64_t *) srcMids
|
- (void) postNotificationsForMoveCopyMessagesWithMIDs: (uint64_t *) srcMids
|
||||||
andMessageURLs: (NSArray *) oldMessageURLs
|
andMessageURLs: (NSArray *) oldMessageURLs
|
||||||
andCount: (uint32_t) midCount
|
andCount: (uint32_t) midCount
|
||||||
|
@ -849,7 +873,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||||
talloc_free(notif_parameters);
|
talloc_free(notif_parameters);
|
||||||
|
|
||||||
// table notification
|
// table notification
|
||||||
mapping = [[self context] mapping];
|
mapping = [self mapping];
|
||||||
for (count = 0; count < midCount; count++)
|
for (count = 0; count < midCount; count++)
|
||||||
{
|
{
|
||||||
messageURL = [mapping urlFromID: targetMids[count]];
|
messageURL = [mapping urlFromID: targetMids[count]];
|
||||||
|
@ -879,7 +903,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||||
inTableType: tableType];
|
inTableType: tableType];
|
||||||
if (keys)
|
if (keys)
|
||||||
{
|
{
|
||||||
mapping = [[self context] mapping];
|
mapping = [self mapping];
|
||||||
|
|
||||||
max = [keys count];
|
max = [keys count];
|
||||||
|
|
||||||
|
@ -976,27 +1000,6 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||||
[propsCopy release];
|
[propsCopy release];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) dealloc
|
|
||||||
{
|
|
||||||
[propsMessage release];
|
|
||||||
[propsFolder release];
|
|
||||||
[folderURL release];
|
|
||||||
[messageKeys release];
|
|
||||||
[faiMessageKeys release];
|
|
||||||
[folderKeys release];
|
|
||||||
[faiFolder release];
|
|
||||||
|
|
||||||
[super dealloc];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (MAPIStoreContext *) context
|
|
||||||
{
|
|
||||||
if (!context)
|
|
||||||
context = [container context];
|
|
||||||
|
|
||||||
return context;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSArray *) messageKeys
|
- (NSArray *) messageKeys
|
||||||
{
|
{
|
||||||
if (!messageKeys)
|
if (!messageKeys)
|
||||||
|
@ -1132,9 +1135,12 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||||
inMemCtx: (TALLOC_CTX *) memCtx
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
{
|
{
|
||||||
uint32_t access = 0;
|
uint32_t access = 0;
|
||||||
|
SOGoUser *ownerUser;
|
||||||
BOOL userIsOwner;
|
BOOL userIsOwner;
|
||||||
|
|
||||||
userIsOwner = [[context activeUser] isEqual: [context ownerUser]];
|
ownerUser = [[self userContext] sogoUser];
|
||||||
|
|
||||||
|
userIsOwner = [[context activeUser] isEqual: ownerUser];
|
||||||
if (userIsOwner || [self subscriberCanModifyMessages])
|
if (userIsOwner || [self subscriberCanModifyMessages])
|
||||||
access |= 0x01;
|
access |= 0x01;
|
||||||
if (userIsOwner || [self subscriberCanReadMessages])
|
if (userIsOwner || [self subscriberCanReadMessages])
|
||||||
|
@ -1285,7 +1291,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||||
else
|
else
|
||||||
newMessage = [self createMessage];
|
newMessage = [self createMessage];
|
||||||
[newMessage setIsNew: YES];
|
[newMessage setIsNew: YES];
|
||||||
woContext = [[self context] woContext];
|
woContext = [[self userContext] woContext];
|
||||||
[[newMessage sogoObject] setContext: woContext];
|
[[newMessage sogoObject] setContext: woContext];
|
||||||
|
|
||||||
return newMessage;
|
return newMessage;
|
||||||
|
@ -1305,10 +1311,14 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||||
{
|
{
|
||||||
NSString *url;
|
NSString *url;
|
||||||
|
|
||||||
if (folderURL)
|
if (container)
|
||||||
url = [folderURL absoluteString];
|
|
||||||
else
|
|
||||||
url = [NSString stringWithFormat: @"%@/", [super url]];
|
url = [NSString stringWithFormat: @"%@/", [super url]];
|
||||||
|
else
|
||||||
|
{
|
||||||
|
url = [[context url] absoluteString];
|
||||||
|
if (![url hasSuffix: @"/"])
|
||||||
|
url = [NSString stringWithFormat: @"%@/", url];
|
||||||
|
}
|
||||||
|
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
@ -1512,10 +1522,10 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||||
{
|
{
|
||||||
uint64_t objectId;
|
uint64_t objectId;
|
||||||
|
|
||||||
if (folderURL)
|
if (container)
|
||||||
objectId = [self idForObjectWithKey: nil];
|
|
||||||
else
|
|
||||||
objectId = [super objectId];
|
objectId = [super objectId];
|
||||||
|
else
|
||||||
|
objectId = [self idForObjectWithKey: nil];
|
||||||
|
|
||||||
return objectId;
|
return objectId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
|
|
||||||
#import "MAPIStoreContext.h"
|
#import "MAPIStoreContext.h"
|
||||||
#import "MAPIStoreTypes.h"
|
#import "MAPIStoreTypes.h"
|
||||||
|
#import "MAPIStoreUserContext.h"
|
||||||
#import "NSData+MAPIStore.h"
|
#import "NSData+MAPIStore.h"
|
||||||
#import "NSDate+MAPIStore.h"
|
#import "NSDate+MAPIStore.h"
|
||||||
#import "NSString+MAPIStore.h"
|
#import "NSString+MAPIStore.h"
|
||||||
|
@ -46,33 +47,22 @@
|
||||||
|
|
||||||
@implementation MAPIStoreGCSFolder
|
@implementation MAPIStoreGCSFolder
|
||||||
|
|
||||||
- (id) initWithURL: (NSURL *) newURL
|
- (id) initWithSOGoObject: (id) newSOGoObject
|
||||||
inContext: (MAPIStoreContext *) newContext
|
inContainer: (MAPIStoreObject *) newContainer
|
||||||
{
|
{
|
||||||
if ((self = [super initWithURL: newURL
|
if ((self = [super initWithSOGoObject: newSOGoObject inContainer: newContainer]))
|
||||||
inContext: newContext]))
|
|
||||||
{
|
{
|
||||||
ASSIGN (versionsMessage,
|
|
||||||
[SOGoMAPIFSMessage objectWithName: @"versions.plist"
|
|
||||||
inContainer: propsFolder]);
|
|
||||||
activeUserRoles = nil;
|
activeUserRoles = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) initWithSOGoObject: (id) newSOGoObject
|
- (void) setupVersionsMessage
|
||||||
inContainer: (MAPIStoreObject *) newContainer
|
|
||||||
{
|
{
|
||||||
if ((self = [super initWithSOGoObject: newSOGoObject inContainer: newContainer]))
|
ASSIGN (versionsMessage,
|
||||||
{
|
[SOGoMAPIFSMessage objectWithName: @"versions.plist"
|
||||||
ASSIGN (versionsMessage,
|
inContainer: propsFolder]);
|
||||||
[SOGoMAPIFSMessage objectWithName: @"versions.plist"
|
|
||||||
inContainer: propsFolder]);
|
|
||||||
activeUserRoles = nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
return self;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
|
@ -86,6 +76,7 @@
|
||||||
andSortOrderings: (NSArray *) sortOrderings
|
andSortOrderings: (NSArray *) sortOrderings
|
||||||
{
|
{
|
||||||
static NSArray *fields = nil;
|
static NSArray *fields = nil;
|
||||||
|
SOGoUser *ownerUser;
|
||||||
NSArray *records;
|
NSArray *records;
|
||||||
NSMutableArray *qualifierArray;
|
NSMutableArray *qualifierArray;
|
||||||
EOQualifier *fetchQualifier, *aclQualifier;
|
EOQualifier *fetchQualifier, *aclQualifier;
|
||||||
|
@ -98,7 +89,8 @@
|
||||||
initWithObjects: @"c_name", @"c_version", nil];
|
initWithObjects: @"c_name", @"c_version", nil];
|
||||||
|
|
||||||
qualifierArray = [NSMutableArray new];
|
qualifierArray = [NSMutableArray new];
|
||||||
if (![[context activeUser] isEqual: [context ownerUser]])
|
ownerUser = [[self userContext] sogoUser];
|
||||||
|
if (![[context activeUser] isEqual: ownerUser])
|
||||||
{
|
{
|
||||||
aclQualifier = [self aclQualifier];
|
aclQualifier = [self aclQualifier];
|
||||||
if (aclQualifier)
|
if (aclQualifier)
|
||||||
|
@ -528,12 +520,14 @@
|
||||||
- (NSArray *) activeUserRoles
|
- (NSArray *) activeUserRoles
|
||||||
{
|
{
|
||||||
SOGoUser *activeUser;
|
SOGoUser *activeUser;
|
||||||
|
WOContext *woContext;
|
||||||
|
|
||||||
if (!activeUserRoles)
|
if (!activeUserRoles)
|
||||||
{
|
{
|
||||||
activeUser = [[self context] activeUser];
|
activeUser = [[self context] activeUser];
|
||||||
|
woContext = [[self userContext] woContext];
|
||||||
activeUserRoles = [activeUser rolesForObject: sogoObject
|
activeUserRoles = [activeUser rolesForObject: sogoObject
|
||||||
inContext: [context woContext]];
|
inContext: woContext];
|
||||||
[activeUserRoles retain];
|
[activeUserRoles retain];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#import "MAPIStoreContext.h"
|
#import "MAPIStoreContext.h"
|
||||||
#import "MAPIStoreGCSFolder.h"
|
#import "MAPIStoreGCSFolder.h"
|
||||||
#import "MAPIStoreTypes.h"
|
#import "MAPIStoreTypes.h"
|
||||||
|
#import "MAPIStoreUserContext.h"
|
||||||
#import "NSData+MAPIStore.h"
|
#import "NSData+MAPIStore.h"
|
||||||
|
|
||||||
#import "MAPIStoreGCSMessage.h"
|
#import "MAPIStoreGCSMessage.h"
|
||||||
|
@ -56,15 +57,17 @@
|
||||||
MAPIStoreContext *context;
|
MAPIStoreContext *context;
|
||||||
WOContext *woContext;
|
WOContext *woContext;
|
||||||
SoSecurityManager *sm;
|
SoSecurityManager *sm;
|
||||||
|
MAPIStoreUserContext *userContext;
|
||||||
uint32_t access;
|
uint32_t access;
|
||||||
|
|
||||||
context = [self context];
|
context = [self context];
|
||||||
if ([[context activeUser] isEqual: [context ownerUser]])
|
userContext = [self userContext];
|
||||||
|
if ([[context activeUser] isEqual: [userContext sogoUser]])
|
||||||
access = 0x03;
|
access = 0x03;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sm = [SoSecurityManager sharedSecurityManager];
|
sm = [SoSecurityManager sharedSecurityManager];
|
||||||
woContext = [context woContext];
|
woContext = [userContext woContext];
|
||||||
|
|
||||||
access = 0;
|
access = 0;
|
||||||
if (![sm validatePermission: SoPerm_ChangeImagesAndFiles
|
if (![sm validatePermission: SoPerm_ChangeImagesAndFiles
|
||||||
|
@ -89,18 +92,19 @@
|
||||||
inMemCtx: (TALLOC_CTX *) memCtx
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
{
|
{
|
||||||
MAPIStoreContext *context;
|
MAPIStoreContext *context;
|
||||||
|
MAPIStoreUserContext *userContext;
|
||||||
WOContext *woContext;
|
WOContext *woContext;
|
||||||
SoSecurityManager *sm;
|
SoSecurityManager *sm;
|
||||||
uint32_t accessLvl;
|
uint32_t accessLvl;
|
||||||
|
|
||||||
context = [self context];
|
context = [self context];
|
||||||
if ([[context activeUser] isEqual: [context ownerUser]])
|
userContext = [self userContext];
|
||||||
|
if ([[context activeUser] isEqual: [userContext sogoUser]])
|
||||||
accessLvl = 1;
|
accessLvl = 1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sm = [SoSecurityManager sharedSecurityManager];
|
sm = [SoSecurityManager sharedSecurityManager];
|
||||||
woContext = [context woContext];
|
woContext = [userContext woContext];
|
||||||
|
|
||||||
if (![sm validatePermission: SoPerm_ChangeImagesAndFiles
|
if (![sm validatePermission: SoPerm_ChangeImagesAndFiles
|
||||||
onObject: sogoObject
|
onObject: sogoObject
|
||||||
inContext: woContext])
|
inContext: woContext])
|
||||||
|
|
|
@ -28,21 +28,9 @@
|
||||||
@interface MAPIStoreMailContext : MAPIStoreContext
|
@interface MAPIStoreMailContext : MAPIStoreContext
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface MAPIStoreInboxContext : MAPIStoreMailContext
|
|
||||||
@end
|
|
||||||
|
|
||||||
@interface MAPIStoreSentItemsContext : MAPIStoreMailContext
|
|
||||||
@end
|
|
||||||
|
|
||||||
@interface MAPIStoreDraftsContext : MAPIStoreMailContext
|
|
||||||
@end
|
|
||||||
|
|
||||||
#import "MAPIStoreFSBaseContext.h"
|
#import "MAPIStoreFSBaseContext.h"
|
||||||
|
|
||||||
@interface MAPIStoreDeletedItemsContext : MAPIStoreFSBaseContext
|
@interface MAPIStoreDeletedItemsContext : MAPIStoreFSBaseContext
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface MAPIStoreOutboxContext : MAPIStoreMailContext
|
|
||||||
@end
|
|
||||||
|
|
||||||
#endif /* MAPISTOREMAILCONTEXT_H */
|
#endif /* MAPISTOREMAILCONTEXT_H */
|
||||||
|
|
|
@ -22,20 +22,90 @@
|
||||||
|
|
||||||
#import <Foundation/NSString.h>
|
#import <Foundation/NSString.h>
|
||||||
|
|
||||||
|
#import <Mailer/SOGoMailAccount.h>
|
||||||
|
#import <Mailer/SOGoMailFolder.h>
|
||||||
|
|
||||||
#import "MAPIStoreMailFolder.h"
|
#import "MAPIStoreMailFolder.h"
|
||||||
#import "MAPIStoreMapping.h"
|
#import "MAPIStoreUserContext.h"
|
||||||
#import "NSString+MAPIStore.h"
|
#import "NSString+MAPIStore.h"
|
||||||
|
|
||||||
#import "MAPIStoreMailContext.h"
|
#import "MAPIStoreMailContext.h"
|
||||||
|
|
||||||
|
#include <dlinklist.h>
|
||||||
#undef DEBUG
|
#undef DEBUG
|
||||||
#include <mapistore/mapistore.h>
|
#include <mapistore/mapistore.h>
|
||||||
|
|
||||||
|
static Class MAPIStoreMailFolderK;
|
||||||
|
|
||||||
@implementation MAPIStoreMailContext
|
@implementation MAPIStoreMailContext
|
||||||
|
|
||||||
|
+ (void) initialize
|
||||||
|
{
|
||||||
|
MAPIStoreMailFolderK = [MAPIStoreMailFolder class];
|
||||||
|
}
|
||||||
|
|
||||||
+ (NSString *) MAPIModuleName
|
+ (NSString *) MAPIModuleName
|
||||||
{
|
{
|
||||||
return nil;
|
return @"mail";
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
||||||
|
withTDBIndexing: (struct tdb_wrap *) indexingTdb
|
||||||
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
|
{
|
||||||
|
struct mapistore_contexts_list *firstContext, *context;
|
||||||
|
NSString *urlBase, *stringData;
|
||||||
|
enum mapistore_context_role role[] = {MAPISTORE_MAIL_ROLE,
|
||||||
|
MAPISTORE_DRAFTS_ROLE,
|
||||||
|
MAPISTORE_SENTITEMS_ROLE,
|
||||||
|
MAPISTORE_OUTBOX_ROLE};
|
||||||
|
NSString *folderName[4];
|
||||||
|
NSUInteger count;
|
||||||
|
SOGoMailAccount *accountFolder;
|
||||||
|
MAPIStoreUserContext *userContext;
|
||||||
|
WOContext *woContext;
|
||||||
|
|
||||||
|
firstContext = NULL;
|
||||||
|
|
||||||
|
userContext = [MAPIStoreUserContext userContextWithUsername: userName
|
||||||
|
andTDBIndexing: indexingTdb];
|
||||||
|
accountFolder = [userContext mailRoot];
|
||||||
|
woContext = [userContext woContext];
|
||||||
|
folderName[0] = @"folderINBOX";
|
||||||
|
folderName[1] = [NSString stringWithFormat: @"folder%@",
|
||||||
|
[accountFolder draftsFolderNameInContext: woContext]];
|
||||||
|
folderName[2] = [NSString stringWithFormat: @"folder%@",
|
||||||
|
[accountFolder sentFolderNameInContext: woContext]];
|
||||||
|
folderName[3] = folderName[1];
|
||||||
|
|
||||||
|
urlBase = [NSString stringWithFormat: @"sogo://%@:%@@mail/", userName, userName];
|
||||||
|
|
||||||
|
for (count = 0; count < 4; count++)
|
||||||
|
{
|
||||||
|
context = talloc_zero (memCtx, struct mapistore_contexts_list);
|
||||||
|
stringData = [NSString stringWithFormat: @"%@%@", urlBase,
|
||||||
|
folderName[count]];
|
||||||
|
context->url = [stringData asUnicodeInMemCtx: context];
|
||||||
|
/* remove "folder" prefix */
|
||||||
|
stringData = [folderName[count] substringFromIndex: 6];
|
||||||
|
context->name = [stringData asUnicodeInMemCtx: context];
|
||||||
|
context->main_folder = true;
|
||||||
|
context->role = role[count];
|
||||||
|
context->tag = "tag";
|
||||||
|
DLIST_ADD_END (firstContext, context, void);
|
||||||
|
}
|
||||||
|
|
||||||
|
return firstContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (Class) MAPIStoreFolderClass
|
||||||
|
{
|
||||||
|
return MAPIStoreMailFolderK;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id) rootSOGoFolder
|
||||||
|
{
|
||||||
|
return [userContext mailRoot];
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (enum mapistore_context_role) contextRole
|
+ (enum mapistore_context_role) contextRole
|
||||||
|
@ -45,82 +115,6 @@
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation MAPIStoreInboxContext
|
|
||||||
|
|
||||||
+ (NSString *) MAPIModuleName
|
|
||||||
{
|
|
||||||
return @"inbox";
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
|
||||||
inMemCtx: (TALLOC_CTX *) memCtx
|
|
||||||
{
|
|
||||||
struct mapistore_contexts_list *context;
|
|
||||||
NSString *url;
|
|
||||||
|
|
||||||
context = talloc_zero(memCtx, struct mapistore_contexts_list);
|
|
||||||
url = [NSString stringWithFormat: @"sogo://%@:%@@%@/", userName, userName, [self MAPIModuleName]];
|
|
||||||
context->url = [url asUnicodeInMemCtx: context];
|
|
||||||
// context->name = "Inbox";
|
|
||||||
context->main_folder = true;
|
|
||||||
context->role = [self contextRole];
|
|
||||||
context->tag = "tag";
|
|
||||||
context->prev = context;
|
|
||||||
|
|
||||||
return context;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) setupBaseFolder: (NSURL *) newURL
|
|
||||||
{
|
|
||||||
baseFolder = [MAPIStoreInboxFolder baseFolderWithURL: newURL
|
|
||||||
inContext: self];
|
|
||||||
[baseFolder retain];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation MAPIStoreSentItemsContext
|
|
||||||
|
|
||||||
+ (NSString *) MAPIModuleName
|
|
||||||
{
|
|
||||||
return @"sent-items";
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (enum mapistore_context_role) contextRole
|
|
||||||
{
|
|
||||||
return MAPISTORE_SENTITEMS_ROLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) setupBaseFolder: (NSURL *) newURL
|
|
||||||
{
|
|
||||||
baseFolder = [MAPIStoreSentItemsFolder baseFolderWithURL: newURL
|
|
||||||
inContext: self];
|
|
||||||
[baseFolder retain];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation MAPIStoreDraftsContext
|
|
||||||
|
|
||||||
+ (NSString *) MAPIModuleName
|
|
||||||
{
|
|
||||||
return @"drafts";
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (enum mapistore_context_role) contextRole
|
|
||||||
{
|
|
||||||
return MAPISTORE_DRAFTS_ROLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) setupBaseFolder: (NSURL *) newURL
|
|
||||||
{
|
|
||||||
baseFolder = [MAPIStoreDraftsFolder baseFolderWithURL: newURL
|
|
||||||
inContext: self];
|
|
||||||
[baseFolder retain];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
#import "MAPIStoreFSFolder.h"
|
#import "MAPIStoreFSFolder.h"
|
||||||
|
|
||||||
@implementation MAPIStoreDeletedItemsContext
|
@implementation MAPIStoreDeletedItemsContext
|
||||||
|
@ -135,38 +129,4 @@
|
||||||
return MAPISTORE_DELETEDITEMS_ROLE;
|
return MAPISTORE_DELETEDITEMS_ROLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setupBaseFolder: (NSURL *) newURL
|
|
||||||
{
|
|
||||||
baseFolder = [MAPIStoreFSFolder baseFolderWithURL: newURL inContext: self];
|
|
||||||
[baseFolder retain];
|
|
||||||
}
|
|
||||||
|
|
||||||
// - (void) setupBaseFolder: (NSURL *) newURL
|
|
||||||
// {
|
|
||||||
// baseFolder = [MAPIStoreDeletedItemsFolder baseFolderWithURL: newURL
|
|
||||||
// inContext: self];
|
|
||||||
// [baseFolder retain];
|
|
||||||
// }
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation MAPIStoreOutboxContext
|
|
||||||
|
|
||||||
+ (NSString *) MAPIModuleName
|
|
||||||
{
|
|
||||||
return @"outbox";
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (enum mapistore_context_role) contextRole
|
|
||||||
{
|
|
||||||
return MAPISTORE_OUTBOX_ROLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) setupBaseFolder: (NSURL *) newURL
|
|
||||||
{
|
|
||||||
baseFolder = [MAPIStoreOutboxFolder baseFolderWithURL: newURL
|
|
||||||
inContext: self];
|
|
||||||
[baseFolder retain];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -37,13 +37,13 @@
|
||||||
@interface MAPIStoreMailFolder : MAPIStoreFolder
|
@interface MAPIStoreMailFolder : MAPIStoreFolder
|
||||||
{
|
{
|
||||||
SOGoMAPIFSMessage *versionsMessage;
|
SOGoMAPIFSMessage *versionsMessage;
|
||||||
|
BOOL usesAltNameSpace;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* subclasses */
|
/* subclasses */
|
||||||
- (SOGoMailFolder *) specialFolderFromAccount: (SOGoMailAccount *) account
|
- (SOGoMailFolder *) specialFolderFromAccount: (SOGoMailAccount *) account
|
||||||
inContext: (WOContext *) woContext;
|
inContext: (WOContext *) woContext;
|
||||||
|
|
||||||
|
|
||||||
/* synchronisation & versioning */
|
/* synchronisation & versioning */
|
||||||
- (BOOL) synchroniseCache;
|
- (BOOL) synchroniseCache;
|
||||||
- (NSNumber *) modseqFromMessageChangeNumber: (NSNumber *) changeNum;
|
- (NSNumber *) modseqFromMessageChangeNumber: (NSNumber *) changeNum;
|
||||||
|
@ -56,23 +56,4 @@
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface MAPIStoreInboxFolder : MAPIStoreMailFolder
|
|
||||||
{
|
|
||||||
BOOL usesAltNameSpace;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
@interface MAPIStoreSentItemsFolder : MAPIStoreMailFolder
|
|
||||||
@end
|
|
||||||
|
|
||||||
@interface MAPIStoreDraftsFolder : MAPIStoreMailFolder
|
|
||||||
@end
|
|
||||||
|
|
||||||
// @interface MAPIStoreDeletedItemsFolder : MAPIStoreFFolder
|
|
||||||
// @end
|
|
||||||
|
|
||||||
@interface MAPIStoreOutboxFolder : MAPIStoreMailFolder
|
|
||||||
@end
|
|
||||||
|
|
||||||
#endif /* MAPISTOREMAILFOLDER_H */
|
#endif /* MAPISTOREMAILFOLDER_H */
|
||||||
|
|
|
@ -77,57 +77,6 @@ static Class SOGoMailFolderK;
|
||||||
[MAPIStoreAppointmentWrapper class];
|
[MAPIStoreAppointmentWrapper class];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) initWithURL: (NSURL *) newURL
|
|
||||||
inContext: (MAPIStoreContext *) newContext
|
|
||||||
{
|
|
||||||
SOGoUserFolder *userFolder;
|
|
||||||
SOGoMailAccounts *accountsFolder;
|
|
||||||
SOGoMailAccount *accountFolder;
|
|
||||||
SOGoFolder *currentContainer;
|
|
||||||
WOContext *woContext;
|
|
||||||
|
|
||||||
if ((self = [super initWithURL: newURL
|
|
||||||
inContext: newContext]))
|
|
||||||
{
|
|
||||||
woContext = [newContext woContext];
|
|
||||||
userFolder = [SOGoUserFolder objectWithName: [newURL user]
|
|
||||||
inContainer: MAPIApp];
|
|
||||||
[parentContainersBag addObject: userFolder];
|
|
||||||
[woContext setClientObject: userFolder];
|
|
||||||
|
|
||||||
accountsFolder = [userFolder lookupName: @"Mail"
|
|
||||||
inContext: woContext
|
|
||||||
acquire: NO];
|
|
||||||
[parentContainersBag addObject: accountsFolder];
|
|
||||||
[woContext setClientObject: accountsFolder];
|
|
||||||
|
|
||||||
accountFolder = [accountsFolder lookupName: @"0"
|
|
||||||
inContext: woContext
|
|
||||||
acquire: NO];
|
|
||||||
[[accountFolder imap4Connection]
|
|
||||||
enableExtension: @"QRESYNC"];
|
|
||||||
|
|
||||||
[parentContainersBag addObject: accountFolder];
|
|
||||||
[woContext setClientObject: accountFolder];
|
|
||||||
|
|
||||||
sogoObject = [self specialFolderFromAccount: accountFolder
|
|
||||||
inContext: woContext];
|
|
||||||
[sogoObject retain];
|
|
||||||
currentContainer = [sogoObject container];
|
|
||||||
while (currentContainer != (SOGoFolder *) accountFolder)
|
|
||||||
{
|
|
||||||
[parentContainersBag addObject: currentContainer];
|
|
||||||
currentContainer = [currentContainer container];
|
|
||||||
}
|
|
||||||
|
|
||||||
ASSIGN (versionsMessage,
|
|
||||||
[SOGoMAPIFSMessage objectWithName: @"versions.plist"
|
|
||||||
inContainer: propsFolder]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) initWithSOGoObject: (id) newSOGoObject
|
- (id) initWithSOGoObject: (id) newSOGoObject
|
||||||
inContainer: (MAPIStoreObject *) newContainer
|
inContainer: (MAPIStoreObject *) newContainer
|
||||||
{
|
{
|
||||||
|
@ -135,15 +84,20 @@ static Class SOGoMailFolderK;
|
||||||
|
|
||||||
if ((self = [super initWithSOGoObject: newSOGoObject inContainer: newContainer]))
|
if ((self = [super initWithSOGoObject: newSOGoObject inContainer: newContainer]))
|
||||||
{
|
{
|
||||||
|
usesAltNameSpace = NO;
|
||||||
// urlString = [[self url] stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
|
// urlString = [[self url] stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
|
||||||
ASSIGN (versionsMessage,
|
|
||||||
[SOGoMAPIFSMessage objectWithName: @"versions.plist"
|
|
||||||
inContainer: propsFolder]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) setupVersionsMessage
|
||||||
|
{
|
||||||
|
ASSIGN (versionsMessage,
|
||||||
|
[SOGoMAPIFSMessage objectWithName: @"versions.plist"
|
||||||
|
inContainer: propsFolder]);
|
||||||
|
}
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
[versionsMessage release];
|
[versionsMessage release];
|
||||||
|
@ -166,7 +120,6 @@ static Class SOGoMailFolderK;
|
||||||
|
|
||||||
- (NSString *) createFolder: (struct SRow *) aRow
|
- (NSString *) createFolder: (struct SRow *) aRow
|
||||||
withFID: (uint64_t) newFID
|
withFID: (uint64_t) newFID
|
||||||
inContainer: (id) subfolderParent
|
|
||||||
{
|
{
|
||||||
NSString *folderName, *nameInContainer;
|
NSString *folderName, *nameInContainer;
|
||||||
SOGoMailFolder *newFolder;
|
SOGoMailFolder *newFolder;
|
||||||
|
@ -188,7 +141,7 @@ static Class SOGoMailFolderK;
|
||||||
nameInContainer = [NSString stringWithFormat: @"folder%@",
|
nameInContainer = [NSString stringWithFormat: @"folder%@",
|
||||||
[folderName asCSSIdentifier]];
|
[folderName asCSSIdentifier]];
|
||||||
newFolder = [SOGoMailFolderK objectWithName: nameInContainer
|
newFolder = [SOGoMailFolderK objectWithName: nameInContainer
|
||||||
inContainer: subfolderParent];
|
inContainer: sogoObject];
|
||||||
if (![newFolder create])
|
if (![newFolder create])
|
||||||
nameInContainer = nil;
|
nameInContainer = nil;
|
||||||
}
|
}
|
||||||
|
@ -196,13 +149,6 @@ static Class SOGoMailFolderK;
|
||||||
return nameInContainer;
|
return nameInContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *) createFolder: (struct SRow *) aRow
|
|
||||||
withFID: (uint64_t) newFID
|
|
||||||
{
|
|
||||||
return [self createFolder: aRow withFID: newFID
|
|
||||||
inContainer: sogoObject];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (int) getPrContentUnread: (void **) data
|
- (int) getPrContentUnread: (void **) data
|
||||||
inMemCtx: (TALLOC_CTX *) memCtx
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
{
|
{
|
||||||
|
@ -896,7 +842,7 @@ _parseCOPYUID (NSString *line, NSArray **destUIDsP)
|
||||||
wantCopy: wantCopy];
|
wantCopy: wantCopy];
|
||||||
|
|
||||||
/* Conversion of mids to IMAP uids */
|
/* Conversion of mids to IMAP uids */
|
||||||
mapping = [[self context] mapping];
|
mapping = [self mapping];
|
||||||
uids = [NSMutableArray arrayWithCapacity: midCount];
|
uids = [NSMutableArray arrayWithCapacity: midCount];
|
||||||
oldMessageURLs = [NSMutableArray arrayWithCapacity: midCount];
|
oldMessageURLs = [NSMutableArray arrayWithCapacity: midCount];
|
||||||
for (count = 0; count < midCount; count++)
|
for (count = 0; count < midCount; count++)
|
||||||
|
@ -1060,172 +1006,3 @@ _parseCOPYUID (NSString *line, NSArray **destUIDsP)
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation MAPIStoreInboxFolder : MAPIStoreMailFolder
|
|
||||||
|
|
||||||
- (id) initWithURL: (NSURL *) newURL
|
|
||||||
inContext: (MAPIStoreContext *) newContext
|
|
||||||
{
|
|
||||||
NSDictionary *list, *response;
|
|
||||||
NGImap4Client *client;
|
|
||||||
|
|
||||||
if ((self = [super initWithURL: newURL
|
|
||||||
inContext: newContext]))
|
|
||||||
{
|
|
||||||
client = [[(SOGoMailFolder *) sogoObject imap4Connection] client];
|
|
||||||
list = [client list: @"" pattern: @"INBOX"];
|
|
||||||
response = [[list objectForKey: @"RawResponse"] objectForKey: @"list"];
|
|
||||||
usesAltNameSpace = [[response objectForKey: @"flags"] containsObject: @"noinferiors"];
|
|
||||||
}
|
|
||||||
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (SOGoMailFolder *) specialFolderFromAccount: (SOGoMailAccount *) accountFolder
|
|
||||||
inContext: (WOContext *) woContext
|
|
||||||
{
|
|
||||||
return [accountFolder inboxFolderInContext: woContext];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSString *) createFolder: (struct SRow *) aRow
|
|
||||||
withFID: (uint64_t) newFID
|
|
||||||
{
|
|
||||||
id subfolderParent;
|
|
||||||
|
|
||||||
if (usesAltNameSpace)
|
|
||||||
subfolderParent = [(SOGoMailFolder *) sogoObject mailAccountFolder];
|
|
||||||
else
|
|
||||||
subfolderParent = sogoObject;
|
|
||||||
|
|
||||||
return [self createFolder: aRow withFID: newFID
|
|
||||||
inContainer: subfolderParent];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSMutableString *) _imapFolderNameRepresentation: (NSString *) subfolderName
|
|
||||||
{
|
|
||||||
NSMutableString *representation;
|
|
||||||
|
|
||||||
if (usesAltNameSpace)
|
|
||||||
{
|
|
||||||
/* with "altnamespace", the subfolders are NEVER subfolders of INBOX... */;
|
|
||||||
if (![subfolderName hasPrefix: @"folder"])
|
|
||||||
abort ();
|
|
||||||
representation
|
|
||||||
= [NSMutableString stringWithString:
|
|
||||||
[subfolderName substringFromIndex: 6]];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
representation = [super _imapFolderNameRepresentation: subfolderName];
|
|
||||||
|
|
||||||
return representation;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSArray *) folderKeysMatchingQualifier: (EOQualifier *) qualifier
|
|
||||||
andSortOrderings: (NSArray *) sortOrderings
|
|
||||||
{
|
|
||||||
NSMutableArray *subfolderKeys;
|
|
||||||
SOGoMailAccount *account;
|
|
||||||
|
|
||||||
if (usesAltNameSpace)
|
|
||||||
{
|
|
||||||
if (qualifier)
|
|
||||||
[self errorWithFormat: @"qualifier is not used for folders"];
|
|
||||||
if (sortOrderings)
|
|
||||||
[self errorWithFormat: @"sort orderings are not used for folders"];
|
|
||||||
|
|
||||||
account = [(SOGoMailFolder *) sogoObject mailAccountFolder];
|
|
||||||
subfolderKeys
|
|
||||||
= [[account toManyRelationshipKeysWithNamespaces: NO]
|
|
||||||
mutableCopy];
|
|
||||||
[subfolderKeys removeObject: @"folderINBOX"];
|
|
||||||
|
|
||||||
[self _cleanupSubfolderKeys: subfolderKeys];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
subfolderKeys = [[super folderKeysMatchingQualifier: qualifier
|
|
||||||
andSortOrderings: sortOrderings]
|
|
||||||
mutableCopy];
|
|
||||||
|
|
||||||
/* TODO: remove special folders */
|
|
||||||
|
|
||||||
[subfolderKeys autorelease];
|
|
||||||
|
|
||||||
return subfolderKeys;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) lookupFolder: (NSString *) childKey
|
|
||||||
{
|
|
||||||
MAPIStoreMailFolder *childFolder = nil;
|
|
||||||
SOGoMailAccount *account;
|
|
||||||
SOGoMailFolder *sogoFolder;
|
|
||||||
WOContext *woContext;
|
|
||||||
|
|
||||||
if (usesAltNameSpace)
|
|
||||||
{
|
|
||||||
if ([[self folderKeys] containsObject: childKey])
|
|
||||||
{
|
|
||||||
woContext = [[self context] woContext];
|
|
||||||
account = [(SOGoMailFolder *) sogoObject mailAccountFolder];
|
|
||||||
sogoFolder = [account lookupName: childKey inContext: woContext
|
|
||||||
acquire: NO];
|
|
||||||
[sogoFolder setContext: woContext];
|
|
||||||
childFolder = [MAPIStoreMailFolder mapiStoreObjectWithSOGoObject: sogoFolder
|
|
||||||
inContainer: self];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
childFolder = [super lookupFolder: childKey];
|
|
||||||
|
|
||||||
return childFolder;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL) supportsSubFolders
|
|
||||||
{
|
|
||||||
return !usesAltNameSpace;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation MAPIStoreSentItemsFolder : MAPIStoreMailFolder
|
|
||||||
|
|
||||||
- (SOGoMailFolder *) specialFolderFromAccount: (SOGoMailAccount *) accountFolder
|
|
||||||
inContext: (WOContext *) woContext
|
|
||||||
{
|
|
||||||
return [accountFolder sentFolderInContext: woContext];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation MAPIStoreDraftsFolder : MAPIStoreMailFolder
|
|
||||||
|
|
||||||
- (SOGoMailFolder *) specialFolderFromAccount: (SOGoMailAccount *) accountFolder
|
|
||||||
inContext: (WOContext *) woContext
|
|
||||||
{
|
|
||||||
return [accountFolder draftsFolderInContext: woContext];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
// @implementation MAPIStoreDeletedItemsFolder : MAPIStoreMailFolder
|
|
||||||
|
|
||||||
// - (SOGoMailFolder *) specialFolderFromAccount: (SOGoMailAccount *) accountFolder
|
|
||||||
// inContext: (WOContext *) woContext
|
|
||||||
// {
|
|
||||||
// return [accountFolder trashFolderInContext: woContext];
|
|
||||||
// }
|
|
||||||
|
|
||||||
// @end
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
@implementation MAPIStoreOutboxFolder : MAPIStoreMailFolder
|
|
||||||
|
|
||||||
- (SOGoMailFolder *) specialFolderFromAccount: (SOGoMailAccount *) accountFolder
|
|
||||||
inContext: (WOContext *) woContext
|
|
||||||
{
|
|
||||||
return [accountFolder draftsFolderInContext: woContext];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
|
|
||||||
@class iCalCalendar, iCalEvent;
|
@class iCalCalendar, iCalEvent;
|
||||||
|
|
||||||
static Class NSExceptionK, MAPIStoreSentItemsFolderK, MAPIStoreDraftsFolderK;
|
static Class NSExceptionK;
|
||||||
|
|
||||||
@interface NSString (MAPIStoreMIME)
|
@interface NSString (MAPIStoreMIME)
|
||||||
|
|
||||||
|
@ -105,8 +105,6 @@ static Class NSExceptionK, MAPIStoreSentItemsFolderK, MAPIStoreDraftsFolderK;
|
||||||
+ (void) initialize
|
+ (void) initialize
|
||||||
{
|
{
|
||||||
NSExceptionK = [NSException class];
|
NSExceptionK = [NSException class];
|
||||||
MAPIStoreSentItemsFolderK = [MAPIStoreSentItemsFolder class];
|
|
||||||
MAPIStoreDraftsFolderK = [MAPIStoreDraftsFolder class];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) init
|
- (id) init
|
||||||
|
@ -582,9 +580,9 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||||
coreInfos = [sogoObject fetchCoreInfos];
|
coreInfos = [sogoObject fetchCoreInfos];
|
||||||
flags = [coreInfos objectForKey: @"flags"];
|
flags = [coreInfos objectForKey: @"flags"];
|
||||||
|
|
||||||
if ([container isKindOfClass: MAPIStoreSentItemsFolderK]
|
// if ([container isKindOfClass: MAPIStoreSentItemsFolderK]
|
||||||
|| [container isKindOfClass: MAPIStoreDraftsFolderK])
|
// || [container isKindOfClass: MAPIStoreDraftsFolderK])
|
||||||
v |= MSGFLAG_FROMME;
|
// v |= MSGFLAG_FROMME;
|
||||||
if ([flags containsObject: @"seen"])
|
if ([flags containsObject: @"seen"])
|
||||||
v |= MSGFLAG_READ;
|
v |= MSGFLAG_READ;
|
||||||
if ([[self attachmentKeys]
|
if ([[self attachmentKeys]
|
||||||
|
|
|
@ -813,7 +813,7 @@ MakeMessageBody (NSDictionary *mailProperties, NSDictionary *attachmentParts,
|
||||||
if (error)
|
if (error)
|
||||||
[self logWithFormat: @"an error occurred: '%@'", error];
|
[self logWithFormat: @"an error occurred: '%@'", error];
|
||||||
|
|
||||||
mapping = [[self context] mapping];
|
mapping = [self mapping];
|
||||||
[mapping unregisterURLWithID: [self objectId]];
|
[mapping unregisterURLWithID: [self objectId]];
|
||||||
[self setIsNew: NO];
|
[self setIsNew: NO];
|
||||||
[properties removeAllObjects];
|
[properties removeAllObjects];
|
||||||
|
@ -851,7 +851,7 @@ MakeMessageBody (NSDictionary *mailProperties, NSDictionary *attachmentParts,
|
||||||
newIdString = [[flag componentsSeparatedByString: @" "]
|
newIdString = [[flag componentsSeparatedByString: @" "]
|
||||||
objectAtIndex: 2];
|
objectAtIndex: 2];
|
||||||
mid = [self objectId];
|
mid = [self objectId];
|
||||||
mapping = [[self context] mapping];
|
mapping = [self mapping];
|
||||||
[mapping unregisterURLWithID: mid];
|
[mapping unregisterURLWithID: mid];
|
||||||
[sogoObject setNameInContainer: [NSString stringWithFormat: @"%@.eml", newIdString]];
|
[sogoObject setNameInContainer: [NSString stringWithFormat: @"%@.eml", newIdString]];
|
||||||
[mapping registerURL: [self url] withID: mid];
|
[mapping registerURL: [self url] withID: mid];
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#import "MAPIStorePropertySelectors.h"
|
#import "MAPIStorePropertySelectors.h"
|
||||||
#import "MAPIStoreSamDBUtils.h"
|
#import "MAPIStoreSamDBUtils.h"
|
||||||
#import "MAPIStoreTypes.h"
|
#import "MAPIStoreTypes.h"
|
||||||
|
#import "MAPIStoreUserContext.h"
|
||||||
#import "NSData+MAPIStore.h"
|
#import "NSData+MAPIStore.h"
|
||||||
#import "NSObject+MAPIStore.h"
|
#import "NSObject+MAPIStore.h"
|
||||||
#import "NSString+MAPIStore.h"
|
#import "NSString+MAPIStore.h"
|
||||||
|
@ -286,10 +287,11 @@ rtf2html (NSData *compressedRTF)
|
||||||
{
|
{
|
||||||
enum mapistore_error rc;
|
enum mapistore_error rc;
|
||||||
MAPIStoreContext *context;
|
MAPIStoreContext *context;
|
||||||
|
SOGoUser *ownerUser;
|
||||||
|
|
||||||
context = [self context];
|
context = [self context];
|
||||||
|
ownerUser = [[self userContext] sogoUser];
|
||||||
if ([[context activeUser] isEqual: [context ownerUser]]
|
if ([[context activeUser] isEqual: ownerUser]
|
||||||
|| [self subscriberCanModifyMessage])
|
|| [self subscriberCanModifyMessage])
|
||||||
rc = [super addPropertiesFromRow: aRow];
|
rc = [super addPropertiesFromRow: aRow];
|
||||||
else
|
else
|
||||||
|
@ -432,9 +434,11 @@ rtf2html (NSData *compressedRTF)
|
||||||
uint64_t folderId;
|
uint64_t folderId;
|
||||||
struct mapistore_context *mstoreCtx;
|
struct mapistore_context *mstoreCtx;
|
||||||
MAPIStoreContext *context;
|
MAPIStoreContext *context;
|
||||||
|
SOGoUser *ownerUser;
|
||||||
|
|
||||||
context = [self context];
|
context = [self context];
|
||||||
if ([[context activeUser] isEqual: [context ownerUser]]
|
ownerUser = [[self userContext] sogoUser];
|
||||||
|
if ([[context activeUser] isEqual: ownerUser]
|
||||||
|| ((isNew
|
|| ((isNew
|
||||||
&& [(MAPIStoreFolder *) container subscriberCanCreateMessages])
|
&& [(MAPIStoreFolder *) container subscriberCanCreateMessages])
|
||||||
|| (!isNew && [self subscriberCanModifyMessage])))
|
|| (!isNew && [self subscriberCanModifyMessage])))
|
||||||
|
@ -560,9 +564,11 @@ rtf2html (NSData *compressedRTF)
|
||||||
uint32_t access = 0;
|
uint32_t access = 0;
|
||||||
BOOL userIsOwner;
|
BOOL userIsOwner;
|
||||||
MAPIStoreContext *context;
|
MAPIStoreContext *context;
|
||||||
|
SOGoUser *ownerUser;
|
||||||
|
|
||||||
context = [self context];
|
context = [self context];
|
||||||
userIsOwner = [[context activeUser] isEqual: [context ownerUser]];
|
ownerUser = [[self userContext] sogoUser];
|
||||||
|
userIsOwner = [[context activeUser] isEqual: ownerUser];
|
||||||
if (userIsOwner || [self subscriberCanModifyMessage])
|
if (userIsOwner || [self subscriberCanModifyMessage])
|
||||||
access |= 0x01;
|
access |= 0x01;
|
||||||
if (userIsOwner || [self subscriberCanReadMessage])
|
if (userIsOwner || [self subscriberCanReadMessage])
|
||||||
|
@ -587,9 +593,11 @@ rtf2html (NSData *compressedRTF)
|
||||||
uint32_t access = 0;
|
uint32_t access = 0;
|
||||||
BOOL userIsOwner;
|
BOOL userIsOwner;
|
||||||
MAPIStoreContext *context;
|
MAPIStoreContext *context;
|
||||||
|
SOGoUser *ownerUser;
|
||||||
|
|
||||||
context = [self context];
|
context = [self context];
|
||||||
userIsOwner = [[context activeUser] isEqual: [context ownerUser]];
|
ownerUser = [[self userContext] sogoUser];
|
||||||
|
userIsOwner = [[context activeUser] isEqual: ownerUser];
|
||||||
if (userIsOwner || [self subscriberCanModifyMessage])
|
if (userIsOwner || [self subscriberCanModifyMessage])
|
||||||
access = 0x01;
|
access = 0x01;
|
||||||
else
|
else
|
||||||
|
@ -862,14 +870,15 @@ rtf2html (NSData *compressedRTF)
|
||||||
- (NSArray *) activeUserRoles
|
- (NSArray *) activeUserRoles
|
||||||
{
|
{
|
||||||
MAPIStoreContext *context;
|
MAPIStoreContext *context;
|
||||||
|
MAPIStoreUserContext *userContext;
|
||||||
|
|
||||||
if (!activeUserRoles)
|
if (!activeUserRoles)
|
||||||
{
|
{
|
||||||
context = [self context];
|
context = [self context];
|
||||||
|
userContext = [self userContext];
|
||||||
activeUserRoles = [[context activeUser]
|
activeUserRoles = [[context activeUser]
|
||||||
rolesForObject: sogoObject
|
rolesForObject: sogoObject
|
||||||
inContext: [context woContext]];
|
inContext: [userContext woContext]];
|
||||||
[activeUserRoles retain];
|
[activeUserRoles retain];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
||||||
|
withTDBIndexing: (struct tdb_wrap *) indexingTdb
|
||||||
inMemCtx: (TALLOC_CTX *) memCtx
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
{
|
{
|
||||||
struct mapistore_contexts_list *context;
|
struct mapistore_contexts_list *context;
|
||||||
|
@ -54,11 +55,4 @@
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setupBaseFolder: (NSURL *) newURL
|
|
||||||
{
|
|
||||||
baseFolder = [MAPIStoreNotesFolder baseFolderWithURL: newURL
|
|
||||||
inContext: self];
|
|
||||||
[baseFolder retain];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -35,8 +35,11 @@
|
||||||
|
|
||||||
@class EOQualifier;
|
@class EOQualifier;
|
||||||
|
|
||||||
|
@class MAPIStoreContext;
|
||||||
@class MAPIStoreFolder;
|
@class MAPIStoreFolder;
|
||||||
|
@class MAPIStoreMapping;
|
||||||
@class MAPIStoreTable;
|
@class MAPIStoreTable;
|
||||||
|
@class MAPIStoreUserContext;
|
||||||
|
|
||||||
@interface MAPIStoreObject : NSObject
|
@interface MAPIStoreObject : NSObject
|
||||||
{
|
{
|
||||||
|
@ -71,7 +74,9 @@
|
||||||
- (id) sogoObject;
|
- (id) sogoObject;
|
||||||
- (MAPIStoreObject *) container;
|
- (MAPIStoreObject *) container;
|
||||||
|
|
||||||
- (id) context;
|
- (MAPIStoreContext *) context;
|
||||||
|
- (MAPIStoreUserContext *) userContext;
|
||||||
|
- (MAPIStoreMapping *) mapping;
|
||||||
|
|
||||||
- (void) cleanupCaches;
|
- (void) cleanupCaches;
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#import "MAPIStoreFolder.h"
|
#import "MAPIStoreFolder.h"
|
||||||
#import "MAPIStorePropertySelectors.h"
|
#import "MAPIStorePropertySelectors.h"
|
||||||
#import "MAPIStoreTypes.h"
|
#import "MAPIStoreTypes.h"
|
||||||
|
#import "MAPIStoreUserContext.h"
|
||||||
#import "NSDate+MAPIStore.h"
|
#import "NSDate+MAPIStore.h"
|
||||||
#import "NSData+MAPIStore.h"
|
#import "NSData+MAPIStore.h"
|
||||||
#import "NSObject+MAPIStore.h"
|
#import "NSObject+MAPIStore.h"
|
||||||
|
@ -170,11 +171,21 @@ static Class NSExceptionK, MAPIStoreFolderK;
|
||||||
return [sogoObject nameInContainer];
|
return [sogoObject nameInContainer];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) context
|
- (MAPIStoreContext *) context
|
||||||
{
|
{
|
||||||
return [container context];
|
return [container context];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (MAPIStoreUserContext *) userContext
|
||||||
|
{
|
||||||
|
return [[self context] userContext];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (MAPIStoreMapping *) mapping
|
||||||
|
{
|
||||||
|
return [[self userContext] mapping];
|
||||||
|
}
|
||||||
|
|
||||||
- (void) cleanupCaches
|
- (void) cleanupCaches
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -217,7 +228,7 @@ static Class NSExceptionK, MAPIStoreFolderK;
|
||||||
NSTimeZone *tz;
|
NSTimeZone *tz;
|
||||||
WOContext *woContext;
|
WOContext *woContext;
|
||||||
|
|
||||||
woContext = [[self context] woContext];
|
woContext = [[self userContext] woContext];
|
||||||
owner = [sogoObject ownerInContext: woContext];
|
owner = [sogoObject ownerInContext: woContext];
|
||||||
ud = [[SOGoUser userWithLogin: owner] userDefaults];
|
ud = [[SOGoUser userWithLogin: owner] userDefaults];
|
||||||
tz = [ud timeZone];
|
tz = [ud timeZone];
|
||||||
|
|
|
@ -52,6 +52,7 @@ static enum mapistore_error
|
||||||
sogo_backend_unexpected_error()
|
sogo_backend_unexpected_error()
|
||||||
{
|
{
|
||||||
NSLog (@" UNEXPECTED WEIRDNESS: RECEIVED NO OBJECT");
|
NSLog (@" UNEXPECTED WEIRDNESS: RECEIVED NO OBJECT");
|
||||||
|
abort();
|
||||||
return MAPISTORE_SUCCESS;
|
return MAPISTORE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +148,8 @@ sogo_backend_create_context(TALLOC_CTX *mem_ctx,
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum mapistore_error
|
static enum mapistore_error
|
||||||
sogo_backend_list_contexts(const char *username, TALLOC_CTX *mem_ctx,
|
sogo_backend_list_contexts(const char *username, struct tdb_wrap *indexingTdb,
|
||||||
|
TALLOC_CTX *mem_ctx,
|
||||||
struct mapistore_contexts_list **contexts_listp)
|
struct mapistore_contexts_list **contexts_listp)
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool;
|
NSAutoreleasePool *pool;
|
||||||
|
@ -162,6 +164,7 @@ sogo_backend_list_contexts(const char *username, TALLOC_CTX *mem_ctx,
|
||||||
{
|
{
|
||||||
userName = [NSString stringWithUTF8String: username];
|
userName = [NSString stringWithUTF8String: username];
|
||||||
*contexts_listp = [MAPIStoreContextK listAllContextsForUser: userName
|
*contexts_listp = [MAPIStoreContextK listAllContextsForUser: userName
|
||||||
|
withTDBIndexing: indexingTdb
|
||||||
inMemCtx: mem_ctx];
|
inMemCtx: mem_ctx];
|
||||||
rc = MAPISTORE_SUCCESS;
|
rc = MAPISTORE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,29 +21,38 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#import <Foundation/NSString.h>
|
#import <Foundation/NSString.h>
|
||||||
|
#import <Appointments/SOGoAppointmentFolders.h>
|
||||||
|
|
||||||
#import "MAPIStoreTasksFolder.h"
|
#import "MAPIStoreTasksFolder.h"
|
||||||
#import "MAPIStoreMapping.h"
|
#import "MAPIStoreUserContext.h"
|
||||||
|
|
||||||
#import "MAPIStoreTasksContext.h"
|
#import "MAPIStoreTasksContext.h"
|
||||||
|
|
||||||
#undef DEBUG
|
#undef DEBUG
|
||||||
#include <mapistore/mapistore.h>
|
#include <mapistore/mapistore.h>
|
||||||
|
|
||||||
|
static Class MAPIStoreTasksFolderK;
|
||||||
|
|
||||||
@implementation MAPIStoreTasksContext
|
@implementation MAPIStoreTasksContext
|
||||||
|
|
||||||
|
+ (void) initialize
|
||||||
|
{
|
||||||
|
MAPIStoreTasksFolderK = [MAPIStoreTasksFolder class];
|
||||||
|
}
|
||||||
|
|
||||||
+ (NSString *) MAPIModuleName
|
+ (NSString *) MAPIModuleName
|
||||||
{
|
{
|
||||||
return @"tasks";
|
return @"tasks";
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
||||||
|
withTDBIndexing: (struct tdb_wrap *) indexingTdb
|
||||||
inMemCtx: (TALLOC_CTX *) memCtx
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
{
|
{
|
||||||
struct mapistore_contexts_list *context;
|
struct mapistore_contexts_list *context;
|
||||||
|
|
||||||
context = talloc_zero(memCtx, struct mapistore_contexts_list);
|
context = talloc_zero(memCtx, struct mapistore_contexts_list);
|
||||||
context->url = talloc_asprintf (context, "sogo://%s@tasks/",
|
context->url = talloc_asprintf (context, "sogo://%s@tasks/personal",
|
||||||
[userName UTF8String]);
|
[userName UTF8String]);
|
||||||
// context->name = "Tâches personnelles";
|
// context->name = "Tâches personnelles";
|
||||||
context->main_folder = true;
|
context->main_folder = true;
|
||||||
|
@ -54,11 +63,14 @@
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setupBaseFolder: (NSURL *) newURL
|
- (Class) MAPIStoreFolderClass
|
||||||
{
|
{
|
||||||
baseFolder = [MAPIStoreTasksFolder baseFolderWithURL: newURL
|
return MAPIStoreTasksFolderK;
|
||||||
inContext: self];
|
}
|
||||||
[baseFolder retain];
|
|
||||||
|
- (id) rootSOGoFolder
|
||||||
|
{
|
||||||
|
return [userContext calendarRoot];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -42,37 +42,6 @@
|
||||||
|
|
||||||
@implementation MAPIStoreTasksFolder
|
@implementation MAPIStoreTasksFolder
|
||||||
|
|
||||||
- (id) initWithURL: (NSURL *) newURL
|
|
||||||
inContext: (MAPIStoreContext *) newContext
|
|
||||||
{
|
|
||||||
SOGoUserFolder *userFolder;
|
|
||||||
SOGoAppointmentFolders *parentFolder;
|
|
||||||
WOContext *woContext;
|
|
||||||
|
|
||||||
if ((self = [super initWithURL: newURL
|
|
||||||
inContext: newContext]))
|
|
||||||
{
|
|
||||||
woContext = [newContext woContext];
|
|
||||||
userFolder = [SOGoUserFolder objectWithName: [newURL user]
|
|
||||||
inContainer: MAPIApp];
|
|
||||||
[parentContainersBag addObject: userFolder];
|
|
||||||
[woContext setClientObject: userFolder];
|
|
||||||
|
|
||||||
parentFolder = [userFolder lookupName: @"Calendar"
|
|
||||||
inContext: woContext
|
|
||||||
acquire: NO];
|
|
||||||
[parentContainersBag addObject: parentFolder];
|
|
||||||
[woContext setClientObject: parentFolder];
|
|
||||||
|
|
||||||
sogoObject = [parentFolder lookupName: @"personal"
|
|
||||||
inContext: woContext
|
|
||||||
acquire: NO];
|
|
||||||
[sogoObject retain];
|
|
||||||
}
|
|
||||||
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (MAPIStoreMessageTable *) messageTable
|
- (MAPIStoreMessageTable *) messageTable
|
||||||
{
|
{
|
||||||
[self synchroniseCache];
|
[self synchroniseCache];
|
||||||
|
|
|
@ -96,7 +96,7 @@ static NSString *privateDir = nil;
|
||||||
- (id) initWithURL: (NSURL *) url
|
- (id) initWithURL: (NSURL *) url
|
||||||
andTableType: (uint8_t) tableType
|
andTableType: (uint8_t) tableType
|
||||||
{
|
{
|
||||||
NSString *path, *tableParticle;
|
NSString *path, *username, *tableParticle;
|
||||||
|
|
||||||
if ((self = [self init]))
|
if ((self = [self init]))
|
||||||
{
|
{
|
||||||
|
@ -116,9 +116,11 @@ static NSString *privateDir = nil;
|
||||||
path = [url path];
|
path = [url path];
|
||||||
if (![path hasSuffix: @"/"])
|
if (![path hasSuffix: @"/"])
|
||||||
path = [NSString stringWithFormat: @"%@/", path];
|
path = [NSString stringWithFormat: @"%@/", path];
|
||||||
|
username = [url user];
|
||||||
directory = [NSString stringWithFormat: @"%@/mapistore/SOGo/%@/%@/%@%@",
|
directory = [NSString stringWithFormat: @"%@/mapistore/SOGo/%@/%@/%@%@",
|
||||||
privateDir, [url user], tableParticle,
|
privateDir, username, tableParticle,
|
||||||
[url host], path];
|
[url host], path];
|
||||||
|
[self setOwner: username];
|
||||||
[self logWithFormat: @"directory: %@", directory];
|
[self logWithFormat: @"directory: %@", directory];
|
||||||
[directory retain];
|
[directory retain];
|
||||||
ASSIGN (nameInContainer, [path stringByDeletingLastPathComponent]);
|
ASSIGN (nameInContainer, [path stringByDeletingLastPathComponent]);
|
||||||
|
|
Loading…
Reference in a new issue