Monotone-Parent: d253d04eddd673d2fda2f03ca664a7fc15cf7455
Monotone-Revision: 999af0129af96f5078d390fcb5a96d73f7683e04 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2008-03-07T22:17:16 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
e71b493b4a
commit
5cdbf589bd
|
@ -1,5 +1,10 @@
|
||||||
2008-03-07 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
2008-03-07 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
|
* OGoContentStore/OCSContactFieldExtractor.m
|
||||||
|
([OCSContactFieldExtractor -extractQuickFieldsFromVList:vList]):
|
||||||
|
new method to handle extraction of quick information from the
|
||||||
|
VLIST components. I.e.: the display name of the card.
|
||||||
|
|
||||||
* SoObjects/SOGo/SOGoFolder.m ([SOGoFolder
|
* SoObjects/SOGo/SOGoFolder.m ([SOGoFolder
|
||||||
-isValidContentName:name]): moved method from
|
-isValidContentName:name]): moved method from
|
||||||
SOGoAppointmentFolder's isValidAppointmentName.
|
SOGoAppointmentFolder's isValidAppointmentName.
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
#import <GDLContentStore/GCSFieldExtractor.h>
|
#import <GDLContentStore/GCSFieldExtractor.h>
|
||||||
#import <NGCards/NGVCard.h>
|
#import <NGCards/NGVCard.h>
|
||||||
|
#import <NGCards/NGVList.h>
|
||||||
|
|
||||||
@interface OCSContactFieldExtractor : GCSFieldExtractor
|
@interface OCSContactFieldExtractor : GCSFieldExtractor
|
||||||
@end
|
@end
|
||||||
|
@ -75,6 +76,22 @@
|
||||||
[fields setObject: [adr value: 3] forKey: @"c_l"];
|
[fields setObject: [adr value: 3] forKey: @"c_l"];
|
||||||
value = [[vCard uniqueChildWithTag: @"X-AIM"] value: 0];
|
value = [[vCard uniqueChildWithTag: @"X-AIM"] value: 0];
|
||||||
[fields setObject: value forKey: @"c_screenname"];
|
[fields setObject: value forKey: @"c_screenname"];
|
||||||
|
[fields setObject: @"vcard" forKey: @"c_component"];
|
||||||
|
|
||||||
|
return fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSMutableDictionary *) extractQuickFieldsFromVList: (NGVList *) vList
|
||||||
|
{
|
||||||
|
NSMutableDictionary *fields;
|
||||||
|
NSString *value;
|
||||||
|
|
||||||
|
fields = [NSMutableDictionary dictionaryWithCapacity: 1];
|
||||||
|
|
||||||
|
value = [vList fn];
|
||||||
|
if (value)
|
||||||
|
[fields setObject: value forKey: @"c_cn"];
|
||||||
|
[fields setObject: @"vlist" forKey: @"c_component"];
|
||||||
|
|
||||||
return fields;
|
return fields;
|
||||||
}
|
}
|
||||||
|
@ -83,19 +100,34 @@
|
||||||
{
|
{
|
||||||
NSMutableDictionary *fields;
|
NSMutableDictionary *fields;
|
||||||
NGVCard *vCard;
|
NGVCard *vCard;
|
||||||
|
NGVList *vList;
|
||||||
|
NSString *upperContent;
|
||||||
|
|
||||||
fields = nil;
|
fields = nil;
|
||||||
if ([content length] > 0
|
if ([content length] > 0)
|
||||||
&& [[content uppercaseString] hasPrefix: @"BEGIN:VCARD"])
|
{
|
||||||
|
upperContent = [content uppercaseString];
|
||||||
|
if ([upperContent hasPrefix: @"BEGIN:VCARD"])
|
||||||
{
|
{
|
||||||
vCard = [NGVCard parseSingleFromSource: content];
|
vCard = [NGVCard parseSingleFromSource: content];
|
||||||
if (vCard)
|
if (vCard)
|
||||||
fields = [self extractQuickFieldsFromVCard: vCard];
|
fields = [self extractQuickFieldsFromVCard: vCard];
|
||||||
else
|
else
|
||||||
[self errorWithFormat: @"Could not parse content as a vCard."];
|
[self errorWithFormat: @"Could not parse VCARD content."];
|
||||||
|
}
|
||||||
|
else if ([upperContent hasPrefix: @"BEGIN:VLIST"])
|
||||||
|
{
|
||||||
|
vList = [NGVList parseSingleFromSource: content];
|
||||||
|
if (vList)
|
||||||
|
fields = [self extractQuickFieldsFromVList: vList];
|
||||||
|
else
|
||||||
|
[self errorWithFormat: @"Could not parse VLIST content."];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
[self errorWithFormat: @"Content is not a vCard"];
|
[self errorWithFormat: @"Content is unknown."];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
[self errorWithFormat: @"Content is empty."];
|
||||||
|
|
||||||
return fields;
|
return fields;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,5 +54,10 @@
|
||||||
sqlType = "VARCHAR2(256)";
|
sqlType = "VARCHAR2(256)";
|
||||||
allowsNull = YES;
|
allowsNull = YES;
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
columnName = c_component;
|
||||||
|
sqlType = "VARCHAR2(10)";
|
||||||
|
allowsNull = NO;
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,5 +54,10 @@
|
||||||
sqlType = "VARCHAR(256)";
|
sqlType = "VARCHAR(256)";
|
||||||
allowsNull = YES;
|
allowsNull = YES;
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
columnName = c_component;
|
||||||
|
sqlType = "VARCHAR(10)";
|
||||||
|
allowsNull = NO;
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue