merge of '402d2e80afd5b6d503eb69f531d01bada65a2a51'

and '881d0e4a9a9117f8671dd4758b691044c07a1247'

Monotone-Parent: 402d2e80afd5b6d503eb69f531d01bada65a2a51
Monotone-Parent: 881d0e4a9a9117f8671dd4758b691044c07a1247
Monotone-Revision: 0314a56a186d909c3c83333916d6b43946976a9f

Monotone-Author: ludovic@Sophos.ca
Monotone-Date: 2012-01-27T15:22:57
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Ludovic Marcotte 2012-01-27 15:22:57 +00:00
commit d43a252031
35 changed files with 266 additions and 694 deletions

View file

@ -1,3 +1,31 @@
2012-01-26 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/MAPIStoreCommonViewsContext.[hm],
OpenChange/MAPIStoreDeferredActionsContext.[hm],
OpenChange/MAPIStoreFreebusyContext.[hm],
OpenChange/MAPIStoreJournalContext.[hm],
OpenChange/MAPIStoreRemindersContext.[hm],
OpenChange/MAPIStoreScheduleContext.[hm],
OpenChange/MAPIStoreSearchContext.[hm],
OpenChange/MAPIStoreShortcutsContext.[hm],
OpenChange/MAPIStoreSpoolerContext.[hm],
OpenChange/MAPIStoreViewsContext.[hm]: deleted obsolete classes.
* OpenChange/MAPIStoreFolder.m (supportsSubFolders): new
overridable method that returns whether the current folder can
contain subfolders, nowithstanding the right of the current user
to create or access them.
* OpenChange/MAPIStoreSOGo.m (sogo_backend_list_contexts): new
backend method.
* OpenChange/MAPIStoreContext.m
(+listAllContextsForUser:inMemCtx:): centralized method for
returning all contexts available from all context classes for one
user.
(+listContextsForUser:inMemCtx:): new individual method invoked by
the above. Overridden by concrete subclasses.
2012-01-26 Ludovic Marcotte <lmarcotte@inverse.ca>
* SoObjects/SOGo/LDAPSource.{h,m} - now honor

View file

@ -102,17 +102,7 @@ $(SOGOBACKEND)_OBJC_FILES += \
MAPIStoreNotesFolder.m \
MAPIStoreNotesMessage.m \
\
MAPIStoreCommonViewsContext.m \
MAPIStoreDeferredActionsContext.m \
MAPIStoreFallbackContext.m \
MAPIStoreFreebusyContext.m \
MAPIStoreJournalContext.m \
MAPIStoreRemindersContext.m \
MAPIStoreScheduleContext.m \
MAPIStoreSearchContext.m \
MAPIStoreShortcutsContext.m \
MAPIStoreSpoolerContext.m \
MAPIStoreViewsContext.m \
\
NSArray+MAPIStore.m \
NSData+MAPIStore.m \

View file

@ -27,6 +27,9 @@
#import "MAPIStoreCalendarContext.h"
#undef DEBUG
#include <mapistore/mapistore.h>
@implementation MAPIStoreCalendarContext
+ (NSString *) MAPIModuleName
@ -34,6 +37,23 @@
return @"calendar";
}
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
inMemCtx: (TALLOC_CTX *) memCtx
{
struct mapistore_contexts_list *context;
context = talloc_zero(memCtx, struct mapistore_contexts_list);
context->url = talloc_asprintf (context, "sogo://%s@calendar/",
[userName UTF8String]);
// context->name = "Agenda personnel";
context->main_folder = true;
context->role = MAPISTORE_CALENDAR_ROLE;
context->tag = "tag";
context->prev = context;
return context;
}
- (void) setupBaseFolder: (NSURL *) newURL
{
baseFolder = [MAPIStoreCalendarFolder baseFolderWithURL: newURL

View file

@ -1,32 +0,0 @@
/* MAPIStoreCommonViewsContext.h - this file is part of SOGo
*
* Copyright (C) 2010 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef MAPISTORECOMMONVIEWSCONTEXT_H
#define MAPISTORECOMMONVIEWSCONTEXT_H
#import "MAPIStoreFSBaseContext.h"
@interface MAPIStoreCommonViewsContext : MAPIStoreFSBaseContext
@end
#endif /* MAPISTORECOMMONVIEWSCONTEXT_H */

View file

@ -1,34 +0,0 @@
/* MAPIStoreCommonViewsContext.m - this file is part of SOGo
*
* Copyright (C) 2010 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#import <Foundation/NSString.h>
#import "MAPIStoreCommonViewsContext.h"
@implementation MAPIStoreCommonViewsContext
+ (NSString *) MAPIModuleName
{
return @"common-views";
}
@end

View file

@ -27,6 +27,9 @@
#import "MAPIStoreContactsContext.h"
#undef DEBUG
#include <mapistore/mapistore.h>
@implementation MAPIStoreContactsContext
+ (NSString *) MAPIModuleName
@ -34,6 +37,23 @@
return @"contacts";
}
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
inMemCtx: (TALLOC_CTX *) memCtx
{
struct mapistore_contexts_list *context;
context = talloc_zero(memCtx, struct mapistore_contexts_list);
context->url = talloc_asprintf (context, "sogo://%s@contacts/",
[userName UTF8String]);
// context->name = "Carnet d'adresses personnel";
context->main_folder = true;
context->role = MAPISTORE_CONTACTS_ROLE;
context->tag = "tag";
context->prev = context;
return context;
}
- (void) setupBaseFolder: (NSURL *) newURL
{
baseFolder = [MAPIStoreContactsFolder baseFolderWithURL: newURL

View file

@ -69,6 +69,11 @@
MAPIStoreFolder *baseFolder;
}
+ (struct mapistore_contexts_list *) listAllContextsForUser: (NSString *) userName
inMemCtx: (TALLOC_CTX *) memCtx;
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
inMemCtx: (TALLOC_CTX *) memCtx;
+ (int) openContext: (MAPIStoreContext **) contextPtr
withURI: (const char *) newUri
connectionInfo: (struct mapistore_connection_info *) newConnInfo

View file

@ -101,6 +101,40 @@ static NSMutableDictionary *contextClassMapping;
}
}
+ (struct mapistore_contexts_list *) listAllContextsForUser: (NSString *) userName
inMemCtx: (TALLOC_CTX *) memCtx
{
struct mapistore_contexts_list *list, *current;
NSArray *classes;
Class currentClass;
NSUInteger count, max;
list = NULL;
classes = GSObjCAllSubclassesOfClass (self);
max = [classes count];
for (count = 0; count < max; count++)
{
currentClass = [classes objectAtIndex: count];
current = [currentClass listContextsForUser: userName
inMemCtx: memCtx];
if (current)
{
[self logWithFormat: @"adding list: %p", current];
DLIST_CONCATENATE(list, current, void);
}
}
return list;
}
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
inMemCtx: (TALLOC_CTX *) memCtx
{
return NULL;
}
static inline enum mapistore_error
_prepareContextClass (Class contextClass,
struct mapistore_connection_info *connInfo,

View file

@ -1,32 +0,0 @@
/* MAPIStoreDeferredActionsContext.h - this file is part of SOGo
*
* Copyright (C) 2010 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef MAPISTOREDEFERREDACTIONSCONTEXT_H
#define MAPISTOREDEFERREDACTIONSCONTEXT_H
#import "MAPIStoreFSBaseContext.h"
@interface MAPIStoreDeferredActionsContext : MAPIStoreFSBaseContext
@end
#endif /* MAPISTOREDEFERREDACTIONSCONTEXT_H */

View file

@ -1,36 +0,0 @@
/* MAPIStoreDeferredActionsContext.m - this file is part of SOGo
*
* Copyright (C) 2010 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#import <Foundation/NSString.h>
#import "MAPIStoreMapping.h"
#import "MAPIStoreDeferredActionsContext.h"
@implementation MAPIStoreDeferredActionsContext
+ (NSString *) MAPIModuleName
{
return @"deferred-actions";
}
@end

View file

@ -295,4 +295,9 @@ static NSString *MAPIStoreRightFolderContact = @"RightsFolderContact";
return [self _testRoleForActiveUser: MAPIStoreRightCreateSubfolders];
}
- (BOOL) supportsSubFolders
{
return YES;
}
@end

View file

@ -26,6 +26,9 @@
#import "MAPIStoreFallbackContext.h"
#undef DEBUG
#include <mapistore/mapistore.h>
@implementation MAPIStoreFallbackContext
+ (NSString *) MAPIModuleName
@ -33,6 +36,23 @@
return @"fallback";
}
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
inMemCtx: (TALLOC_CTX *) memCtx
{
struct mapistore_contexts_list *context;
context = talloc_zero(memCtx, struct mapistore_contexts_list);
context->url = talloc_asprintf (context, "sogo://%s@fallback/",
[userName UTF8String]);
context->name = "Fallback";
context->main_folder = true;
context->role = MAPISTORE_FALLBACK_ROLE;
context->tag = "tag";
context->prev = context;
return context;
}
- (void) setupBaseFolder: (NSURL *) newURL
{
baseFolder = [MAPIStoreFSFolder baseFolderWithURL: newURL inContext: self];

View file

@ -165,6 +165,8 @@
- (BOOL) subscriberCanDeleteMessages;
- (BOOL) subscriberCanCreateSubFolders;
- (BOOL) supportsSubFolders; /* capability */
/* subclass helpers */
- (void) postNotificationsForMoveCopyMessagesWithMIDs: (uint64_t *) srcMids
andMessageURLs: (NSArray *) oldMessageURLs

View file

@ -1141,7 +1141,8 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
access |= 0x02;
if (userIsOwner || [self subscriberCanDeleteMessages])
access |= 0x04;
if (userIsOwner || [self subscriberCanCreateSubFolders])
if ((userIsOwner || [self subscriberCanCreateSubFolders])
&& [self supportsSubFolders])
access |= 0x08;
if (userIsOwner || [self subscriberCanCreateMessages])
access |= 0x10;
@ -1595,4 +1596,9 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
return NO;
}
- (BOOL) supportsSubFolders
{
return NO;
}
@end

View file

@ -1,32 +0,0 @@
/* MAPIStoreFreebusyContext.h - this file is part of SOGo
*
* Copyright (C) 2010 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef MAPISTOREFREEBUSYCONTEXT_H
#define MAPISTOREFREEBUSYCONTEXT_H
#import "MAPIStoreFSBaseContext.h"
@interface MAPIStoreFreebusyContext : MAPIStoreFSBaseContext
@end
#endif /* MAPISTOREFREEBUSYCONTEXT_H */

View file

@ -1,40 +0,0 @@
/* MAPIStoreFreebusyContext.m - this file is part of SOGo
*
* Copyright (C) 2010 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#import <NGObjWeb/WOContext+SoObjects.h>
#import <SOGo/SOGoUserFolder.h>
#import "MAPIApplication.h"
#import "MAPIStoreAuthenticator.h"
#import "MAPIStoreMapping.h"
#import "MAPIStoreFreebusyContext.h"
@implementation MAPIStoreFreebusyContext
+ (NSString *) MAPIModuleName
{
return @"freebusy";
}
@end

View file

@ -1,32 +0,0 @@
/* MAPIStoreJournalContext.h - this file is part of SOGo
*
* Copyright (C) 2010 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef MAPISTOREJOURNALCONTEXT_H
#define MAPISTOREJOURNALCONTEXT_H
#import "MAPIStoreFSBaseContext.h"
@interface MAPIStoreJournalContext : MAPIStoreFSBaseContext
@end
#endif /* MAPISTOREJOURNALCONTEXT_H */

View file

@ -1,36 +0,0 @@
/* MAPIStoreJournalContext.m - this file is part of SOGo
*
* Copyright (C) 2010 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#import <Foundation/NSString.h>
#import "MAPIStoreMapping.h"
#import "MAPIStoreJournalContext.h"
@implementation MAPIStoreJournalContext
+ (NSString *) MAPIModuleName
{
return @"journal";
}
@end

View file

@ -24,9 +24,13 @@
#import "MAPIStoreMailFolder.h"
#import "MAPIStoreMapping.h"
#import "NSString+MAPIStore.h"
#import "MAPIStoreMailContext.h"
#undef DEBUG
#include <mapistore/mapistore.h>
@implementation MAPIStoreMailContext
+ (NSString *) MAPIModuleName
@ -34,6 +38,11 @@
return nil;
}
+ (enum mapistore_context_role) contextRole
{
return MAPISTORE_MAIL_ROLE;
}
@end
@implementation MAPIStoreInboxContext
@ -43,6 +52,24 @@
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
@ -59,6 +86,11 @@
return @"sent-items";
}
+ (enum mapistore_context_role) contextRole
{
return MAPISTORE_SENTITEMS_ROLE;
}
- (void) setupBaseFolder: (NSURL *) newURL
{
baseFolder = [MAPIStoreSentItemsFolder baseFolderWithURL: newURL
@ -75,6 +107,11 @@
return @"drafts";
}
+ (enum mapistore_context_role) contextRole
{
return MAPISTORE_DRAFTS_ROLE;
}
- (void) setupBaseFolder: (NSURL *) newURL
{
baseFolder = [MAPIStoreDraftsFolder baseFolderWithURL: newURL
@ -93,6 +130,11 @@
return @"deleted-items";
}
+ (enum mapistore_context_role) contextRole
{
return MAPISTORE_DELETEDITEMS_ROLE;
}
- (void) setupBaseFolder: (NSURL *) newURL
{
baseFolder = [MAPIStoreFSFolder baseFolderWithURL: newURL inContext: self];
@ -115,6 +157,11 @@
return @"outbox";
}
+ (enum mapistore_context_role) contextRole
{
return MAPISTORE_OUTBOX_ROLE;
}
- (void) setupBaseFolder: (NSURL *) newURL
{
baseFolder = [MAPIStoreOutboxFolder baseFolderWithURL: newURL

View file

@ -1179,6 +1179,11 @@ _parseCOPYUID (NSString *line, NSArray **destUIDsP)
return childFolder;
}
- (BOOL) supportsSubFolders
{
return !usesAltNameSpace;
}
@end
@implementation MAPIStoreSentItemsFolder : MAPIStoreMailFolder

View file

@ -27,6 +27,9 @@
#import "MAPIStoreNotesContext.h"
#undef DEBUG
#include <mapistore/mapistore.h>
@implementation MAPIStoreNotesContext
+ (NSString *) MAPIModuleName
@ -34,6 +37,23 @@
return @"notes";
}
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
inMemCtx: (TALLOC_CTX *) memCtx
{
struct mapistore_contexts_list *context;
context = talloc_zero(memCtx, struct mapistore_contexts_list);
context->url = talloc_asprintf (context, "sogo://%s@notes/",
[userName UTF8String]);
// context->name = "Notes personnelles";
context->main_folder = true;
context->role = MAPISTORE_NOTES_ROLE;
context->tag = "tag";
context->prev = context;
return context;
}
- (void) setupBaseFolder: (NSURL *) newURL
{
baseFolder = [MAPIStoreNotesFolder baseFolderWithURL: newURL

View file

@ -1,32 +0,0 @@
/* MAPIStoreRemindersContext.h - this file is part of SOGo
*
* Copyright (C) 2010 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef MAPISTOREREMINDERSCONTEXT_H
#define MAPISTOREREMINDERSCONTEXT_H
#import "MAPIStoreFSBaseContext.h"
@interface MAPIStoreRemindersContext : MAPIStoreFSBaseContext
@end
#endif /* MAPISTOREREMINDERSCONTEXT_H */

View file

@ -1,36 +0,0 @@
/* MAPIStoreRemindersContext.m - this file is part of SOGo
*
* Copyright (C) 2010 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#import <Foundation/NSString.h>
#import "MAPIStoreMapping.h"
#import "MAPIStoreRemindersContext.h"
@implementation MAPIStoreRemindersContext
+ (NSString *) MAPIModuleName
{
return @"reminders";
}
@end

View file

@ -46,6 +46,8 @@
#include <mapistore/mapistore.h>
#include <mapistore/mapistore_errors.h>
static Class MAPIStoreContextK = Nil;
static enum mapistore_error
sogo_backend_unexpected_error()
{
@ -81,7 +83,7 @@ sogo_backend_init (void)
[SOGoSystemDefaults sharedSystemDefaults];
// /* We force the plugin to base its configuration on the SOGo tree. */
/* We force the plugin to base its configuration on the SOGo tree. */
ud = [NSUserDefaults standardUserDefaults];
[ud registerDefaults: [ud persistentDomainForName: @"sogod"]];
@ -98,6 +100,8 @@ sogo_backend_init (void)
[[SOGoCache sharedCache] disableRequestsCache];
[[SOGoCache sharedCache] disableLocalCache];
MAPIStoreContextK = NSClassFromString (@"MAPIStoreContext");
[pool release];
return MAPISTORE_SUCCESS;
@ -118,7 +122,6 @@ sogo_backend_create_context(TALLOC_CTX *mem_ctx,
const char *uri, void **context_object)
{
NSAutoreleasePool *pool;
Class MAPIStoreContextK;
MAPIStoreContext *context;
int rc;
@ -126,7 +129,6 @@ sogo_backend_create_context(TALLOC_CTX *mem_ctx,
pool = [NSAutoreleasePool new];
MAPIStoreContextK = NSClassFromString (@"MAPIStoreContext");
if (MAPIStoreContextK)
{
rc = [MAPIStoreContextK openContext: &context
@ -144,6 +146,33 @@ sogo_backend_create_context(TALLOC_CTX *mem_ctx,
return rc;
}
static enum mapistore_error
sogo_backend_list_contexts(const char *username, TALLOC_CTX *mem_ctx,
struct mapistore_contexts_list **contexts_listp)
{
NSAutoreleasePool *pool;
NSString *userName;
int rc;
DEBUG(0, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
pool = [NSAutoreleasePool new];
if (MAPIStoreContextK)
{
userName = [NSString stringWithUTF8String: username];
*contexts_listp = [MAPIStoreContextK listAllContextsForUser: userName
inMemCtx: mem_ctx];
rc = MAPISTORE_SUCCESS;
}
else
rc = MAPISTORE_ERROR;
[pool release];
return rc;
}
// andFID: fid
// uint64_t fid,
// void **private_data)
@ -1207,6 +1236,7 @@ int mapistore_init_backend(void)
backend.backend.namespace = "sogo://";
backend.backend.init = sogo_backend_init;
backend.backend.create_context = sogo_backend_create_context;
backend.backend.list_contexts = sogo_backend_list_contexts;
backend.context.get_path = sogo_context_get_path;
backend.context.get_root_folder = sogo_context_get_root_folder;
backend.folder.open_folder = sogo_folder_open_folder;

View file

@ -1,32 +0,0 @@
/* MAPIStoreScheduleContext.h - this file is part of SOGo
*
* Copyright (C) 2010 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef MAPISTORESCHEDULECONTEXT_H
#define MAPISTORESCHEDULECONTEXT_H
#import "MAPIStoreFSBaseContext.h"
@interface MAPIStoreScheduleContext : MAPIStoreFSBaseContext
@end
#endif /* MAPISTORESCHEDULECONTEXT_H */

View file

@ -1,36 +0,0 @@
/* MAPIStoreScheduleContext.m - this file is part of SOGo
*
* Copyright (C) 2010 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#import <Foundation/NSString.h>
#import "MAPIStoreMapping.h"
#import "MAPIStoreScheduleContext.h"
@implementation MAPIStoreScheduleContext
+ (NSString *) MAPIModuleName
{
return @"schedule";
}
@end

View file

@ -1,32 +0,0 @@
/* MAPIStoreSearchContext.h - this file is part of SOGo
*
* Copyright (C) 2010 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef MAPISTORESEARCHCONTEXT_H
#define MAPISTORESEARCHCONTEXT_H
#import "MAPIStoreFSBaseContext.h"
@interface MAPIStoreSearchContext : MAPIStoreFSBaseContext
@end
#endif /* MAPISTORESEARCHCONTEXT_H */

View file

@ -1,36 +0,0 @@
/* MAPIStoreSearchContext.m - this file is part of SOGo
*
* Copyright (C) 2010 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#import <Foundation/NSString.h>
#import "MAPIStoreMapping.h"
#import "MAPIStoreSearchContext.h"
@implementation MAPIStoreSearchContext
+ (NSString *) MAPIModuleName
{
return @"search";
}
@end

View file

@ -1,32 +0,0 @@
/* MAPIStoreShortcutsContext.h - this file is part of SOGo
*
* Copyright (C) 2010 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef MAPISTORESHORTCUTSCONTEXT_H
#define MAPISTORESHORTCUTSCONTEXT_H
#import "MAPIStoreFSBaseContext.h"
@interface MAPIStoreShortcutsContext : MAPIStoreFSBaseContext
@end
#endif /* MAPISTORESHORTCUTSCONTEXT_H */

View file

@ -1,36 +0,0 @@
/* MAPIStoreShortcutsContext.m - this file is part of SOGo
*
* Copyright (C) 2010 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#import <Foundation/NSString.h>
#import "MAPIStoreMapping.h"
#import "MAPIStoreShortcutsContext.h"
@implementation MAPIStoreShortcutsContext
+ (NSString *) MAPIModuleName
{
return @"shortcuts";
}
@end

View file

@ -1,32 +0,0 @@
/* MAPIStoreSpoolerContext.h - this file is part of SOGo
*
* Copyright (C) 2011 Inverse inc
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef MAPISTORESPOOLERCONTEXT_H
#define MAPISTORESPOOLERCONTEXT_H
#import "MAPIStoreFSBaseContext.h"
@interface MAPIStoreSpoolerContext : MAPIStoreFSBaseContext
@end
#endif /* MAPISTORESPOOLERCONTEXT_H */

View file

@ -1,34 +0,0 @@
/* MAPIStoreSpoolerContext.m - this file is part of SOGo
*
* Copyright (C) 2011 Inverse inc
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#import <Foundation/NSString.h>
#import "MAPIStoreSpoolerContext.h"
@implementation MAPIStoreSpoolerContext
+ (NSString *) MAPIModuleName
{
return @"spooler-queue";
}
@end

View file

@ -27,6 +27,9 @@
#import "MAPIStoreTasksContext.h"
#undef DEBUG
#include <mapistore/mapistore.h>
@implementation MAPIStoreTasksContext
+ (NSString *) MAPIModuleName
@ -34,6 +37,23 @@
return @"tasks";
}
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
inMemCtx: (TALLOC_CTX *) memCtx
{
struct mapistore_contexts_list *context;
context = talloc_zero(memCtx, struct mapistore_contexts_list);
context->url = talloc_asprintf (context, "sogo://%s@tasks/",
[userName UTF8String]);
// context->name = "Tâches personnelles";
context->main_folder = true;
context->role = MAPISTORE_TASKS_ROLE;
context->tag = "tag";
context->prev = context;
return context;
}
- (void) setupBaseFolder: (NSURL *) newURL
{
baseFolder = [MAPIStoreTasksFolder baseFolderWithURL: newURL

View file

@ -1,32 +0,0 @@
/* MAPIStoreViewsContext.h - this file is part of SOGo
*
* Copyright (C) 2010 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef MAPISTOREVIEWSCONTEXT_H
#define MAPISTOREVIEWSCONTEXT_H
#import "MAPIStoreFSBaseContext.h"
@interface MAPIStoreViewsContext : MAPIStoreFSBaseContext
@end
#endif /* MAPISTOREVIEWSCONTEXT_H */

View file

@ -1,36 +0,0 @@
/* MAPIStoreViewsContext.m - this file is part of SOGo
*
* Copyright (C) 2010 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#import <Foundation/NSString.h>
#import "MAPIStoreMapping.h"
#import "MAPIStoreViewsContext.h"
@implementation MAPIStoreViewsContext
+ (NSString *) MAPIModuleName
{
return @"views";
}
@end