summaryrefslogtreecommitdiffstats
path: root/libkmime
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2012-05-30 03:48:12 +0200
committerSlávek Banko <slavek.banko@axis.cz>2012-06-03 04:25:24 +0200
commitead8cb696e822d1975787df5da4c1767fcee1e0d (patch)
tree0bc2f3dd1e9766509ea6fa35abc8b144c040e483 /libkmime
parentb60e74f6ad5328170127d753620c9ead1a087bad (diff)
downloadtdepim-ead8cb696e822d1975787df5da4c1767fcee1e0d.tar.gz
tdepim-ead8cb696e822d1975787df5da4c1767fcee1e0d.zip
Fix long response time on large IMAP folders
This closes Bug 1009 Thanks to Francois Andriot for the patch! (cherry picked from commit b0c92b30a60f3290a9b8c393915bf623102d0fd6)
Diffstat (limited to 'libkmime')
-rw-r--r--libkmime/kmime_util.cpp41
1 files changed, 9 insertions, 32 deletions
diff --git a/libkmime/kmime_util.cpp b/libkmime/kmime_util.cpp
index c717f743..542a56bb 100644
--- a/libkmime/kmime_util.cpp
+++ b/libkmime/kmime_util.cpp
@@ -436,49 +436,26 @@ TQCString LFtoCRLF(const TQCString &s)
void removeQuots(TQCString &str)
{
- bool inQuote=false;
-
- for (int i=0; i < (int)str.length(); i++) {
- if (str[i] == '"') {
- str.remove(i,1);
- i--;
- inQuote = !inQuote;
- } else {
- if (inQuote && (str[i] == '\\'))
- str.remove(i,1);
- }
- }
+ str.replace(TQRegExp("\\\""), "\"");
+ str.replace(TQRegExp("\\\\"), "\\");
}
void removeQuots(TQString &str)
{
- bool inQuote=false;
-
- for (int i=0; i < (int)str.length(); i++) {
- if (str[i] == '"') {
- str.remove(i,1);
- i--;
- inQuote = !inQuote;
- } else {
- if (inQuote && (str[i] == '\\'))
- str.remove(i,1);
- }
- }
+ str.replace(TQRegExp("\\\""), "\"");
+ str.replace(TQRegExp("\\\\"), "\\");
}
void addQuotes(TQCString &str, bool forceQuotes)
{
bool needsQuotes=false;
- for (unsigned int i=0; i < str.length(); i++) {
- if (strchr("()<>@,.;:[]=\\\"",str[i])!=0)
- needsQuotes = true;
- if (str[i]=='\\' || str[i]=='\"') {
- str.insert(i, '\\');
- i++;
- }
- }
+ if ( TQString( str ) .contains( TQRegExp( TQString( "\"|\\\\|=|\\]|\\[|:|;|,|\\.|,|@|<|>|\\)|\\(" ) ) ) )
+ needsQuotes = true;
+
+ str.replace(TQRegExp("\\"), "\\\\");
+ str.replace(TQRegExp("\""), "\\\"");
if (needsQuotes || forceQuotes) {
str.insert(0,'\"');