Skip to content

Commit

Permalink
Fix for bug #2459
Browse files Browse the repository at this point in the history
  • Loading branch information
extrafu committed Oct 21, 2013
1 parent 656869a commit 189f221
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
1 change: 1 addition & 0 deletions SoObjects/Mailer/GNUmakefile
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions SoObjects/Mailer/NSString+Mail.h
@@ -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
Expand Down
27 changes: 18 additions & 9 deletions SoObjects/Mailer/NSString+Mail.m
@@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -97,6 +97,11 @@ - (id) init
return self;
}

- (xmlCharEncoding) contentEncoding
{
return XML_CHAR_ENCODING_UTF8;
}

- (void) dealloc
{
[ignoreContentTags release];
Expand Down Expand Up @@ -234,11 +239,12 @@ - (void) endElement: (NSString *) element
}

- (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
Expand Down Expand Up @@ -339,14 +345,17 @@ @implementation NSString (SOGoExtension)

- (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];
}
Expand Down

0 comments on commit 189f221

Please sign in to comment.