pull/13/head
Ludovic Marcotte 2013-10-21 15:26:43 -04:00
parent 656869a4a2
commit 189f2218a8
3 changed files with 20 additions and 12 deletions

View File

@ -92,6 +92,7 @@ Mailer_RESOURCE_FILES += \
ADDITIONAL_INCLUDE_DIRS += -I../../SOPE/
ADDITIONAL_INCLUDE_DIRS += $(shell xml2-config --cflags)
ADDITIONAL_LIB_DIRS += -L../../SOPE/GDLContentStore/obj/
-include GNUmakefile.preamble

View File

@ -1,8 +1,6 @@
/* NSString+Mail.h - this file is part of SOGo
*
* Copyright (C) 2007 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Copyright (C) 2007-2013 Inverse inc.
*
* 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

View File

@ -1,8 +1,6 @@
/* NSString+Mail.m - this file is part of SOGo
*
* Copyright (C) 2008 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Copyright (C) 2008-2013 Inverse inc.
*
* 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
@ -33,10 +31,12 @@
#import <NGExtensions/NSString+misc.h>
#import <NGExtensions/NSObject+Logs.h>
#include <libxml/encoding.h>
#import "NSString+Mail.h"
#import "NSData+Mail.h"
#if 1
#if 0
#define showWhoWeAre() \
[self logWithFormat: @"invoked '%@'", NSStringFromSelector (_cmd)]
#else
@ -97,6 +97,11 @@
return self;
}
- (xmlCharEncoding) contentEncoding
{
return XML_CHAR_ENCODING_UTF8;
}
- (void) dealloc
{
[ignoreContentTags release];
@ -234,11 +239,12 @@
}
- (void) characters: (unichar *) characters
length: (int) length
length: (NSUInteger) length
{
if (!ignoreContent)
[result appendString: [NSString stringWithCharacters: characters
length: length]];
{
[result appendString: [NSString stringWithCharacters: characters length: length]];
}
}
- (void) ignorableWhitespace: (unichar *) whitespaces
@ -339,14 +345,17 @@
- (NSString *) htmlToText
{
id <NSObject, SaxXMLReader> parser;
_SOGoHTMLToTextContentHandler *handler;
id <NSObject, SaxXMLReader> parser;
NSData *d;
parser = [[SaxXMLReaderFactory standardXMLReaderFactory]
createXMLReaderForMimeType: @"text/html"];
handler = [_SOGoHTMLToTextContentHandler htmlToTextContentHandler];
[parser setContentHandler: handler];
[parser parseFromSource: self];
d = [self dataUsingEncoding: NSUTF8StringEncoding];
[parser parseFromSource: d];
return [handler result];
}