2 Copyright (C) 2004-2005 SKYRIX Software AG
4 This file is part of OpenGroupware.org.
6 OGo is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with OGo; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 #include <GDLContentStore/GCSFieldExtractor.h>
24 @interface OCSContactFieldExtractor : GCSFieldExtractor
29 @implementation OCSContactFieldExtractor
31 - (NSMutableDictionary *)extractQuickFieldsFromContent:(NSString *)_content {
32 static NSString *fieldNames[] = {
43 NSMutableDictionary *fields;
47 if ([_content length] == 0)
50 // TODO: we want to support vcard storage in the future?!
52 if ((plist = [_content propertyList]) == nil) {
53 [self logWithFormat:@"ERROR: could not parse property list content!"];
57 fields = [NSMutableDictionary dictionaryWithCapacity:16];
59 /* copy field values to quick record */
60 for (i = 0; fieldNames[i] != nil; i++) {
61 NSString *fieldName, *sqlName;
64 fieldName = fieldNames[i];
65 sqlName = [fieldName lowercaseString]; /* actually pgsql doesn't care */
67 value = [plist objectForKey:fieldName];
68 if ([value isNotNull])
69 [fields setObject:value forKey:sqlName];
71 [fields setObject:[NSNull null] forKey:sqlName];
77 @end /* OCSContactFieldExtractor */