+2007-02-27 Marcus Mueller <znek@mulle-kybernetik.com>
+
+ * v4.7.80
+
+ * NGVCard.[hm]: Added API for properly dealing with photos and
+ associated MIME types
+
+ * NGVCardSaxHandler.m: added support for parsing photo types (section
+ 3.1.4 in RFC2426). Also cleaned up some logging related code.
+
2007-02-12 Helge Hess <helge.hess@opengroupware.org>
* iCalMonthlyRecurrenceCalculator.m: fixed byday calculation for days
NSArray *fburl;
NSArray *caluri;
NSDictionary *x;
+
+ NSData *photo;
+ NSString *photoType; // an IANA registered name
}
+ (NSArray *)parseVCardsFromSource:(id)_src;
- (void)setX:(NSDictionary *)_dict;
- (NSDictionary *)x;
+- (void)setPhoto:(NSData *)_photo;
+- (NSData *)photo;
+- (void)setPhotoType:(NSString *)_photoType;
+- (NSString *)photoType;
+
/* convenience */
- (NGVCardSimpleValue *)preferredEMail;
- (NGVCardPhone *)preferredTel;
- (NGVCardAddress *)preferredAdr;
+- (NSString *)photoMimeType;
@end
return self->x;
}
+- (void)setPhoto:(NSData *)_photo {
+ ASSIGNCOPY(self->photo, _photo);
+}
+- (NSData *)photo {
+ return self->photo;
+}
+- (void)setPhotoType:(NSString *)_photoType {
+ ASSIGNCOPY(self->photoType, _photoType);
+}
+- (NSString *)photoType {
+ return self->photoType;
+}
+
/* convenience */
- (id)preferredValueInArray:(NSArray *)_values {
- (NGVCardAddress *)preferredAdr {
return [self preferredValueInArray:self->adr];
}
+- (NSString *)photoMimeType {
+ NSString *t;
+
+ t = [self photoType];
+ if (![t isNotNull]) return @"image/octet-stream";
+ return [NSString stringWithFormat:@"image/%@", [t lowercaseString]];
+}
/* description */
self->vcs.isInVCard = 1;
if (self->vCard != nil) {
[self->vCards addObject:self->vCard];
- [self logWithFormat:@"ERROR: vCard nesting not supported!"];
+ [self errorWithFormat:@"vCard nesting not supported!"];
[self->vCard release]; self->vCard = nil;
}
if ((t = [_attrs valueForName:@"class" uri:XMLNS_VCARD_XML_03]) != nil)
[self->vCard setVClass:t];
if ((t = [_attrs valueForName:@"rev" uri:XMLNS_VCARD_XML_03]) != nil) {
- [self logWithFormat:@"WARNING: vCard revision not yet supported!"];
+ [self warnWithFormat:@"vCard revision not yet supported!"];
// TODO
}
if ((t = [_attrs valueForName:@"prodid" uri:XMLNS_VCARD_XML_03]) != nil)
- (void)startSubContentTag:(id<SaxAttributes>)_attrs {
if ([_attrs count] > 0)
- [self logWithFormat:@"WARNING: loosing attrs of subtag: %@", _attrs];
+ [self warnWithFormat:@"loosing attrs of subtag: %@", _attrs];
[self startCollectingContent];
}
andAddTo:self->fburl];
}
+- (void)startPhoto:(id<SaxAttributes>)_attrs {
+ [self startValueTag:@"photo" attributes:_attrs];
+ [self startCollectingContent];
+}
+- (void)endPhoto {
+ NSString *d;
+ NSData *photo;
+ unsigned count, i;
+
+ d = [self finishCollectingContent];
+ // TODO: rfc2426 requires support for URI and other stuff!
+ photo = [d dataByDecodingBase64];
+ [self->vCard setPhoto:photo];
+ count = [self->types count];
+ for (i = 0; i < count; i++) {
+ NSString *type = [self->types objectAtIndex:i];
+ if ([type isEqualToString:@"BASE64"]) {
+ continue;
+ }
+ else {
+ [self->vCard setPhotoType:type];
+ break;
+ }
+ }
+
+ [self endValueTag];
+}
+
/* OGo?? tags */
- (void)startProfile:(id<SaxAttributes>)_attrs {
// TODO: following are generated by LSAddress, but not in spec?
else if (c0 == 'P' && [_localName isEqualToString:@"PROFILE"])
[self startProfile:_attrs];
+ else if (c0 == 'p' && [_localName isEqualToString:@"photo"])
+ [self startPhoto:_attrs];
else if (c0 == 'S' && [_localName isEqualToString:@"SOURCE"])
[self startSource:_attrs];
else if (c0 == 'N' && [_localName isEqualToString:@"NAME"])
else if (c0 == 'X')
[self startX:_localName attributes:_attrs];
else
- NSLog(@"U: %@", _localName);
+ [self logWithFormat:@"U: %@", _localName];
}
}
[self endGeo];
else if (c0 == 'P' && [_localName isEqualToString:@"PROFILE"])
[self endProfile];
+ else if (c0 == 'p' && [_localName isEqualToString:@"photo"])
+ [self endPhoto];
else if (c0 == 'S' && [_localName isEqualToString:@"SOURCE"])
[self endSource];
else if (c0 == 'N' && [_localName isEqualToString:@"NAME"])
buildSettings = {
COPY_PHASE_STRIP = NO;
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 4.7.79;
+ DYLIB_CURRENT_VERSION = 4.7.80;
FRAMEWORK_SEARCH_PATHS = "$(LOCAL_LIBRARY_DIR)/Frameworks";
FRAMEWORK_VERSION = A;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
DEPLOYMENT_POSTPROCESSING = YES;
DSTROOT = /;
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 4.7.79;
+ DYLIB_CURRENT_VERSION = 4.7.80;
DYLIB_INSTALL_NAME_BASE = "@executable_path/../Frameworks/";
FRAMEWORK_SEARCH_PATHS = "$(USER_LIBRARY_DIR)/EmbeddedFrameworks";
FRAMEWORK_VERSION = A;
isa = XCBuildConfiguration;
buildSettings = {
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 4.7.79;
+ DYLIB_CURRENT_VERSION = 4.7.80;
FRAMEWORK_SEARCH_PATHS = "$(LOCAL_LIBRARY_DIR)/Frameworks";
FRAMEWORK_VERSION = A;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
buildSettings = {
COPY_PHASE_STRIP = NO;
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 4.7.79;
+ DYLIB_CURRENT_VERSION = 4.7.80;
FRAMEWORK_SEARCH_PATHS = "\"$(USER_LIBRARY_DIR)/EmbeddedFrameworks\"";
FRAMEWORK_VERSION = A;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
DEPLOYMENT_POSTPROCESSING = YES;
DSTROOT = /;
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 4.7.79;
+ DYLIB_CURRENT_VERSION = 4.7.80;
DYLIB_INSTALL_NAME_BASE = "@executable_path/../Frameworks/";
FRAMEWORK_SEARCH_PATHS = "$(USER_LIBRARY_DIR)/EmbeddedFrameworks";
FRAMEWORK_VERSION = A;
isa = XCBuildConfiguration;
buildSettings = {
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 4.7.79;
+ DYLIB_CURRENT_VERSION = 4.7.80;
FRAMEWORK_SEARCH_PATHS = "\"$(USER_LIBRARY_DIR)/EmbeddedFrameworks\"";
FRAMEWORK_VERSION = A;
GCC_PRECOMPILE_PREFIX_HEADER = NO;
MAJOR_VERSION=4
MINOR_VERSION=7
-SUBMINOR_VERSION:=79
+SUBMINOR_VERSION:=80
# v4.5.40 requires NGExtensions v4.5.145
# v4.5.37 requires NGExtensions v4.5.140