See ChangeLog
Monotone-Parent: 9b6ca5cb2b17f229443223ae6bb703c37ca1f0c3 Monotone-Revision: 95fd526cbec8bccb226bbd63d3442c7d12061aa3 Monotone-Author: ludovic@Sophos.ca Monotone-Date: 2011-06-16T17:04:00 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
8145059809
commit
310c6affbf
|
@ -1,3 +1,9 @@
|
|||
2011-06-16 Ludovic Marcotte <lmarcotte@inverse.ca>
|
||||
|
||||
* UI/Contacts/UIxContactFolderActions.m (importLdifData:):
|
||||
Fixed folded lines import and base64 encoded values. Patch
|
||||
from bug #1251
|
||||
|
||||
2011-06-16 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* Tools/SOGoToolRenameUser.m: new sogo-tool module that updates
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#import <NGObjWeb/WORequest.h>
|
||||
#import <NGExtensions/NSString+misc.h>
|
||||
#import <NGExtensions/NSNull+misc.h>
|
||||
#import <NGExtensions/NGBase64Coding.h>
|
||||
|
||||
#import <Contacts/SOGoContactObject.h>
|
||||
#import <Contacts/SOGoContactFolder.h>
|
||||
|
@ -154,30 +155,69 @@
|
|||
for (i = 0; i < count; i++)
|
||||
{
|
||||
SOGoContactLDIFEntry *ldifEntry;
|
||||
entry = [NSMutableDictionary dictionary];
|
||||
NSEnumerator *keyEnumerator;
|
||||
NSMutableDictionary *encodedEntry;
|
||||
encodedEntry = [NSMutableDictionary dictionary];
|
||||
lines = [[ldifContacts objectAtIndex: i]
|
||||
componentsSeparatedByString: @"\n"];
|
||||
|
||||
key = NULL;
|
||||
linesCount = [lines count];
|
||||
for (j = 0; j < linesCount; j++)
|
||||
{
|
||||
components = [[lines objectAtIndex: j]
|
||||
componentsSeparatedByString: @": "];
|
||||
NSString *line;
|
||||
line = [lines objectAtIndex: j];
|
||||
|
||||
/* skip embedded comment lines */
|
||||
if ([line hasPrefix: @"#"])
|
||||
{
|
||||
key = NULL;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* handle continuation lines */
|
||||
if ([line hasPrefix: @" "])
|
||||
{
|
||||
if (key != NULL)
|
||||
{
|
||||
value = [[encodedEntry valueForKey: key]
|
||||
stringByAppendingString: [line substringFromIndex: 1]];
|
||||
[encodedEntry setValue: value forKey: key];
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
components = [line componentsSeparatedByString: @": "];
|
||||
if ([components count] == 2)
|
||||
{
|
||||
key = [components objectAtIndex: 0];
|
||||
key = [[components objectAtIndex: 0] lowercaseString];
|
||||
value = [components objectAtIndex: 1];
|
||||
|
||||
if ([key length] == 0)
|
||||
key = @"dn";
|
||||
|
||||
[entry setObject: value forKey: [key lowercaseString]];
|
||||
[encodedEntry setValue: value forKey: key];
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* decode Base64-encoded attributes */
|
||||
entry = [NSMutableDictionary dictionary];
|
||||
keyEnumerator = [encodedEntry keyEnumerator];
|
||||
while ((key = [keyEnumerator nextObject]))
|
||||
{
|
||||
value = [encodedEntry valueForKey: key];
|
||||
if ([key hasSuffix: @":"])
|
||||
{
|
||||
key = [key substringToIndex: [key length] - 1];
|
||||
value = [value stringByDecodingBase64];
|
||||
}
|
||||
[entry setValue: value forKey: key];
|
||||
}
|
||||
|
||||
uid = [folder globallyUniqueObjectId];
|
||||
ldifEntry = [SOGoContactLDIFEntry contactEntryWithName: uid
|
||||
withLDIFEntry: entry
|
||||
|
|
Loading…
Reference in New Issue