see changelog
Monotone-Parent: a9323afc29bd494143d2c78639e7a02f3d3804cb Monotone-Revision: 1af347fe96abc17587172e207fcbf80e98d7f6f8 Monotone-Author: ludovic@Sophos.ca Monotone-Date: 2008-08-22T13:52:24 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
c10afe743c
commit
98d6032638
|
@ -1,3 +1,9 @@
|
|||
2008-08-22 Ludovic Marcotte <lmarcotte@inverse.ca>
|
||||
|
||||
* Modified SoObjects/Mailer/NSData+Mail.m
|
||||
-decodedSubject so we correctly implement decoding
|
||||
instead of relying on the broken SOPE implementation.
|
||||
|
||||
2008-08-21 Ludovic Marcotte <lmarcotte@inverse.ca>
|
||||
|
||||
* SoObjects/SOGo/LDAPUserManager.m
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
/* NSData+Mail.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2007 Inverse groupe conseil
|
||||
* Copyright (C) 2007-2008 Inverse inc.
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
* Ludovic Marcotte <lmarcotte@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
|
||||
|
@ -56,7 +57,7 @@
|
|||
{
|
||||
const char *cData, *endFlag;
|
||||
unsigned int len;
|
||||
NSString *converted, *decodedSubject;
|
||||
NSString *decodedSubject;
|
||||
|
||||
cData = [self bytes];
|
||||
len = [self length];
|
||||
|
@ -70,14 +71,37 @@
|
|||
if (*cData == '=' && *(cData + 1) == '?'
|
||||
&& *endFlag == '?' && *(endFlag + 1) == '=')
|
||||
{
|
||||
converted
|
||||
= [[NSString alloc] initWithData: self
|
||||
encoding: NSASCIIStringEncoding];
|
||||
if (converted)
|
||||
NSString *enc;
|
||||
int i;
|
||||
|
||||
cData += 2;
|
||||
i = 2;
|
||||
|
||||
while (*cData != '?' && i < len)
|
||||
{
|
||||
[converted autorelease];
|
||||
decodedSubject = [converted stringByDecodingQuotedPrintable];
|
||||
cData++;
|
||||
i++;
|
||||
}
|
||||
|
||||
enc = [[[NSString alloc] initWithData:[self subdataWithRange: NSMakeRange(2, i-2)]
|
||||
encoding: NSASCIIStringEncoding] autorelease];
|
||||
|
||||
if (i+3 < len)
|
||||
{
|
||||
NSData *d;
|
||||
|
||||
d = [self subdataWithRange: NSMakeRange(i+3, len-i-5)];
|
||||
|
||||
// We check if we have a QP or Base64 encoding
|
||||
if (*(cData+1) == 'q' || *(cData+1) == 'Q')
|
||||
d = [d dataByDecodingQuotedPrintable];
|
||||
else
|
||||
d = [d dataByDecodingBase64];
|
||||
|
||||
decodedSubject = [NSString stringWithData: d usingEncodingNamed: enc];
|
||||
}
|
||||
else
|
||||
decodedSubject = nil;
|
||||
}
|
||||
}
|
||||
if (!decodedSubject)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* NSString+Mail.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2007 Inverse groupe conseil
|
||||
* Copyright (C) 2008 Inverse inc.
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
*
|
||||
|
@ -33,6 +33,7 @@
|
|||
#import <NGExtensions/NSObject+Logs.h>
|
||||
|
||||
#import "NSString+Mail.h"
|
||||
#import "NSData+Mail.h"
|
||||
|
||||
#if 1
|
||||
#define showWhoWeAre() \
|
||||
|
@ -369,7 +370,8 @@
|
|||
|
||||
if ([self hasPrefix: @"=?"] && [self hasSuffix: @"?="])
|
||||
{
|
||||
decodedSubject = [self stringByDecodingQuotedPrintable];
|
||||
decodedSubject = [[self dataUsingEncoding: NSASCIIStringEncoding]
|
||||
decodedSubject];
|
||||
if (!decodedSubject)
|
||||
decodedSubject = self;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* NSString+Utilities.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2006 Inverse groupe conseil
|
||||
* Copyright (C) 2006-2008 Inverse inc.
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
*
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#import <NGImap4/NGImap4Envelope.h>
|
||||
#import <NGImap4/NGImap4EnvelopeAddress.h>
|
||||
|
||||
#import <NGExtensions/NSString+Encoding.h>
|
||||
|
||||
#import <SoObjects/Mailer/NSData+Mail.h>
|
||||
#import <SoObjects/Mailer/NSString+Mail.h>
|
||||
|
||||
|
@ -154,7 +156,13 @@
|
|||
NSString *subject;
|
||||
|
||||
baseSubject = [[self envelope] subject];
|
||||
|
||||
// We avoid uber-lamenesses in SOPE - see sope-core/NGExtensions/NGQuotedPrintableCoding.m
|
||||
// -stringByDecodingQuotedPrintable for all details
|
||||
if ([baseSubject isKindOfClass: [NSString class]])
|
||||
baseSubject = [baseSubject dataUsingEncoding: NSASCIIStringEncoding];
|
||||
subject = [baseSubject decodedSubject];
|
||||
|
||||
if (![subject length])
|
||||
subject = [self labelForKey: @"Untitled"];
|
||||
|
||||
|
|
Loading…
Reference in New Issue