2010-10-01 20:54:30 +02:00
|
|
|
/* MAPIStoreCalendarContext.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
|
2010-10-18 14:57:31 +02:00
|
|
|
* the Free Software Foundation; either version 3, or (at your option)
|
2010-10-01 20:54:30 +02:00
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2010-12-03 23:31:56 +01:00
|
|
|
#import <Foundation/NSDictionary.h>
|
|
|
|
|
2010-10-01 20:54:30 +02:00
|
|
|
#import <NGObjWeb/WOContext+SoObjects.h>
|
|
|
|
|
2010-10-05 15:50:03 +02:00
|
|
|
#import <NGExtensions/NSObject+Logs.h>
|
|
|
|
|
2010-12-30 15:32:51 +01:00
|
|
|
#import <Appointments/SOGoAppointmentFolder.h>
|
|
|
|
#import <Appointments/SOGoAppointmentFolders.h>
|
2010-10-01 20:54:30 +02:00
|
|
|
#import <Appointments/SOGoAppointmentObject.h>
|
|
|
|
|
|
|
|
#import "MAPIApplication.h"
|
|
|
|
#import "MAPIStoreAuthenticator.h"
|
2010-12-30 15:32:51 +01:00
|
|
|
#import "MAPIStoreCalendarMessageTable.h"
|
2010-11-22 17:03:30 +01:00
|
|
|
#import "MAPIStoreMapping.h"
|
2010-10-01 23:24:15 +02:00
|
|
|
#import "SOGoGCSFolder+MAPIStore.h"
|
2010-10-01 20:54:30 +02:00
|
|
|
|
|
|
|
#import "MAPIStoreCalendarContext.h"
|
|
|
|
|
|
|
|
#undef DEBUG
|
|
|
|
#include <mapistore/mapistore.h>
|
2010-12-30 15:32:51 +01:00
|
|
|
#include <mapistore/mapistore_nameid.h>
|
2010-10-01 20:54:30 +02:00
|
|
|
|
|
|
|
@implementation MAPIStoreCalendarContext
|
|
|
|
|
2010-11-22 22:32:11 +01:00
|
|
|
+ (NSString *) MAPIModuleName
|
|
|
|
{
|
|
|
|
return @"calendar";
|
|
|
|
}
|
|
|
|
|
2010-11-22 17:03:30 +01:00
|
|
|
+ (void) registerFixedMappings: (MAPIStoreMapping *) mapping
|
|
|
|
{
|
2010-12-30 15:32:51 +01:00
|
|
|
[mapping registerURL: @"sogo://openchange:openchange@calendar/"
|
2010-11-22 17:03:30 +01:00
|
|
|
withID: 0x190001];
|
|
|
|
}
|
|
|
|
|
2010-10-01 20:54:30 +02:00
|
|
|
- (void) setupModuleFolder
|
|
|
|
{
|
2010-12-30 15:32:51 +01:00
|
|
|
SOGoUserFolder *userFolder;
|
|
|
|
SOGoAppointmentFolders *parentFolder;
|
2010-10-01 20:54:30 +02:00
|
|
|
|
2010-11-18 23:25:38 +01:00
|
|
|
userFolder = [SOGoUserFolder objectWithName: [authenticator username]
|
|
|
|
inContainer: MAPIApp];
|
2010-12-01 17:34:41 +01:00
|
|
|
[parentFoldersBag addObject: userFolder];
|
2010-10-01 22:35:29 +02:00
|
|
|
[woContext setClientObject: userFolder];
|
2010-10-01 20:54:30 +02:00
|
|
|
|
2010-12-30 15:32:51 +01:00
|
|
|
parentFolder = [userFolder lookupName: @"Calendar"
|
|
|
|
inContext: woContext
|
|
|
|
acquire: NO];
|
|
|
|
[parentFoldersBag addObject: parentFolder];
|
|
|
|
[woContext setClientObject: parentFolder];
|
2010-10-01 22:35:29 +02:00
|
|
|
|
2010-12-30 15:32:51 +01:00
|
|
|
moduleFolder = [parentFolder lookupName: @"personal"
|
|
|
|
inContext: woContext
|
|
|
|
acquire: NO];
|
|
|
|
[moduleFolder retain];
|
2010-10-01 20:54:30 +02:00
|
|
|
}
|
|
|
|
|
2010-12-30 15:32:51 +01:00
|
|
|
- (id) createMessageOfClass: (NSString *) messageClass
|
|
|
|
inFolderAtURL: (NSString *) folderURL;
|
2010-11-19 22:11:01 +01:00
|
|
|
{
|
2010-12-30 15:32:51 +01:00
|
|
|
SOGoAppointmentFolder *parentFolder;
|
2010-11-19 22:11:01 +01:00
|
|
|
SOGoAppointmentObject *newEntry;
|
|
|
|
NSString *name;
|
|
|
|
|
2010-12-30 15:32:51 +01:00
|
|
|
parentFolder = [self lookupObject: folderURL];
|
2010-11-19 22:11:01 +01:00
|
|
|
name = [NSString stringWithFormat: @"%@.ics",
|
|
|
|
[SOGoObject globallyUniqueObjectId]];
|
|
|
|
newEntry = [SOGoAppointmentObject objectWithName: name
|
2010-12-30 15:32:51 +01:00
|
|
|
inContainer: parentFolder];
|
2010-11-19 22:11:01 +01:00
|
|
|
[newEntry setIsNew: YES];
|
|
|
|
|
|
|
|
return newEntry;
|
|
|
|
}
|
|
|
|
|
2010-12-30 15:32:51 +01:00
|
|
|
- (Class) messageTableClass
|
2010-12-13 18:06:22 +01:00
|
|
|
{
|
2010-12-30 15:32:51 +01:00
|
|
|
return [MAPIStoreCalendarMessageTable class];
|
2010-12-03 23:31:56 +01:00
|
|
|
}
|
|
|
|
|
2010-10-01 20:54:30 +02:00
|
|
|
@end
|