mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-26 05:45:24 +00:00
Monotone-Parent: 33c27aebfdbf4c4a04a550aef20cd2049b1c4575
Monotone-Revision: fffc8593a1392a49172e584c88de206cd6d7081b Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-12-13T17:06:22 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -23,9 +23,9 @@
|
||||
#ifndef MAPISTORECALENDARCONTEXT_H
|
||||
#define MAPISTORECALENDARCONTEXT_H
|
||||
|
||||
#import "MAPIStoreContext.h"
|
||||
#import "MAPIStoreGCSBaseContext.h"
|
||||
|
||||
@interface MAPIStoreCalendarContext : MAPIStoreContext
|
||||
@interface MAPIStoreCalendarContext : MAPIStoreGCSBaseContext
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
|
||||
#import <EOControl/EOQualifier.h>
|
||||
|
||||
#import <NGCards/iCalEvent.h>
|
||||
#import <Appointments/SOGoAppointmentObject.h>
|
||||
|
||||
@@ -51,7 +53,7 @@
|
||||
|
||||
+ (void) registerFixedMappings: (MAPIStoreMapping *) mapping
|
||||
{
|
||||
[mapping registerURL: @"sogo://openchange:openchange@calendar/personal"
|
||||
[mapping registerURL: @"sogo://openchange:openchange@calendar/personal/"
|
||||
withID: 0x190001];
|
||||
}
|
||||
|
||||
@@ -71,8 +73,29 @@
|
||||
}
|
||||
|
||||
- (NSArray *) getFolderMessageKeys: (SOGoFolder *) folder
|
||||
matchingQualifier: (EOQualifier *) qualifier
|
||||
{
|
||||
return [(SOGoGCSFolder *) folder componentKeysWithType: @"vevent"];
|
||||
EOQualifier *componentQualifier, *calendarQualifier;
|
||||
|
||||
componentQualifier
|
||||
= [[EOKeyValueQualifier alloc] initWithKey: @"c_component"
|
||||
operatorSelector: EOQualifierOperatorEqual
|
||||
value: @"vevent"];
|
||||
[componentQualifier autorelease];
|
||||
if (qualifier)
|
||||
{
|
||||
calendarQualifier = [[EOAndQualifier alloc]
|
||||
initWithQualifiers:
|
||||
componentQualifier,
|
||||
qualifier,
|
||||
nil];
|
||||
[calendarQualifier autorelease];
|
||||
}
|
||||
else
|
||||
calendarQualifier = componentQualifier;
|
||||
|
||||
return [super getFolderMessageKeys: folder
|
||||
matchingQualifier: calendarQualifier];
|
||||
}
|
||||
|
||||
- (enum MAPISTATUS) getMessageTableChildproperty: (void **) data
|
||||
@@ -203,6 +226,28 @@
|
||||
// return rc;
|
||||
// }
|
||||
|
||||
- (MAPIRestrictionState) evaluatePropertyRestriction: (struct mapi_SPropertyRestriction *) res
|
||||
intoQualifier: (EOQualifier **) qualifier
|
||||
{
|
||||
MAPIRestrictionState rc;
|
||||
id value;
|
||||
|
||||
value = NSObjectFromMAPISPropValue (&res->lpProp);
|
||||
switch (res->ulPropTag)
|
||||
{
|
||||
case PR_MESSAGE_CLASS_UNICODE:
|
||||
if ([value isEqualToString: @"IPM.Appointment"])
|
||||
rc = MAPIRestrictionStateAlwaysTrue;
|
||||
else
|
||||
rc = MAPIRestrictionStateAlwaysFalse;
|
||||
break;
|
||||
default:
|
||||
rc = [super evaluatePropertyRestriction: res intoQualifier: qualifier];
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (NSString *) backendIdentifierForProperty: (enum MAPITAGS) property
|
||||
{
|
||||
static NSMutableDictionary *knownProperties = nil;
|
||||
@@ -212,7 +257,7 @@
|
||||
knownProperties = [NSMutableDictionary new];
|
||||
}
|
||||
|
||||
return [knownProperties objectForKey: MAPIPropertyNumber (property)];
|
||||
return [knownProperties objectForKey: MAPIPropertyKey (property)];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
#ifndef MAPISTORECONTACTSCONTEXT_H
|
||||
#define MAPISTORECONTACTSCONTEXT_H
|
||||
|
||||
#import "MAPIStoreContext.h"
|
||||
#import "MAPIStoreGCSBaseContext.h"
|
||||
|
||||
@interface MAPIStoreContactsContext : MAPIStoreContext
|
||||
@interface MAPIStoreContactsContext : MAPIStoreGCSBaseContext
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
|
||||
#import <EOControl/EOQualifier.h>
|
||||
|
||||
#import <NGCards/NGVCard.h>
|
||||
#import <NGCards/NSArray+NGCards.h>
|
||||
|
||||
@@ -52,7 +54,7 @@
|
||||
|
||||
+ (void) registerFixedMappings: (MAPIStoreMapping *) mapping
|
||||
{
|
||||
[mapping registerURL: @"sogo://openchange:openchange@contacts/personal"
|
||||
[mapping registerURL: @"sogo://openchange:openchange@contacts/personal/"
|
||||
withID: 0x1a0001];
|
||||
}
|
||||
|
||||
@@ -71,9 +73,32 @@
|
||||
[moduleFolder retain];
|
||||
}
|
||||
|
||||
|
||||
- (NSArray *) getFolderMessageKeys: (SOGoFolder *) folder
|
||||
matchingQualifier: (EOQualifier *) qualifier
|
||||
{
|
||||
return [(SOGoGCSFolder *) folder componentKeysWithType: @"vcard"];
|
||||
EOQualifier *componentQualifier, *contactsQualifier;
|
||||
|
||||
/* TODO: we need to support vlist as well */
|
||||
componentQualifier
|
||||
= [[EOKeyValueQualifier alloc] initWithKey: @"c_component"
|
||||
operatorSelector: EOQualifierOperatorEqual
|
||||
value: @"vcard"];
|
||||
[componentQualifier autorelease];
|
||||
if (qualifier)
|
||||
{
|
||||
contactsQualifier = [[EOAndQualifier alloc]
|
||||
initWithQualifiers:
|
||||
componentQualifier,
|
||||
qualifier,
|
||||
nil];
|
||||
[contactsQualifier autorelease];
|
||||
}
|
||||
else
|
||||
contactsQualifier = componentQualifier;
|
||||
|
||||
return [super getFolderMessageKeys: folder
|
||||
matchingQualifier: contactsQualifier];
|
||||
}
|
||||
|
||||
// - (enum MAPISTATUS) getCommonTableChildproperty: (void **) data
|
||||
@@ -328,16 +353,16 @@
|
||||
{
|
||||
knownProperties = [NSMutableDictionary new];
|
||||
[knownProperties setObject: @"c_mail"
|
||||
forKey: MAPIPropertyNumber (0x81ae001f)];
|
||||
forKey: MAPIPropertyKey (0x81ae001f)];
|
||||
[knownProperties setObject: @"c_mail"
|
||||
forKey: MAPIPropertyNumber (0x81b3001f)];
|
||||
forKey: MAPIPropertyKey (0x81b3001f)];
|
||||
[knownProperties setObject: @"c_mail"
|
||||
forKey: MAPIPropertyNumber (PR_EMS_AB_GROUP_BY_ATTR_2_UNICODE)];
|
||||
forKey: MAPIPropertyKey (PR_EMS_AB_GROUP_BY_ATTR_2_UNICODE)];
|
||||
[knownProperties setObject: @"c_cn"
|
||||
forKey: MAPIPropertyNumber (PR_DISPLAY_NAME_UNICODE)];
|
||||
forKey: MAPIPropertyKey (PR_DISPLAY_NAME_UNICODE)];
|
||||
}
|
||||
|
||||
return [knownProperties objectForKey: MAPIPropertyNumber (property)];
|
||||
return [knownProperties objectForKey: MAPIPropertyKey (property)];
|
||||
}
|
||||
|
||||
/* restrictions */
|
||||
@@ -352,8 +377,7 @@
|
||||
switch (res->ulPropTag)
|
||||
{
|
||||
case PR_MESSAGE_CLASS_UNICODE:
|
||||
if ([value isKindOfClass: [NSString class]]
|
||||
&& [value isEqualToString: @"IPM.Contact"])
|
||||
if ([value isEqualToString: @"IPM.Contact"])
|
||||
rc = MAPIRestrictionStateAlwaysTrue;
|
||||
else
|
||||
rc = MAPIRestrictionStateAlwaysFalse;
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/* MAPIStoreGCSBaseContext.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 MAPISTOREGCSBASECONTEXT_H
|
||||
#define MAPISTOREGCSBASECONTEXT_H
|
||||
|
||||
#import "MAPIStoreContext.h"
|
||||
|
||||
@interface MAPIStoreGCSBaseContext : MAPIStoreContext
|
||||
@end
|
||||
|
||||
#endif /* MAPISTOREGCSBASECONTEXT_H */
|
||||
@@ -0,0 +1,60 @@
|
||||
/* MAPIStoreGCSBaseContext.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/NSArray.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSValue.h>
|
||||
|
||||
#import <EOControl/EOQualifier.h>
|
||||
|
||||
#import <GDLContentStore/GCSFolder.h>
|
||||
|
||||
#import <SOGo/NSArray+Utilities.h>
|
||||
#import <SOGo/SOGoGCSFolder.h>
|
||||
|
||||
#import "MAPIStoreGCSBaseContext.h"
|
||||
|
||||
@implementation MAPIStoreGCSBaseContext
|
||||
|
||||
+ (NSString *) MAPIModuleName
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSArray *) getFolderMessageKeys: (SOGoFolder *) folder
|
||||
matchingQualifier: (EOQualifier *) qualifier
|
||||
{
|
||||
NSArray *records;
|
||||
static NSArray *fields = nil;
|
||||
|
||||
if (!fields)
|
||||
fields = [[NSArray alloc]
|
||||
initWithObjects: @"c_name", @"c_version", nil];
|
||||
|
||||
records = [[(SOGoGCSFolder *) folder ocsFolder]
|
||||
fetchFields: fields matchingQualifier: qualifier];
|
||||
|
||||
return [records objectsForKey: @"c_name"
|
||||
notFoundMarker: nil];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -23,9 +23,9 @@
|
||||
#ifndef MAPISTORETASKSCONTEXT_H
|
||||
#define MAPISTORETASKSCONTEXT_H
|
||||
|
||||
#import "MAPIStoreContext.h"
|
||||
#import "MAPIStoreGCSBaseContext.h"
|
||||
|
||||
@interface MAPIStoreTasksContext : MAPIStoreContext
|
||||
@interface MAPIStoreTasksContext : MAPIStoreGCSBaseContext
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
|
||||
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||
|
||||
#import <EOControl/EOQualifier.h>
|
||||
|
||||
#import <NGCards/iCalToDo.h>
|
||||
#import <Appointments/SOGoTaskObject.h>
|
||||
|
||||
@@ -49,7 +51,7 @@
|
||||
|
||||
+ (void) registerFixedMappings: (MAPIStoreMapping *) mapping
|
||||
{
|
||||
[mapping registerURL: @"sogo://openchange:openchange@tasks/personal"
|
||||
[mapping registerURL: @"sogo://openchange:openchange@tasks/personal/"
|
||||
withID: 0x1d0001];
|
||||
}
|
||||
|
||||
@@ -69,8 +71,29 @@
|
||||
}
|
||||
|
||||
- (NSArray *) getFolderMessageKeys: (SOGoFolder *) folder
|
||||
matchingQualifier: (EOQualifier *) qualifier
|
||||
{
|
||||
return [(SOGoGCSFolder *) folder componentKeysWithType: @"vtodo"];
|
||||
EOQualifier *componentQualifier, *tasksQualifier;
|
||||
|
||||
componentQualifier
|
||||
= [[EOKeyValueQualifier alloc] initWithKey: @"c_component"
|
||||
operatorSelector: EOQualifierOperatorEqual
|
||||
value: @"vtodo"];
|
||||
[componentQualifier autorelease];
|
||||
if (qualifier)
|
||||
{
|
||||
tasksQualifier = [[EOAndQualifier alloc]
|
||||
initWithQualifiers:
|
||||
componentQualifier,
|
||||
qualifier,
|
||||
nil];
|
||||
[tasksQualifier autorelease];
|
||||
}
|
||||
else
|
||||
tasksQualifier = componentQualifier;
|
||||
|
||||
return [super getFolderMessageKeys: folder
|
||||
matchingQualifier: tasksQualifier];
|
||||
}
|
||||
|
||||
- (enum MAPISTATUS) getMessageTableChildproperty: (void **) data
|
||||
@@ -187,7 +210,7 @@
|
||||
knownProperties = [NSMutableDictionary new];
|
||||
}
|
||||
|
||||
return [knownProperties objectForKey: MAPIPropertyNumber (property)];
|
||||
return [knownProperties objectForKey: MAPIPropertyKey (property)];
|
||||
}
|
||||
|
||||
/* restrictions */
|
||||
@@ -208,6 +231,12 @@
|
||||
else
|
||||
rc = MAPIRestrictionStateAlwaysFalse;
|
||||
break;
|
||||
case PR_RULE_PROVIDER_UNICODE: // TODO: what's this?
|
||||
rc = MAPIRestrictionStateAlwaysTrue;
|
||||
break;
|
||||
case 0x81200003: // seems to be PR_CE_CHECK_INTERVAL
|
||||
rc = MAPIRestrictionStateAlwaysTrue;
|
||||
break;
|
||||
|
||||
default:
|
||||
rc = [super evaluatePropertyRestriction: res intoQualifier: qualifier];
|
||||
|
||||
Reference in New Issue
Block a user