]> err.no Git - scalable-opengroupware.org/blob - SoObjects/Contacts/SOGoContactGCSEntry.m
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1040 d1b88da0-ebda-0310...
[scalable-opengroupware.org] / SoObjects / Contacts / SOGoContactGCSEntry.m
1 /*
2   Copyright (C) 2004-2005 SKYRIX Software AG
3
4   This file is part of OpenGroupware.org.
5
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
9   later version.
10
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.
15
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
19   02111-1307, USA.
20 */
21
22 #import <Foundation/NSArray.h>
23 #import <Foundation/NSString.h>
24
25 #import <NGCards/NGVCard.h>
26
27 #import "SOGoContactGCSEntry.h"
28
29 @implementation SOGoContactGCSEntry
30
31 - (id) init
32 {
33   if ((self = [super init]))
34     {
35       card = nil;
36     }
37
38   return self;
39 }
40
41 - (void) dealloc
42 {
43   if (card)
44     [card release];
45   [super dealloc];
46 }
47
48 /* content */
49
50 - (NGVCard *) vCard
51 {
52   NSString *contentStr;
53
54   if (!card)
55     {
56       contentStr = [self contentAsString];
57       if ([contentStr hasPrefix:@"BEGIN:VCARD"])
58         card = [NGVCard parseSingleFromSource: contentStr];
59       else
60         card = [NGVCard cardWithUid: [self nameInContainer]];
61       [card retain];
62     }
63
64   return card;
65 }
66
67 /* DAV */
68
69 - (NSString *) davContentType
70 {
71   return @"text/x-vcard";
72 }
73
74 /* specialized actions */
75
76 - (void) save
77 {
78   NGVCard *vcard;
79
80   vcard = [self vCard];
81
82   [self saveContentString: [vcard versitString]];
83 }
84
85 /* message type */
86
87 - (NSString *) outlookMessageClass
88 {
89   return @"IPM.Contact";
90 }
91
92 @end /* SOGoContactGCSEntry */