Monotone-Parent: 15e04e20f70b9b47fd1b07515f92cf8a50629f0b

Monotone-Revision: 1b85a9d7216f9937a44da6e0649a8b8f792b25c9

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2008-03-03T17:32:12
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2008-03-03 17:32:12 +00:00
parent ba02cb287e
commit 852a2e95ab
8 changed files with 391 additions and 1 deletions
+8
View File
@@ -1,3 +1,11 @@
2008-03-03 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* NGVCardReference.[hm]: new class module that implements the base
data type contained in a VLIST element.
* NGVList.[hm]: new class module that implements Thunderbird-style
personal mailing lists. Base mime-type is "text/x-vlist".
2008-02-08 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* iCalRecurrenceRule.m ([iCalRecurrenceRule -wkst]): if no wkst
+4 -1
View File
@@ -53,6 +53,8 @@ libNGCards_HEADER_FILES = \
NSCalendarDate+ICal.h \
\
NGVCard.h \
NGVList.h \
NGVCardReference.h \
# NGVCardAddress.h \
# NGVCardStrArrayValue.h \
# NGVCardName.h \
@@ -101,11 +103,12 @@ libNGCards_OBJC_FILES = \
iCalYearlyRecurrenceCalculator.m\
\
NGVCard.m \
NGVList.m \
NGVCardReference.m \
NGCardsSaxHandler.m \
# IcalElements.m
# IcalResponse.m
# framework support
NGCards_PCH_FILE = $(libNGCards_PCH_FILE)
+8
View File
@@ -59,6 +59,14 @@
@class NSDictionary;
@class NSString;
/* this should be merged in a common definition headers with iCalAccessClass */
typedef enum
{
NGCardsAccessPublic = 0,
NGCardsAccessPrivate = 1,
NGCardsAccessConfidential = 2,
} NGCardsAccessClass;
@interface NGVCard : CardGroup
+ (id) cardWithUid: (NSString *) _uid;
+42
View File
@@ -0,0 +1,42 @@
/* NGVCardReference.h - this file is part of NGCards
*
* Copyright (C) 2008 Inverse groupe conseil
*
* 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 NGVCARDREFERENCE_H
#define NGVCARDREFERENCE_H
#import "CardElement.h"
@class NSString;
@interface NGVCardReference : CardElement
- (void) setFn: (NSString *) newFn;
- (NSString *) fn;
- (void) setEmail: (NSString *) newEmail;
- (NSString *) email;
- (void) setReference: (NSString *) newReference;
- (NSString *) reference;
@end
#endif /* NGVCARDREFERENCE_H */
+59
View File
@@ -0,0 +1,59 @@
/* NGVCardReference.m - this file is part of NGCards
*
* Copyright (C) 2008 Inverse groupe conseil
*
* 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 <Foundation/NSString.h>
#import "NGVCardReference.h"
@implementation NGVCardReference
- (void) setFn: (NSString *) newFn
{
[self setValue: 0 ofAttribute: @"fn" to: newFn];
}
- (NSString *) fn
{
return [self value: 0 ofAttribute: @"fn"];
}
- (void) setEmail: (NSString *) newEmail
{
[self setValue: 0 ofAttribute: @"email" to: newEmail];
}
- (NSString *) email
{
return [self value: 0 ofAttribute: @"email"];
}
- (void) setReference: (NSString *) newReference
{
[self setValue: 0 to: newReference];
}
- (NSString *) reference
{
return [self value: 0];
}
@end
+69
View File
@@ -0,0 +1,69 @@
/* NGVList.h - this file is part of NGCards
*
* Copyright (C) 2008 Inverse groupe conseil
*
* 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 NGVLIST_H
#define NGVLIST_H
#import "CardGroup.h"
#import "NGVCard.h"
@class NSArray;
@class NSDictionary;
@class NSString;
@class NGVCardReference;
@interface NGVList : CardGroup
+ (id) listWithUid: (NSString *) newUid;
- (id) initWithUid: (NSString *) newUid;
/* accessors */
- (void) setProdID: (NSString *) newProdID;
- (NSString *) prodID;
- (void) setVersion: (NSString *) newVersion;
- (NSString *) version;
- (void) setUid: (NSString *) newUid;
- (NSString *) uid;
- (void) setAccessClass: (NSString *) newAccessClass;
- (NSString *) accessClass;
- (NGCardsAccessClass) symbolicAccessClass;
- (BOOL) isPublic;
- (void) setFn: (NSString *) newFn;
- (NSString *) fn;
- (void) setNickname: (NSString *) newNickname;
- (NSString *) nickname;
- (void) setDescription: (NSString *) newDescription;
- (NSString *) description;
- (void) addCardReference: (NGVCardReference *) newCardRef;
- (void) deleteCardReference: (NGVCardReference *) cardRef;
- (NSArray *) cardReferences;
@end
#endif /* NGVLIST_H */
+200
View File
@@ -0,0 +1,200 @@
/* NGVList.m - this file is part of NGCards
*
* Copyright (C) 2008 Inverse groupe conseil
*
* 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 <Foundation/NSArray.h>
#import <Foundation/NSEnumerator.h>
#import <Foundation/NSString.h>
#import "NGVCardReference.h"
#import "NGVList.h"
@implementation NGVList
+ (id) listWithUid: (NSString *) _uid
{
NGVList *newList;
newList = [[self alloc] initWithUid: _uid];
[newList autorelease];
return newList;
}
- (id) initWithUid: (NSString *) _uid
{
if ((self = [self init]))
{
[self setTag: @"vlist"];
[self setUid: _uid];
[self setVersion: @"1.0"];
}
return self;
}
/* class mapping */
- (Class) classForTag: (NSString *) classTag
{
Class tagClass;
tagClass = Nil;
if ([classTag isEqualToString: @"PRODID"]
|| [classTag isEqualToString: @"VERSION"]
|| [classTag isEqualToString: @"UID"]
|| [classTag isEqualToString: @"CLASS"]
|| [classTag isEqualToString: @"FN"]
|| [classTag isEqualToString: @"NICKNAME"]
|| [classTag isEqualToString: @"DESCRIPTION"])
tagClass = [CardElement class];
else if ([classTag isEqualToString: @"CARD"])
tagClass = [NGVCardReference class];
else
tagClass = [super classForTag: classTag];
return tagClass;
}
- (void) setProdID: (NSString *) newProdID
{
[[self uniqueChildWithTag: @"prodid"] setValue: 0 to: newProdID];
}
- (NSString *) prodID
{
return [[self uniqueChildWithTag: @"prodid"] value: 0];
}
- (void) setVersion: (NSString *) newVersion
{
[[self uniqueChildWithTag: @"version"] setValue: 0
to: newVersion];
}
- (NSString *) version
{
return [[self uniqueChildWithTag: @"version"] value: 0];
}
- (void) setUid: (NSString *) newUid
{
[[self uniqueChildWithTag: @"uid"] setValue: 0
to: newUid];
}
- (NSString *) uid
{
return [[self uniqueChildWithTag: @"uid"] value: 0];
}
- (void) setAccessClass: (NSString *) newAccessClass
{
[[self uniqueChildWithTag: @"class"] setValue: 0
to: newAccessClass];
}
- (NSString *) accessClass
{
return [[self uniqueChildWithTag: @"class"] value: 0];
}
- (NGCardsAccessClass) symbolicAccessClass
{
NGCardsAccessClass symbolicAccessClass;
NSString *accessClass;
accessClass = [[self accessClass] uppercaseString];
if ([accessClass isEqualToString: @"PRIVATE"])
symbolicAccessClass = NGCardsAccessPrivate;
else if ([accessClass isEqualToString: @"CONFIDENTIAL"])
symbolicAccessClass = NGCardsAccessConfidential;
else
symbolicAccessClass = NGCardsAccessPublic;
return symbolicAccessClass;
}
- (BOOL) isPublic
{
return ([self symbolicAccessClass] == NGCardsAccessPublic);
}
- (void) setFn: (NSString *) newFn
{
[[self uniqueChildWithTag: @"fn"] setValue: 0 to: newFn];
}
- (NSString *) fn
{
return [[self uniqueChildWithTag: @"fn"] value: 0];
}
- (void) setNickname: (NSString *) newNickname
{
[[self uniqueChildWithTag: @"nickname"] setValue: 0
to: newNickname];
}
- (NSString *) nickname
{
return [[self uniqueChildWithTag: @"nickname"] value: 0];
}
- (void) setDescription: (NSString *) newDescription
{
[[self uniqueChildWithTag: @"description"] setValue: 0
to: newDescription];
}
- (NSString *) description
{
return [[self uniqueChildWithTag: @"description"] value: 0];
}
- (void) addCardReference: (NGVCardReference *) newCardRef
{
[self addChild: newCardRef];
}
- (void) deleteCardReference: (NGVCardReference *) cardRef
{
NSEnumerator *cardReferences;
NGVCardReference *currentRef;
NSMutableArray *deletedRefs;
deletedRefs = [NSMutableArray array];
cardReferences
= [[self childrenWithTag: @"card"] objectEnumerator];
while ((currentRef = [cardReferences nextObject]))
if ([[currentRef reference]
isEqualToString: [cardRef reference]])
[deletedRefs addObject: currentRef];
[children removeObjectsInArray: deletedRefs];
}
- (NSArray *) cardReferences
{
return [self childrenWithTag: @"card"];
}
@end
@@ -9,6 +9,7 @@
{
name = "VSCardSaxDriver";
sourceTypes = ( "text/x-vcard", "text/vcard",
"text/x-vlist",
"text/x-calendar", "text/calendar" );
}
);