sogo/UI/MailPartViewers/UIxMailPartTextViewer.m
Wolfgang Sourdeau f9a225549a Monotone-Parent: 0e5da06a5c5166a41629d40ff43cf8d9f3b4335c
Monotone-Revision: 0417738db917e76880a84c6d4e6d8721c51cd310

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-05-15T20:52:38
Monotone-Branch: ca.inverse.sogo
2007-05-15 20:52:38 +00:00

56 lines
1.6 KiB
Objective-C

/*
Copyright (C) 2004-2005 SKYRIX Software AG
This file is part of OpenGroupware.org.
OGo is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
OGo 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 Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public
License along with OGo; see the file COPYING. If not, write to the
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
/*
UIxMailPartTextViewer
Show plaintext mail parts correctly formatted.
TODO: add server side wrapping.
TODO: add contained link detection.
*/
#import <SoObjects/SOGo/NSString+Utilities.h>
#import "common.h"
#import "UIxMailPartTextViewer.h"
@implementation UIxMailPartTextViewer
- (NSString *) flatContentAsString
{
NSMutableString *content;
NSString *superContent, *urlText, *newUrlText;
NSRange httpRange, rest, currentURL;
unsigned int length;
content = [NSMutableString string];
superContent = [[super flatContentAsString] stringByEscapingHTMLString];
[content appendString: [superContent stringByDetectingURLs]];
[content replaceString: @"\r\n" withString: @"<br />"];
[content replaceString: @"\n" withString: @"<br />"];
return content;
}
@end /* UIxMailPartTextViewer */