Monotone-Parent: b178183ad97d53d251135c909db06ab534f73a1f

Monotone-Revision: 2f0de4e385f44a298816cfffb2c3770058bdba02

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-10-01T21:31:58
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau 2010-10-01 21:31:58 +00:00
parent 0c742dd5ca
commit 6a615d1bce
6 changed files with 153 additions and 0 deletions

View file

@ -1,5 +1,8 @@
2010-10-01 Wolfgang Sourdeau <wsourdeau@inverse.ca> 2010-10-01 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/MAPIStoreTasksContext.[hm]: new mapi context class
for tasks.
* OpenChange/SOGoGCSFolder+MAPIStore.m (-componentKeysWithType:): * OpenChange/SOGoGCSFolder+MAPIStore.m (-componentKeysWithType:):
new method that return the keys of components corresponding to the new method that return the keys of components corresponding to the
type passed as parameter. type passed as parameter.

View file

@ -24,6 +24,7 @@ $(MAPISTORESOGO)_OBJC_FILES += \
MAPIStoreCalendarContext.m \ MAPIStoreCalendarContext.m \
MAPIStoreContactsContext.m \ MAPIStoreContactsContext.m \
MAPIStoreMailContext.m \ MAPIStoreMailContext.m \
MAPIStoreTasksContext.m \
\ \
SOGoGCSFolder+MAPIStore.m \ SOGoGCSFolder+MAPIStore.m \
\ \

View file

@ -116,6 +116,8 @@ static MAPIStoreMapping *mapping = nil;
contextClass = @"MAPIStoreContactsContext"; contextClass = @"MAPIStoreContactsContext";
else if ([module isEqualToString: @"calendar"]) else if ([module isEqualToString: @"calendar"])
contextClass = @"MAPIStoreCalendarContext"; contextClass = @"MAPIStoreCalendarContext";
else if ([module isEqualToString: @"tasks"])
contextClass = @"MAPIStoreTasksContext";
else else
{ {
NSLog (@"ERROR: unrecognized module name '%@'", module); NSLog (@"ERROR: unrecognized module name '%@'", module);

View file

@ -132,6 +132,13 @@ static uint64_t idCounter = 0x200001;
[self errorWithFormat: @"Unable to register root folder: %@", [self errorWithFormat: @"Unable to register root folder: %@",
urlString]; urlString];
} }
else if ([urlString isEqualToString: @"sogo://openchange:openchange@tasks/personal"])
{
idNbr = 0x1d0001;
if (![self registerURL: urlString withID: idNbr])
[self errorWithFormat: @"Unable to register root folder: %@",
urlString];
}
else else
{ {
idCounter += idIncrement; idCounter += idIncrement;

View file

@ -0,0 +1,32 @@
/* MAPIStoreTasksContext.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 2, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef MAPISTORETASKSCONTEXT_H
#define MAPISTORETASKSCONTEXT_H
#import "MAPIStoreContext.h"
@interface MAPIStoreTasksContext : MAPIStoreContext
@end
#endif /* MAPISTORETASKSCONTEXT_H */

View file

@ -0,0 +1,108 @@
/* 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 2, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#import <NGObjWeb/WOContext+SoObjects.h>
#import <NGCards/iCalToDo.h>
#import <Appointments/SOGoTaskObject.h>
#import "MAPIApplication.h"
#import "MAPIStoreAuthenticator.h"
#import "NSCalendarDate+MAPIStore.h"
#import "NSString+MAPIStore.h"
#import "SOGoGCSFolder+MAPIStore.h"
#import "MAPIStoreTasksContext.h"
#undef DEBUG
#include <mapistore/mapistore.h>
static Class SOGoUserFolderK;
@implementation MAPIStoreTasksContext
+ (void) initialize
{
SOGoUserFolderK = [SOGoUserFolder class];
}
- (void) setupModuleFolder
{
id userFolder;
userFolder = [SOGoUserFolderK objectWithName: [authenticator username]
inContainer: MAPIApp];
[woContext setClientObject: userFolder];
[userFolder retain]; // LEAK
moduleFolder = [userFolder lookupName: @"Calendar"
inContext: woContext
acquire: NO];
[moduleFolder retain];
}
- (NSArray *) getFolderMessageKeys: (SOGoFolder *) folder
{
return [(SOGoGCSFolder *) folder componentKeysWithType: @"vtodo"];
}
- (int) getMessageTableChildproperty: (void **) data
atURL: (NSString *) childURL
withTag: (uint32_t) proptag
inFolder: (SOGoFolder *) folder
withFID: (uint64_t) fid
{
uint32_t *longValue;
// uint8_t *boolValue;
// id child;
// id task;
int rc;
rc = MAPI_E_SUCCESS;
switch (proptag)
{
case PR_ICON_INDEX: // TODO
longValue = talloc_zero(memCtx, uint32_t);
*longValue = 0x00000500; /* see http://msdn.microsoft.com/en-us/library/cc815472.aspx */
// Unassigned recurring task 0x00000501
// Assignee's task 0x00000502
// Assigner's task 0x00000503
// Task request 0x00000504
// Task acceptance 0x00000505
// Task rejection 0x00000506
*data = longValue;
break;
case PR_MESSAGE_CLASS_UNICODE:
*data = talloc_strdup(memCtx, "IPM.Task");
break;
default:
rc = [super getMessageTableChildproperty: data
atURL: childURL
withTag: proptag
inFolder: folder
withFID: fid];
}
return rc;
}
@end