Update of /cvsroot/mahogany/M/src/classes
In directory usw-pr-cvs1:/tmp/cvs-serv32682a/src/classes
Modified Files:
MessageView.cpp
Log Message:
highlight the URLs in the headers as well
Index: MessageView.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/classes/MessageView.cpp,v
retrieving revision 1.86
retrieving revision 1.87
diff -b -u -2 -r1.86 -r1.87
--- MessageView.cpp 26 Apr 2002 23:28:09 -0000 1.86
+++ MessageView.cpp 3 May 2002 17:01:07 -0000 1.87
@@ -1121,4 +1121,11 @@
for ( ; n < countHeaders; n++ )
{
+ wxString value = headerValues[n];
+ if ( value.empty() )
+ {
+ // don't show empty headers at all
+ continue;
+ }
+
wxFontEncoding encHeader = (wxFontEncoding)headerEncodings[n];
@@ -1149,5 +1156,4 @@
}
- wxString value = headerValues[n];
#if 0
// does not work - EnsureAvailableTextEncoding for UTF-8 always succeeds
@@ -1163,5 +1169,77 @@
}
- m_viewer->ShowHeader(headerNames[n], value, encHeader);
+ // show the header and mark the URLs in it
+ String name = headerNames[n];
+ m_viewer->ShowHeaderName(name);
+
+ // don't highlight the message IDs which looks just like the URLs but,
+ // in fact, are not ones (the test catches Message-Id and Content-Id
+ // headers)
+ bool highlightURLs = m_ProfileValues.highlightURLs &&
+ !name.MakeUpper().Matches("*-ID");
+ do
+ {
+ String before,
+ url,
+ urlText;
+
+ if ( highlightURLs )
+ {
+ before = strutil_findurl(value, url);
+
+ if ( *url.c_str() == '<' )
+ {
+ // try to find the personal name as well by going backwards
+ // until we reach the previous address
+ bool inQuotes = false,
+ stop = false;
+
+ while ( !before.empty() )
+ {
+ char ch = before.Last();
+ switch ( ch )
+ {
+ case '"':
+ inQuotes = !inQuotes;
+ break;
+
+ case ',':
+ case ';':
+ if ( !inQuotes )
+ stop = true;
+ }
+
+ if ( stop )
+ break;
+
+ url.insert(0, 1, ch);
+ before.erase(before.length() - 1);
+ }
+ }
+ else // not a mail address
+ {
+ // use the URL itself as label
+ urlText = url;
+ }
+ }
+ else // no URL highlighting
+ {
+ before = value;
+ value.clear();
+ }
+
+ if ( !before.empty() )
+ {
+ m_viewer->ShowHeaderValue(before, encHeader);
+ }
+
+ if ( !url.empty() )
+ {
+ m_viewer->ShowHeaderURL(urlText, url);
+ }
+ }
+ while ( !value.empty() );
+
+ m_viewer->EndHeader();
}
@@ -1288,6 +1366,6 @@
}
- String url;
- String before;
+ String url,
+ before;
size_t levelBeforeURL = LEVEL_INVALID;
@@ -1444,5 +1522,6 @@
if ( !strutil_isempty(url) )
{
- m_viewer->InsertURL(url);
+ // we use the URL itself for text here
+ m_viewer->InsertURL(url, url);
}
}
_______________________________________________________________
Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates