Monotone-Parent: 59d160b60daebebf7589645c180056eb1cc90294

Monotone-Revision: 141ad1bae936fb5a1442f7b24d77771ed518e940

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-10-13T15:30:01
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2010-10-13 15:30:01 +00:00
parent 9660aeb84e
commit cfe04bb0c6
4 changed files with 73 additions and 52 deletions

View File

@ -1,3 +1,13 @@
2010-10-13 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/MAPIStoreMapping.m (-registerURL:): commented method out.
(-_setupFixedMapping): new method that registers well-known ids
with well-known urls.
* OpenChange/MAPIStoreContext.m (+contextFromURI:): no longer
register the URI mapping since the basic ones are always
registered.
2010-10-13 Francis Lachapelle <flachapelle@inverse.ca>
* UI/Scheduler/NSArray+Scheduler.h: added index constants for

View File

@ -160,7 +160,6 @@ static MAPIStoreMapping *mapping = nil;
if (contextClass)
{
[mapping registerURL: completeURLString];
context = [NSClassFromString (contextClass) new];
[context autorelease];

View File

@ -39,7 +39,7 @@
- (uint64_t) idFromURL: (NSString *) url;
- (BOOL) registerURL: (NSString *) urlString
withID: (uint64_t) idNbr;
- (void) registerURL: (NSString *) urlString;
// - (void) registerURL: (NSString *) urlString;
@end

View File

@ -21,6 +21,7 @@
*/
#import <Foundation/NSDictionary.h>
#import <Foundation/NSException.h>
#import <Foundation/NSString.h>
#import <Foundation/NSValue.h>
@ -28,17 +29,26 @@
#import "MAPIStoreMapping.h"
static const uint64_t idIncrement = 0x010000; /* we choose a high enough id to avoid any clash with system folders */
static uint64_t idCounter = 0x200001;
// static const uint64_t idIncrement = 0x010000; /* we choose a high enough id to avoid any clash with system folders */
// static uint64_t idCounter = 0x200001;
@implementation MAPIStoreMapping
- (void) _setupFixedMapping
{
[self registerURL: @"sogo://openchange:openchange@mail/folderINBOX" withID: 0x160001];
[self registerURL: @"sogo://openchange:openchange@contacts/personal" withID: 0x1a0001];
[self registerURL: @"sogo://openchange:openchange@calendar/personal" withID: 0x190001];
[self registerURL: @"sogo://openchange:openchange@tasks/personal" withID: 0x1d0001];
}
- (id) init
{
if ((self = [super init]))
{
mapping = [NSMutableDictionary new];
reverseMapping = [NSMutableDictionary new];
[self _setupFixedMapping];
}
return self;
@ -70,7 +80,7 @@ static uint64_t idCounter = 0x200001;
idNbr = [idKey unsignedLongLongValue];
else
idNbr = NSNotFound;
return idNbr;
}
@ -100,53 +110,55 @@ static uint64_t idCounter = 0x200001;
return rc;
}
- (void) registerURL: (NSString *) urlString
{
uint64_t idNbr;
// - (void) registerURL: (NSString *) urlString
// {
// uint64_t idNbr;
// newID = openchangedb_get_new_folderID();
if (![reverseMapping objectForKey: urlString])
{
if ([urlString isEqualToString: @"sogo://openchange:openchange@mail/folderINBOX"])
{
idNbr = 0x160001;
if (![self registerURL: urlString withID: idNbr])
[self errorWithFormat: @"Unable to register root folder: %@",
urlString];
}
// else if ([urlString isEqualToString: @"sogo://openchange:openchange@mail/folderSent"]) {
// idNbr = 0x140001;
// idCounter = idNbr;
// }
else if ([urlString isEqualToString: @"sogo://openchange:openchange@contacts/personal"])
{
idNbr = 0x1a0001;
if (![self registerURL: urlString withID: idNbr])
[self errorWithFormat: @"Unable to register root folder: %@",
urlString];
}
else if ([urlString isEqualToString: @"sogo://openchange:openchange@calendar/personal"])
{
idNbr = 0x190001;
if (![self registerURL: urlString withID: idNbr])
[self errorWithFormat: @"Unable to register root folder: %@",
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
{
idCounter += idIncrement;
while (![self registerURL: urlString withID: idCounter])
idCounter += idIncrement;
}
// [self _registerURL: urlString withID: newID];
}
}
// // newID = openchangedb_get_new_folderID();
// if (![reverseMapping objectForKey: urlString])
// {
// if ([urlString isEqualToString: @"sogo://openchange:openchange@mail/folderINBOX"])
// {
// idNbr = 0x160001;
// if (![self registerURL: urlString withID: idNbr])
// [self errorWithFormat: @"Unable to register root folder: %@",
// urlString];
// }
// // else if ([urlString isEqualToString: @"sogo://openchange:openchange@mail/folderSent"]) {
// // idNbr = 0x140001;
// // idCounter = idNbr;
// // }
// else if ([urlString isEqualToString: @"sogo://openchange:openchange@contacts/personal"])
// {
// idNbr = 0x1a0001;
// if (![self registerURL: urlString withID: idNbr])
// [self errorWithFormat: @"Unable to register root folder: %@",
// urlString];
// }
// else if ([urlString isEqualToString: @"sogo://openchange:openchange@calendar/personal"])
// {
// idNbr = 0x190001;
// if (![self registerURL: urlString withID: idNbr])
// [self errorWithFormat: @"Unable to register root folder: %@",
// 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
// {
// [NSException raise: @"MAPIStoreSOGoException"
// format: @"use registerURL:withID: instead"];
// // idCounter += idIncrement;
// // while (![self registerURL: urlString withID: idCounter])
// // idCounter += idIncrement;
// }
// // [self _registerURL: urlString withID: newID];
// }
// }
@end