Monotone-Parent: 4b7309393c3e0f0f0211dde1161875de6f69a117
Monotone-Revision: 6531438126de81058d8ee9b15839235efce21dc6 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2008-12-15T22:24:09 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
7bad646b76
commit
40aab6f8ca
|
@ -49,6 +49,7 @@
|
|||
{
|
||||
if (content)
|
||||
free (content);
|
||||
[self reset];
|
||||
[cards release];
|
||||
[currentGroup release];
|
||||
[super dealloc];
|
||||
|
@ -72,6 +73,8 @@
|
|||
}
|
||||
|
||||
vcs.isInVCardSet = 0;
|
||||
vcs.isInVCard = 0;
|
||||
vcs.isInGroup = 0;
|
||||
vcs.collectContent = 0;
|
||||
}
|
||||
|
||||
|
@ -86,7 +89,7 @@
|
|||
- (void) startDocument
|
||||
{
|
||||
if (!cards)
|
||||
cards = [[NSMutableArray alloc] initWithCapacity:16];
|
||||
cards = [[NSMutableArray alloc] initWithCapacity: 16];
|
||||
[self reset];
|
||||
}
|
||||
|
||||
|
@ -95,56 +98,12 @@
|
|||
[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 */
|
||||
|
||||
- (void) startGroup: (NSString *)_name
|
||||
{
|
||||
vcs.isInGroup = 1;
|
||||
ASSIGNCOPY(currentGroup, _name);
|
||||
ASSIGNCOPY (currentGroup, _name);
|
||||
}
|
||||
|
||||
- (void) endGroup
|
||||
|
@ -229,10 +188,12 @@
|
|||
|
||||
- (void) startCollectingContent
|
||||
{
|
||||
if (content) {
|
||||
if (content)
|
||||
{
|
||||
free (content);
|
||||
content = NULL;
|
||||
}
|
||||
|
||||
vcs.collectContent = 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue