Update of /cvsroot/mahogany/M/src/modules
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5616/src/modules
Modified Files:
HtmlViewer.cpp
Log Message:
really fixed forwarding/replying to HTML messages when using HTML viewer
Index: HtmlViewer.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/modules/HtmlViewer.cpp,v
retrieving revision 1.66
retrieving revision 1.67
diff -b -u -2 -r1.66 -r1.67
--- HtmlViewer.cpp 16 Jul 2004 23:48:26 -0000 1.66
+++ HtmlViewer.cpp 17 Jul 2004 22:19:39 -0000 1.67
@@ -795,4 +795,47 @@
}
+#ifdef USE_STRIP_TAGS
+
+static wxString StripHtmlTags(const wxString& html)
+{
+ wxString text;
+ text.reserve(html.length());
+
+ bool inTag = false,
+ inQuote = false;
+ for ( const wxChar *p = html.c_str(); *p; p++ )
+ {
+ if ( inTag )
+ {
+ if ( inQuote )
+ {
+ if ( *p == _T('"') )
+ inQuote = false;
+ }
+ else // not inside quoted text
+ {
+ if ( *p == _T('>') )
+ inTag = false;
+ else if ( *p == _T('"') )
+ inQuote = true;
+ }
+ }
+ else // not inside a tag, copy
+ {
+ if ( *p == _T('<') )
+ inTag = true;
+ else
+ text += *p;
+ }
+ }
+
+
+ // finally, replace all entities with their values
+ wxHtmlEntitiesParser entities;
+ return entities.Parse(text);
+}
+
+#endif // 0
+
void HtmlViewer::AddColourAttr(const wxChar *attr, const wxColour& col)
{
@@ -1078,4 +1121,10 @@
m_htmlText += pHtml;
}
+
+#ifdef USE_STRIP_TAGS
+ // we also have to extract all the text we have so that it could be included
+ // in the reply
+ m_msgView->OnBodyText(StripHtmlTags(data));
+#endif
}
@@ -1119,5 +1168,9 @@
#if wxCHECK_VERSION(2, 5, 2)
- m_msgView->OnBodyText(m_window->ToText());
+ String text(m_window->ToText());
+ size_t posEndHeaders = text.find("\n\n");
+ if ( posEndHeaders != String::npos )
+ text.erase(0, posEndHeaders + 2);
+ m_msgView->OnBodyText(text);
#endif
}
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates