Monotone-Parent: b905373c7a05b0b865e4b2361c76b7a5d079a520

Monotone-Revision: c29edea33f25c719bad972e23d7441b3851b8164

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2006-08-09T21:13:22
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2006-08-09 21:13:22 +00:00
parent 440b7f6a2f
commit fac49e4f69
3 changed files with 141 additions and 0 deletions

View File

@ -1,5 +1,10 @@
2006-08-09 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/Contacts/NGVCard+Contact.m ([NGVCard -asString]): new
method that generates a textual representation of the vcard.
* SoObjects/Contacts/NGVCard+Contact.[hm]: new class extension.
* SoObjects/Contacts/SOGoContactGCSFolder.[hm]: new module name of
"SOGoContactFolder".

View File

@ -0,0 +1,34 @@
/* NGVCard+Contact.h - this file is part of SOGo
*
* Copyright (C) 2006 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 NGVCARD_CONTACT_H
#define NGVCARD_CONTACT_H
#import <NGiCal/NGVCard.h>
@interface NGVCard (SOGOContactExtension)
- (NSString *) asString;
@end
#endif /* NGVCARD+CONTACT_H */

View File

@ -0,0 +1,102 @@
/* NGVCard+Contact.m - this file is part of SOGo
*
* Copyright (C) 2006 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/NSString.h>
#import <NGiCal/NGVCardValue.h>
#import "NGVCardSimpleValue+Contact.h"
#import "NGVCard+Contact.h"
@implementation NGVCard (SOGOContactExtension)
- (NSString *) asString
{
NSMutableString *vCardString;
NSArray *infos;
unsigned int count, max;
vCardString = [NSMutableString new];
[vCardString autorelease];
[vCardString appendFormat: @"BEGIN:VCARD\r\n"
@"VERSION:%@\r\n"
@"PRODID:%@\r\n"
@"PROFILE:%@\r\n",
[self version], [self prodID], [self profile]];
[vCardString appendFormat: @"FN:%@\r\n", [self fn]];
[vCardString appendFormat: @"N:%@\r\n", [[self n] stringValue]];
infos = [self email];
if ([infos count] > 0)
[vCardString appendFormat: @"EMAIL;TYPE=internet,pref:%@\r\n",
[infos objectAtIndex: 0]];
infos = [self tel];
max = [infos count];
for (count = 0; count < max; count++)
[vCardString appendFormat: @"%@\r\n",
[[infos objectAtIndex: count] vCardEntryString]];
// }
// count =
// if ([infos count] > 0)
// [vCardString appendFormat: @"EMAIL;TYPE=internet,pref:%@\r\n",
// [infos objectAtIndex: 0]];
// [self _appendArrayedVCardValues:
// [NSArray arrayWithObjects: @"sn", @"givenName", nil]
// withFormat: @"N:%@;;;\r\n"
// toVCard: vCardString];
// [self _appendSingleVCardValue: @"telephoneNumber"
// withFormat: @"TEL;TYPE=work,voice,pref:%@\r\n"
// toVCard: vCardString];
// [self _appendSingleVCardValue: @"facsimileTelephoneNumber"
// withFormat: @"TEL;TYPE=work,fax:%@\r\n"
// toVCard: vCardString];
// [self _appendSingleVCardValue: @"homeTelephoneNumber"
// withFormat: @"TEL;TYPE=home,voice:%@\r\n"
// toVCard: vCardString];
// [self _appendSingleVCardValue: @"mobile"
// withFormat: @"TEL;TYPE=cell,voice:%@\r\n"
// toVCard: vCardString];
// [self _appendArrayedVCardValues:
// [NSArray arrayWithObjects: @"l", @"departmentNumber", nil]
// withFormat: @"ORG:%@\r\n"
// toVCard: vCardString];
// [self _appendMultilineVCardValue: @"postalAddress"
// withFormat: @"ADR:TYPE=work,postal:%@\r\n"
// toVCard: vCardString];
// [self _appendMultilineVCardValue: @"homePostalAddress"
// withFormat: @"ADR:TYPE=home,postal:%@\r\n"
// toVCard: vCardString];
// [self _appendSingleVCardValue: @"labelledURI"
// withFormat: @"URL:%@\r\n"
// toVCard: vCardString];
[vCardString appendString: @"END:VCARD\r\n"];
return vCardString;
}
@end