summaryrefslogtreecommitdiffstats
path: root/libemailfunctions/email.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libemailfunctions/email.cpp')
-rw-r--r--libemailfunctions/email.cpp52
1 files changed, 30 insertions, 22 deletions
diff --git a/libemailfunctions/email.cpp b/libemailfunctions/email.cpp
index acbfa2679..ec14800aa 100644
--- a/libemailfunctions/email.cpp
+++ b/libemailfunctions/email.cpp
@@ -112,7 +112,14 @@ KPIM::EmailParseResult splitAddressInternal( const QCString& address,
displayName = "";
addrSpec = "";
comment = "";
-
+
+ // these strings are later copied to displayName resp. addrSpec resp. comment
+ // we don't operate directly on those variables, since as ByteArray deriverates
+ // they have a miserable performance on operator+
+ QString dName;
+ QString aSpec;
+ QString cmmt;
+
if ( address.isEmpty() )
return KPIM::AddressEmpty;
@@ -130,26 +137,26 @@ KPIM::EmailParseResult splitAddressInternal( const QCString& address,
case TopLevel : {
switch ( *p ) {
case '"' : inQuotedString = !inQuotedString;
- displayName += *p;
+ dName += *p;
break;
case '(' : if ( !inQuotedString ) {
context = InComment;
commentLevel = 1;
}
else
- displayName += *p;
+ dName += *p;
break;
case '<' : if ( !inQuotedString ) {
context = InAngleAddress;
}
else
- displayName += *p;
+ dName += *p;
break;
case '\\' : // quoted character
- displayName += *p;
+ dName += *p;
++p; // skip the '\'
if ( *p )
- displayName += *p;
+ dName += *p;
else
return KPIM::UnexpectedEnd;
break;
@@ -161,57 +168,57 @@ KPIM::EmailParseResult splitAddressInternal( const QCString& address,
return KPIM::UnexpectedComma;
}
else
- displayName += *p;
+ dName += *p;
break;
- default : displayName += *p;
+ default : dName += *p;
}
break;
}
case InComment : {
switch ( *p ) {
case '(' : ++commentLevel;
- comment += *p;
+ cmmt += *p;
break;
case ')' : --commentLevel;
if ( commentLevel == 0 ) {
context = TopLevel;
- comment += ' '; // separate the text of several comments
+ cmmt += ' '; // separate the text of several comments
}
else
- comment += *p;
+ cmmt += *p;
break;
case '\\' : // quoted character
- comment += *p;
+ cmmt += *p;
++p; // skip the '\'
if ( *p )
- comment += *p;
+ cmmt += *p;
else
return KPIM::UnexpectedEnd;
break;
- default : comment += *p;
+ default : cmmt += *p;
}
break;
}
case InAngleAddress : {
switch ( *p ) {
case '"' : inQuotedString = !inQuotedString;
- addrSpec += *p;
+ aSpec += *p;
break;
case '>' : if ( !inQuotedString ) {
context = TopLevel;
}
else
- addrSpec += *p;
+ aSpec += *p;
break;
case '\\' : // quoted character
- addrSpec += *p;
+ aSpec += *p;
++p; // skip the '\'
if ( *p )
- addrSpec += *p;
+ aSpec += *p;
else
return KPIM::UnexpectedEnd;
break;
- default : addrSpec += *p;
+ default : aSpec += *p;
}
break;
}
@@ -225,9 +232,10 @@ KPIM::EmailParseResult splitAddressInternal( const QCString& address,
if ( context == InAngleAddress )
return KPIM::UnclosedAngleAddr;
- displayName = displayName.stripWhiteSpace();
- comment = comment.stripWhiteSpace();
- addrSpec = addrSpec.stripWhiteSpace();
+
+ displayName = dName.stripWhiteSpace().latin1();
+ comment = cmmt.stripWhiteSpace().latin1();
+ addrSpec = aSpec.stripWhiteSpace().latin1();
if ( addrSpec.isEmpty() ) {
if ( displayName.isEmpty() )