merge of 'c8d084db03459d614e6031f3b3996696f8a588b4'

and 'e3d03c71b23436eb1ba6f15cfccc6c59a06df891'

Monotone-Parent: c8d084db03459d614e6031f3b3996696f8a588b4
Monotone-Parent: e3d03c71b23436eb1ba6f15cfccc6c59a06df891
Monotone-Revision: b1078ea4dae02277bdf66ea5ad2e7fcdb26dc259

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2008-12-15T22:28:32
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2008-12-15 22:28:32 +00:00
commit 4a43370a91
12 changed files with 65 additions and 98 deletions

View File

@ -1,3 +1,23 @@
2008-12-15 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/Appointments/SOGoAppointmentFolder.m
([SOGoAppointmentFolder +webdavAclManager]): same as below.
* SoObjects/Appointments/SOGoAppointmentObject.m
([SOGoAppointmentObject +webdavAclManager]): same as below.
* SoObjects/SOGo/SOGoFolder.m ([SOGoFolder +webdavAclManager]):
same as below.
* SoObjects/SOGo/SOGoGCSFolder.m ([SOGoGCSFolder
+webdavAclManager]): same as below.
* SoObjects/SOGo/SOGoObject.m ([SOGoObject +webdavAclManager]):
same as below.
* SoObjects/SOGo/SOGoParentFolder.m ([SOGoParentFolder
+webdavAclManager]): declare singleton as static to avoid leaking.
2008-12-15 Ludovic Marcotte <lmarcotte@inverse.ca> 2008-12-15 Ludovic Marcotte <lmarcotte@inverse.ca>
* Updated german translations - patch from * Updated german translations - patch from

View File

@ -105,17 +105,17 @@
- (void) dealloc - (void) dealloc
{ {
if (tag) // [parent release];
[tag release]; [tag release];
[values release]; [group release];
[attributes release]; [attributes release];
[parent release]; [values release];
[super dealloc]; [super dealloc];
} }
- (void) setParent: (CardGroup *) aParent - (void) setParent: (CardGroup *) aParent
{ {
ASSIGN (parent, aParent); parent = aParent;
} }
- (id) parent - (id) parent
@ -128,6 +128,11 @@
ASSIGN (tag, aTag); ASSIGN (tag, aTag);
} }
- (NSString *) tag
{
return tag;
}
- (void) setGroup: (NSString *) aGroup - (void) setGroup: (NSString *) aGroup
{ {
ASSIGN (group, aGroup); ASSIGN (group, aGroup);
@ -216,11 +221,6 @@
[self addAttribute: @"type" value: aType]; [self addAttribute: @"type" value: aType];
} }
- (NSString *) tag
{
return tag;
}
- (NSArray *) values - (NSArray *) values
{ {
return values; return values;
@ -493,16 +493,12 @@
- (void) setValuesAsCopy: (NSMutableArray *) someValues - (void) setValuesAsCopy: (NSMutableArray *) someValues
{ {
[values release]; ASSIGN (values, someValues);
values = someValues;
[values retain];
} }
- (void) setAttributesAsCopy: (NSMutableDictionary *) someAttributes - (void) setAttributesAsCopy: (NSMutableDictionary *) someAttributes
{ {
[attributes release]; ASSIGN (attributes, someAttributes);
attributes = someAttributes;
[attributes retain];
} }
- (CardGroup *) searchParentOfClass: (Class) parentClass - (CardGroup *) searchParentOfClass: (Class) parentClass
@ -537,6 +533,7 @@
{ {
newChild = [[oldArray objectAtIndex: count] mutableCopyWithZone: aZone]; newChild = [[oldArray objectAtIndex: count] mutableCopyWithZone: aZone];
[newArray addObject: newChild]; [newArray addObject: newChild];
[newChild release];
} }
return newArray; return newArray;
@ -565,7 +562,6 @@
new = [[self class] new]; new = [[self class] new];
[new setTag: [tag copyWithZone: aZone]]; [new setTag: [tag copyWithZone: aZone]];
[new setGroup: [group copyWithZone: aZone]]; [new setGroup: [group copyWithZone: aZone]];
[new setParent: nil];
[new setValuesAsCopy: [self deepCopyOfArray: values withZone: aZone]]; [new setValuesAsCopy: [self deepCopyOfArray: values withZone: aZone]];
[new setAttributesAsCopy: [self deepCopyOfDictionary: attributes [new setAttributesAsCopy: [self deepCopyOfDictionary: attributes
withZone: aZone]]; withZone: aZone]];
@ -581,7 +577,6 @@
new = [[self class] new]; new = [[self class] new];
[new setTag: [tag mutableCopyWithZone: aZone]]; [new setTag: [tag mutableCopyWithZone: aZone]];
[new setGroup: [group mutableCopyWithZone: aZone]]; [new setGroup: [group mutableCopyWithZone: aZone]];
[new setParent: nil];
[new setValuesAsCopy: [self deepCopyOfArray: values withZone: aZone]]; [new setValuesAsCopy: [self deepCopyOfArray: values withZone: aZone]];
[new setAttributesAsCopy: [self deepCopyOfDictionary: attributes [new setAttributesAsCopy: [self deepCopyOfDictionary: attributes
withZone: aZone]]; withZone: aZone]];

View File

@ -68,7 +68,7 @@ static NGCardsSaxHandler *sax = nil;
+ (NSArray *) parseFromSource: (id) source + (NSArray *) parseFromSource: (id) source
{ {
static id <NSObject,SaxXMLReader> cardParser; static id <NSObject, SaxXMLReader> cardParser;
NSArray *cardGroups; NSArray *cardGroups;
cardGroups = nil; cardGroups = nil;
@ -83,6 +83,7 @@ static NGCardsSaxHandler *sax = nil;
[parser parseFromSource: source]; [parser parseFromSource: source];
cardGroups = [sax cards]; cardGroups = [sax cards];
[sax reset];
} }
} }

View File

@ -1,3 +1,8 @@
2008-12-15 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* CardElement.m ([CardElement -setParent:aParent]): no longer
retain the parent passed as parameter.
2008-12-10 Wolfgang Sourdeau <wsourdeau@inverse.ca> 2008-12-10 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* iCalYearlyRecurrenceCalculator.m * iCalYearlyRecurrenceCalculator.m

View File

@ -39,36 +39,23 @@
@interface NGCardsSaxHandler : SaxDefaultHandler @interface NGCardsSaxHandler : SaxDefaultHandler
{ {
unichar *content;
NSMutableArray *cards; NSMutableArray *cards;
CardElement *currentElement; CardElement *currentElement;
CardGroup *currentCardGroup; CardGroup *currentCardGroup;
NSString *currentGroup; NSString *currentGroup;
unichar *content;
unsigned contentLength; unsigned contentLength;
NSMutableDictionary *xtags;
NSMutableDictionary *subvalues;
NSMutableArray *types; NSMutableArray *types;
NSMutableDictionary *args;
NSMutableArray *tel;
NSMutableArray *adr;
NSMutableArray *email;
NSMutableArray *label;
NSMutableArray *url;
NSMutableArray *fburl;
NSMutableArray *caluri;
struct { struct {
int isInVCardSet:1; int isInVCardSet:1;
int isInVCard:1; int isInVCard:1;
int isInN:1;
int isInAdr:1;
int isInOrg:1;
int isInGroup:1; int isInGroup:1;
int isInGeo:1;
int collectContent:1; int collectContent:1;
int reserved:24;
} vcs; } vcs;
Class topGroupClass; Class topGroupClass;

View File

@ -49,6 +49,7 @@
{ {
if (content) if (content)
free (content); free (content);
[self reset];
[cards release]; [cards release];
[currentGroup release]; [currentGroup release];
[super dealloc]; [super dealloc];
@ -71,7 +72,9 @@
content = NULL; content = NULL;
} }
vcs.isInVCardSet = 0; vcs.isInVCardSet = 0;
vcs.isInVCard = 0;
vcs.isInGroup = 0;
vcs.collectContent = 0; vcs.collectContent = 0;
} }
@ -86,7 +89,7 @@
- (void) startDocument - (void) startDocument
{ {
if (!cards) if (!cards)
cards = [[NSMutableArray alloc] initWithCapacity:16]; cards = [[NSMutableArray alloc] initWithCapacity: 16];
[self reset]; [self reset];
} }
@ -95,56 +98,12 @@
[self resetExceptResult]; [self resetExceptResult];
} }
/* common tags */
- (void) startValueTag: (NSString *) _tag
attributes: (id<SaxAttributes>) _attrs
{
/* a tag with types and attributes */
unsigned i, count;
[types removeAllObjects];
[args removeAllObjects];
for (i = 0, count = [_attrs count]; i < count; i++) {
NSString *n, *v;
n = [_attrs nameAtIndex:i];
v = [_attrs valueAtIndex:i];
if ([n hasSuffix:@".type"] || [n isEqualToString:@"TYPE"]) {
/*
Note: types cannot be separated by comma! Its indeed always a space,eg
"work pref voice"
If you find commas, usually the vCard is broken.
*/
NSEnumerator *e;
NSString *k;
e = [[v componentsSeparatedByString:@" "] objectEnumerator];
while ((k = [e nextObject]) != nil) {
k = [k uppercaseString];
if ([types containsObject:k]) continue;
[types addObject:k];
}
}
else
[args setObject:v forKey:n];
}
}
- (void) endValueTag
{
[types removeAllObjects];
[args removeAllObjects];
}
/* handle elements */ /* handle elements */
- (void) startGroup: (NSString *)_name - (void) startGroup: (NSString *)_name
{ {
vcs.isInGroup = 1; vcs.isInGroup = 1;
ASSIGNCOPY(currentGroup, _name); ASSIGNCOPY (currentGroup, _name);
} }
- (void) endGroup - (void) endGroup
@ -229,10 +188,12 @@
- (void) startCollectingContent - (void) startCollectingContent
{ {
if (content) { if (content)
free (content); {
content = NULL; free (content);
} content = NULL;
}
vcs.collectContent = 1; vcs.collectContent = 1;
} }

View File

@ -127,7 +127,7 @@ static Class sogoAppointmentFolderKlass = Nil;
+ (SOGoWebDAVAclManager *) webdavAclManager + (SOGoWebDAVAclManager *) webdavAclManager
{ {
SOGoWebDAVAclManager *aclManager = nil; static SOGoWebDAVAclManager *aclManager = nil;
NSString *nsI; NSString *nsI;
if (!aclManager) if (!aclManager)
@ -1071,7 +1071,6 @@ static Class sogoAppointmentFolderKlass = Nil;
NSString **values, **currentValue; NSString **values, **currentValue;
SoSecurityManager *mgr; SoSecurityManager *mgr;
SEL methodSel; SEL methodSel;
Class c;
#warning things may crash here... #warning things may crash here...
values = calloc (100, sizeof (NSMutableString *)); values = calloc (100, sizeof (NSMutableString *));

View File

@ -58,7 +58,7 @@
+ (SOGoWebDAVAclManager *) webdavAclManager + (SOGoWebDAVAclManager *) webdavAclManager
{ {
SOGoWebDAVAclManager *aclManager = nil; static SOGoWebDAVAclManager *aclManager = nil;
NSString *nsD, *nsI; NSString *nsD, *nsI;
if (!aclManager) if (!aclManager)

View File

@ -58,12 +58,14 @@ static NSLock *lock;
@implementation SOGoCache @implementation SOGoCache
#if defined(THREADSAFE)
+ (void) initialize + (void) initialize
{ {
#if defined(THREADSAFE)
lock = [NSLock new]; lock = [NSLock new];
}
#endif #endif
s_userDefaults = [[NSMutableDictionary alloc] init];
s_userSettings = [[NSMutableDictionary alloc] init];
}
+ (NSTimeInterval) cleanupInterval + (NSTimeInterval) cleanupInterval
{ {
@ -105,9 +107,6 @@ static NSLock *lock;
cache = [[NSMutableDictionary alloc] init]; cache = [[NSMutableDictionary alloc] init];
users = [[NSMutableDictionary alloc] init]; users = [[NSMutableDictionary alloc] init];
s_userDefaults = [[NSMutableDictionary alloc] init];
s_userSettings = [[NSMutableDictionary alloc] init];
// We register ourself for notifications // We register ourself for notifications
[[NSDistributedNotificationCenter defaultCenter] [[NSDistributedNotificationCenter defaultCenter]
addObserver: self addObserver: self

View File

@ -46,7 +46,7 @@
+ (SOGoWebDAVAclManager *) webdavAclManager + (SOGoWebDAVAclManager *) webdavAclManager
{ {
SOGoWebDAVAclManager *webdavAclManager = nil; static SOGoWebDAVAclManager *webdavAclManager = nil;
if (!webdavAclManager) if (!webdavAclManager)
{ {

View File

@ -73,7 +73,7 @@ static NSArray *childRecordFields = nil;
+ (SOGoWebDAVAclManager *) webdavAclManager + (SOGoWebDAVAclManager *) webdavAclManager
{ {
SOGoWebDAVAclManager *aclManager = nil; static SOGoWebDAVAclManager *aclManager = nil;
if (!aclManager) if (!aclManager)
{ {

View File

@ -54,7 +54,7 @@ static SoSecurityManager *sm = nil;
+ (SOGoWebDAVAclManager *) webdavAclManager + (SOGoWebDAVAclManager *) webdavAclManager
{ {
SOGoWebDAVAclManager *aclManager = nil; static SOGoWebDAVAclManager *aclManager = nil;
if (!aclManager) if (!aclManager)
{ {