Update of /cvsroot/mahogany/M/src/modules/viewflt
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16968/src/modules/viewflt
Modified Files:
QuoteURL.cpp
Log Message:
remember the first quoting character we find in the message and check only for it in
the rest of the message; although added more stringent checks for '*' as quote char
Index: QuoteURL.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/modules/viewflt/QuoteURL.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -b -u -2 -r1.20 -r1.21
--- QuoteURL.cpp 12 Sep 2004 21:54:47 -0000 1.20
+++ QuoteURL.cpp 12 Sep 2004 22:04:59 -0000 1.21
@@ -81,4 +81,6 @@
@param max_white max number of white characters before quotation mark
@param max_alpha max number of A-Z characters before quotation mark
+ @param quote the char used by quoting, NUL initially meaning unknown,
+ should be saved between function calls later
@return number of quoting levels (0 for unquoted text)
*/
@@ -88,5 +90,6 @@
int max_white,
int max_alpha,
- bool *nextWrapped);
+ bool *nextWrapped,
+ char& quote);
/**
@@ -167,5 +170,6 @@
size_t GetQuotedLevel(const char *line,
const char *prev,
- bool *nextWrapped) const;
+ bool *nextWrapped,
+ char& quote) const;
// get the colour for the given quote level
@@ -232,5 +236,6 @@
int max_white,
int max_alpha,
- bool *nextWrapped)
+ bool *nextWrapped,
+ char& quote)
{
*nextWrapped = false;
@@ -288,9 +293,29 @@
// first check if we have a quote character at all
+ if ( !quote )
+ {
+ // detect the quoting character used, and remember it for the rest of
+ // the message
+
// TODO: make the string of "quoting characters" configurable
static const char *QUOTE_CHARS = ">|})*";
+
if ( !strchr(QUOTE_CHARS, *c) )
break;
+ // '*' is too often used for other purposes, check that we really have
+ // something like a whole paragraph quoted with it before deciding
+ // that we really should accept it as a quoting character
+ if ( *next != *c )
+ break;
+
+ quote = *c;
+ }
+ else // we have already detected the quoting character used in this msg
+ {
+ if ( *c != quote )
+ break;
+ }
+
// check the previous line: if it was the same so far but differs now, we
// suppose that we have a numbered list which would be recognized as
@@ -304,7 +329,6 @@
// if this line has the same prefix as the previous one, it surely must
// be a continuation of a quoted paragraph
- // checks in case this is not true
bool isQuoted = (sameAsPrev == Line_Unknown || sameAsPrev == Line_Same)
- && *prev == *c;
+ && *c == quote;
// next check the next line
@@ -463,5 +487,6 @@
QuoteURLFilter::GetQuotedLevel(const char *line,
const char *prev,
- bool *nextWrapped) const
+ bool *nextWrapped,
+ char& quote) const
{
size_t qlevel = CountQuoteLevel
@@ -471,5 +496,6 @@
m_options.quotedMaxWhitespace,
m_options.quotedMaxAlpha,
- nextWrapped
+ nextWrapped,
+ quote
);
@@ -521,4 +547,5 @@
bool nextWrapped = false;
+ char quoteChar = '\0';
do
@@ -553,5 +580,5 @@
nextWrapped = false;
else
- level = GetQuotedLevel(before, NULL, &nextWrapped);
+ level = GetQuotedLevel(before, NULL, &nextWrapped, quoteChar);
}
@@ -574,5 +601,6 @@
else
{
- size_t levelNew = GetQuotedLevel(lineNext, lineCur, &nextWrapped);
+ size_t levelNew =
+ GetQuotedLevel(lineNext, lineCur, &nextWrapped, quoteChar);
if ( levelNew != level )
{
-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates