mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-23 04:15:26 +00:00
Monotone-Parent: f8970fcb6459908f8da50c19a17d230c7a4ee5b8
Monotone-Revision: 0a6c3c0f6c27c1e6de388cc4e18f577038a7c7e8 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-03-22T16:08:51 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
2007-03-22 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* SoObjects/Contacts/NSDictionary+Contact.m: removed module.
|
||||
|
||||
2007-03-21 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* UI/Contacts/UIxContactsListView.m ([UIxContactsListView
|
||||
|
||||
@@ -15,7 +15,6 @@ Contacts_OBJC_FILES = \
|
||||
SOGoContactLDAPEntry.m \
|
||||
SOGoContactLDAPFolder.m \
|
||||
\
|
||||
NSDictionary+Contact.m \
|
||||
NGLdapEntry+Contact.m \
|
||||
|
||||
Contacts_RESOURCE_FILES += \
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
/* NSDictionary+Contact.h - this file is part of $PROJECT_NAME_HERE$
|
||||
*
|
||||
* 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 NSDICTIONARY_CONTACT_H
|
||||
#define NSDICTIONARY_CONTACT_H
|
||||
|
||||
#import <Foundation/NSDictionary.h>
|
||||
|
||||
@class NSString;
|
||||
|
||||
@interface NSDictionary (SOGoContact)
|
||||
|
||||
- (NSString *) vcardContentFromSOGoContactRecord;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* NSDICTIONARY_CONTACT_H */
|
||||
@@ -1,125 +0,0 @@
|
||||
/* NSDictionary+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 "NSDictionary+Contact.h"
|
||||
|
||||
@implementation NSDictionary (SOGoContact)
|
||||
|
||||
- (void) _appendSingleVCardValue: (NSString *) value
|
||||
withFormat: (NSString *) format
|
||||
toVCard: (NSMutableString *) vCard
|
||||
{
|
||||
NSString *info;
|
||||
|
||||
info = [self objectForKey: value];
|
||||
if (info && [info length] > 0)
|
||||
[vCard appendFormat: format, info];
|
||||
}
|
||||
|
||||
- (void) _appendMultilineVCardValue: (NSString *) value
|
||||
withFormat: (NSString *) format
|
||||
toVCard: (NSMutableString *) vCard
|
||||
{
|
||||
NSString *info;
|
||||
|
||||
info = [[self objectForKey: value]
|
||||
stringByReplacingString: @"\r\n"
|
||||
withString: @";"];
|
||||
if (info && [info length] > 0)
|
||||
[vCard appendFormat: format, info];
|
||||
}
|
||||
|
||||
- (void) _appendArrayedVCardValues: (NSArray *) keys
|
||||
withFormat: (NSString *) format
|
||||
toVCard: (NSMutableString *) vCard
|
||||
{
|
||||
NSArray *values;
|
||||
unsigned int count, max;
|
||||
|
||||
values = [self objectsForKeys: keys notFoundMarker: @""];
|
||||
|
||||
max = [values count];
|
||||
while (count < max
|
||||
&& [[values objectAtIndex: count] isEqualToString: @""])
|
||||
count++;
|
||||
|
||||
if (count < max)
|
||||
[vCard appendFormat: format, [values componentsJoinedByString: @";"]];
|
||||
}
|
||||
|
||||
- (NSString *) vcardContentFromSOGoContactRecord
|
||||
{
|
||||
NSMutableString *newVCard;
|
||||
|
||||
newVCard = [NSMutableString new];
|
||||
[newVCard autorelease];
|
||||
|
||||
[newVCard appendString: @"BEGIN:VCARD\r\n"
|
||||
"VERSION:3.0\r\n"
|
||||
"PRODID:-//OpenGroupware.org//LSAddress v5.3.85\r\n"
|
||||
"PROFILE:vCard\r\n"];
|
||||
|
||||
[self _appendSingleVCardValue: @"cn"
|
||||
withFormat: @"FN:%@\r\n"
|
||||
toVCard: newVCard];
|
||||
[self _appendArrayedVCardValues:
|
||||
[NSArray arrayWithObjects: @"sn", @"givenName", nil]
|
||||
withFormat: @"N:%@;;;\r\n"
|
||||
toVCard: newVCard];
|
||||
[self _appendSingleVCardValue: @"telephoneNumber"
|
||||
withFormat: @"TEL;TYPE=work,voice,pref:%@\r\n"
|
||||
toVCard: newVCard];
|
||||
[self _appendSingleVCardValue: @"facsimileTelephoneNumber"
|
||||
withFormat: @"TEL;TYPE=work,fax:%@\r\n"
|
||||
toVCard: newVCard];
|
||||
[self _appendSingleVCardValue: @"homeTelephoneNumber"
|
||||
withFormat: @"TEL;TYPE=home,voice:%@\r\n"
|
||||
toVCard: newVCard];
|
||||
[self _appendSingleVCardValue: @"mobile"
|
||||
withFormat: @"TEL;TYPE=cell,voice:%@\r\n"
|
||||
toVCard: newVCard];
|
||||
[self _appendArrayedVCardValues:
|
||||
[NSArray arrayWithObjects: @"l", @"departmentNumber", nil]
|
||||
withFormat: @"ORG:%@\r\n"
|
||||
toVCard: newVCard];
|
||||
[self _appendMultilineVCardValue: @"postalAddress"
|
||||
withFormat: @"ADR:TYPE=work,postal:%@\r\n"
|
||||
toVCard: newVCard];
|
||||
[self _appendMultilineVCardValue: @"homePostalAddress"
|
||||
withFormat: @"ADR:TYPE=home,postal:%@\r\n"
|
||||
toVCard: newVCard];
|
||||
[self _appendSingleVCardValue: @"mail"
|
||||
withFormat: @"EMAIL;TYPE=internet,pref:%@\r\n"
|
||||
toVCard: newVCard];
|
||||
[self _appendSingleVCardValue: @"labelledURI"
|
||||
withFormat: @"URL:%@\r\n"
|
||||
toVCard: newVCard];
|
||||
|
||||
[newVCard appendString: @"END:VCARD\r\n"];
|
||||
|
||||
return newVCard;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user