Improved false quote detection
This commit is contained in:
parent
4057aba5d0
commit
1e0e8d690e
@ -755,7 +755,9 @@ int TemplateToText(int mode, GMsg* msg, GMsg* oldmsg, const char* tpl, int origa
|
|||||||
std::replace(tempref.begin(), tempref.end(), CTRL_A, '@');
|
std::replace(tempref.begin(), tempref.end(), CTRL_A, '@');
|
||||||
quote = tempref.c_str();
|
quote = tempref.c_str();
|
||||||
|
|
||||||
if(is_quote(oldmsg->line[n]->txt.c_str())) {
|
// if(is_quote(oldmsg->line[n]->txt.c_str())) {
|
||||||
|
if (oldmsg->line[n]->type & GLINE_QUOT)
|
||||||
|
{
|
||||||
quote += GetQuotestr(quote, qbuf, &len);
|
quote += GetQuotestr(quote, qbuf, &len);
|
||||||
strbtrim(qbuf);
|
strbtrim(qbuf);
|
||||||
ptr = qbuf;
|
ptr = qbuf;
|
||||||
|
@ -339,11 +339,20 @@ int is_quote(const char* ptr) {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Check for userdefined quotechars after first whitespace
|
// Check for userdefined quotechars after first whitespace
|
||||||
if(IsQuoteChar(ptr))
|
if(IsQuoteChar(ptr))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
endptr = ptr + 11; // match 10 chars after whitespaces
|
endptr = ptr + 11; // match 10 chars after whitespaces
|
||||||
|
|
||||||
|
while (*ptr && !IsQuoteChar(ptr) &&
|
||||||
|
!iscntrl(*ptr) &&
|
||||||
|
!strchr(AA->Quotestops(), *ptr) &&
|
||||||
|
!isspace(*ptr)) ptr++;
|
||||||
|
|
||||||
|
if ((ptr < endptr) && IsQuoteChar(ptr))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
/*
|
||||||
int spaces = 0;
|
int spaces = 0;
|
||||||
while((ptr < endptr) and *ptr) {
|
while((ptr < endptr) and *ptr) {
|
||||||
|
|
||||||
@ -366,6 +375,7 @@ int is_quote(const char* ptr) {
|
|||||||
}
|
}
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -483,7 +493,7 @@ int GetQuotestr(const char* ptr, char* qbuf, uint* qlen) {
|
|||||||
|
|
||||||
const char* lp = ptr;
|
const char* lp = ptr;
|
||||||
int n, x;
|
int n, x;
|
||||||
|
/*
|
||||||
for(;;) {
|
for(;;) {
|
||||||
|
|
||||||
// Skip leading spaces
|
// Skip leading spaces
|
||||||
@ -512,6 +522,11 @@ int GetQuotestr(const char* ptr, char* qbuf, uint* qlen) {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
while (isspace(*lp) or issoftcr(*lp)) lp++;
|
||||||
|
while (!IsQuoteChar(lp)) lp++;
|
||||||
|
while (IsQuoteChar(lp)) lp++;
|
||||||
|
|
||||||
// lp now points to the character after the quotestring
|
// lp now points to the character after the quotestring
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user