sogo/OpenChange/MAPIStoreTasksContext.m

108 lines
3.0 KiB
Matlab
Raw Normal View History

/* MAPIStoreTasksContext.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/NSDictionary.h>
#import <NGObjWeb/WOContext+SoObjects.h>
#import <EOControl/EOQualifier.h>
#import <NGCards/iCalToDo.h>
#import <Appointments/SOGoAppointmentFolder.h>
#import <Appointments/SOGoAppointmentFolders.h>
#import <Appointments/SOGoTaskObject.h>
#import "MAPIApplication.h"
#import "MAPIStoreAuthenticator.h"
#import "MAPIStoreMapping.h"
#import "MAPIStoreTasksMessageTable.h"
#import "MAPIStoreTypes.h"
#import "NSCalendarDate+MAPIStore.h"
#import "NSString+MAPIStore.h"
#import "SOGoGCSFolder+MAPIStore.h"
#import "MAPIStoreTasksContext.h"
#undef DEBUG
#include <gen_ndr/exchange.h>
#include <mapistore/mapistore.h>
#include <mapistore/mapistore_nameid.h>
@implementation MAPIStoreTasksContext
+ (NSString *) MAPIModuleName
{
return @"tasks";
}
+ (void) registerFixedMappings: (MAPIStoreMapping *) mapping
{
[mapping registerURL: @"sogo://openchange:openchange@tasks/"
withID: 0x1d0001];
}
- (void) setupModuleFolder
{
SOGoUserFolder *userFolder;
SOGoAppointmentFolders *parentFolder;
userFolder = [SOGoUserFolder objectWithName: [authenticator username]
inContainer: MAPIApp];
[parentFoldersBag addObject: userFolder];
[woContext setClientObject: userFolder];
parentFolder = [userFolder lookupName: @"Calendar"
inContext: woContext
acquire: NO];
[parentFoldersBag addObject: parentFolder];
[woContext setClientObject: parentFolder];
moduleFolder = [parentFolder lookupName: @"personal"
inContext: woContext
acquire: NO];
[moduleFolder retain];
}
- (Class) messageTableClass
{
return [MAPIStoreTasksMessageTable class];
}
- (id) createMessageOfClass: (NSString *) messageClass
inFolderAtURL: (NSString *) folderURL;
{
SOGoAppointmentFolder *parentFolder;
SOGoTaskObject *newEntry;
NSString *name;
parentFolder = [self lookupObject: folderURL];
name = [NSString stringWithFormat: @"%@.ics",
[SOGoObject globallyUniqueObjectId]];
newEntry = [SOGoTaskObject objectWithName: name
inContainer: parentFolder];
[newEntry setIsNew: YES];
return newEntry;
}
@end