[prev in list] [next in list] [prev in thread] [next in thread]
List: kmail-devel
Subject: [PATCH] kioslaves/imap4/imap.cc
From: Allen Winter <winter () kde ! org>
Date: 2006-04-26 17:35:43
Message-ID: 200604261335.47429.winter () kde ! org
[Download RAW message or body]
Howdy KMail Gurus,
Christoph Bartoschek's "Suspicious Code" led me to this patch for imap.cc in branches/KDE/3.5.
I'm not sure if I'm doing the right thing so please review.
Regards,
Allen
PS: sorry for all the whitespace diffs... not sure how to tell 'svn diff' to ignore whitespace
--
Let's Keep the Political Talk Out of KDE PLEASE
["imap4.cc.patch" (text/x-diff)]
Index: imap4.cc
===================================================================
--- imap4.cc (revision 533180)
+++ imap4.cc (working copy)
@@ -152,7 +152,7 @@
#ifdef HAVE_LIBSASL2
sasl_done();
#endif
-
+
return 0;
}
@@ -352,42 +352,44 @@
mailHeader *lastone = 0;
imapCache *cache = getLastHandled ();
if (cache)
+ {
lastone = cache->getHeader ();
- if (!cmd->isComplete ())
- {
- if ((aUpper.find ("BODYSTRUCTURE") != -1)
- || (aUpper.find ("FLAGS") != -1)
- || (aUpper.find ("UID") != -1)
- || (aUpper.find ("ENVELOPE") != -1)
- || (aUpper.find ("BODY.PEEK[0]") != -1
- && (aEnum == ITYPE_BOX || aEnum == ITYPE_DIR_AND_BOX)))
+ if (cmd && !cmd->isComplete ())
{
- if (aEnum == ITYPE_BOX || aEnum == ITYPE_DIR_AND_BOX)
+ if ((aUpper.find ("BODYSTRUCTURE") != -1)
+ || (aUpper.find ("FLAGS") != -1)
+ || (aUpper.find ("UID") != -1)
+ || (aUpper.find ("ENVELOPE") != -1)
+ || (aUpper.find ("BODY.PEEK[0]") != -1
+ && (aEnum == ITYPE_BOX || aEnum == ITYPE_DIR_AND_BOX)))
{
- // write the mime header (default is here message/rfc822)
- outputLine ("--IMAPDIGEST\r\n", 14);
- cacheOutput = true;
- if (cache->getUid () != 0)
- outputLineStr ("X-UID: " +
- QString::number(cache->getUid ()) + "\r\n");
- if (cache->getSize () != 0)
- outputLineStr ("X-Length: " +
- QString::number(cache->getSize ()) + "\r\n");
- if (!cache->getDate ().isEmpty())
- outputLineStr ("X-Date: " + cache->getDate () + "\r\n");
- if (cache->getFlags () != 0)
- outputLineStr ("X-Flags: " +
- QString::number(cache->getFlags ()) + "\r\n");
- } else cacheOutput = true;
- if ( lastone && !decodeContent )
- lastone->outputPart (*this);
- cacheOutput = false;
- flushOutput(contentEncoding);
- }
- } // if not complete
+ if (aEnum == ITYPE_BOX || aEnum == ITYPE_DIR_AND_BOX)
+ {
+ // write the mime header (default is here message/rfc822)
+ outputLine ("--IMAPDIGEST\r\n", 14);
+ cacheOutput = true;
+ if (cache->getUid () != 0)
+ outputLineStr ("X-UID: " +
+ QString::number(cache->getUid ()) + "\r\n");
+ if (cache->getSize () != 0)
+ outputLineStr ("X-Length: " +
+ QString::number(cache->getSize ()) + "\r\n");
+ if (!cache->getDate ().isEmpty())
+ outputLineStr ("X-Date: " + cache->getDate () + "\r\n");
+ if (cache->getFlags () != 0)
+ outputLineStr ("X-Flags: " +
+ QString::number(cache->getFlags ()) + "\r\n");
+ } else cacheOutput = true;
+ if ( lastone && !decodeContent )
+ lastone->outputPart (*this);
+ cacheOutput = false;
+ flushOutput(contentEncoding);
+ }
+ } // if not complete
+ } // if cache
}
- while (!cmd->isComplete ());
+ while (cmd && !cmd->isComplete ());
if (aEnum == ITYPE_BOX || aEnum == ITYPE_DIR_AND_BOX)
{
// write the end boundary
@@ -747,7 +749,7 @@
}
readBufferLen -= copyLen;
- if (readBufferLen)
+ if (readBufferLen)
memmove(readBuffer, &readBuffer[copyLen], readBufferLen);
if (buffer[buffer.size() - 1] == '\n') return TRUE;
}
@@ -945,10 +947,10 @@
if (type == ITYPE_BOX)
{
bool ask = ( aInfo.find( "ASKUSER" ) != -1 );
- if ( ask &&
+ if ( ask &&
messageBox(QuestionYesNo,
i18n("The following folder will be created on the server: %1 "
- "What do you want to store in this folder?").arg( aBox ),
+ "What do you want to store in this folder?").arg( aBox ),
i18n("Create Folder"),
i18n("&Messages"), i18n("&Subfolders")) == KMessageBox::No )
{
@@ -1212,7 +1214,7 @@
* No-op: data = 'N'
* Namespace: data = 'n'. Result shipped in infoMessage() signal
* The format is: section=namespace=delimiter
- * Note that the namespace can be empty
+ * Note that the namespace can be empty
* Unsubscribe: data = 'U' + URL (KURL)
* Subscribe: data = 'u' + URL (KURL)
* Change the status: data = 'S' + URL (KURL) + Flags (QCString)
@@ -1264,7 +1266,7 @@
break;
}
case 'n':
- {
+ {
// namespace in the form "section=namespace=delimiter"
// entries are separated by ,
infoMessage( imapNamespaces.join(",") );
@@ -1313,7 +1315,7 @@
finished();
break;
}
- case 'A':
+ case 'A':
{
// acl
int cmd;
@@ -1325,7 +1327,7 @@
}
break;
}
- case 'M':
+ case 'M':
{
// annotatemore
int cmd;
@@ -1337,7 +1339,7 @@
}
break;
}
- case 'S':
+ case 'S':
{
// status
KURL _url;
@@ -1374,7 +1376,7 @@
finished();
break;
}
- case 'E':
+ case 'E':
{
// search
specialSearchCommand( stream );
@@ -1665,7 +1667,7 @@
QString aBox, aSequence, aLType, aSection, aValidity, aDelimiter, aInfo;
// parseURL with caching
enum IMAP_TYPE aType =
- parseURL (_url, aBox, aSection, aLType, aSequence, aValidity, aDelimiter,
+ parseURL (_url, aBox, aSection, aLType, aSequence, aValidity, aDelimiter,
aInfo, true);
UDSEntry entry;
@@ -1961,7 +1963,7 @@
}
else
{
-#ifdef HAVE_LIBSASL2
+#ifdef HAVE_LIBSASL2
if (!clientAuthenticate (this, authInfo, myHost, myAuth, mySSL, resultInfo))
error(KIO::ERR_COULD_NOT_LOGIN, i18n("Unable to authenticate via %1.\n"
"The server %2 replied:\n%3").arg(myAuth).arg(myHost).arg(resultInfo));
@@ -1991,12 +1993,12 @@
if ( it != listResponses.end() )
{
namespaceToDelimiter[QString::null] = (*it).hierarchyDelimiter();
- kdDebug(7116) << "makeLogin - delimiter for empty ns='" <<
+ kdDebug(7116) << "makeLogin - delimiter for empty ns='" <<
(*it).hierarchyDelimiter() << "'" << endl;
if ( !hasCapability("NAMESPACE") )
{
// server does not support namespaces
- QString nsentry = QString::number( 0 ) + "=="
+ QString nsentry = QString::number( 0 ) + "=="
+ (*it).hierarchyDelimiter();
imapNamespaces.append( nsentry );
}
@@ -2325,7 +2327,7 @@
}
}
// if we got no list response for the box see if it's a prefix
- if ( retVal == ITYPE_UNKNOWN &&
+ if ( retVal == ITYPE_UNKNOWN &&
namespaceToDelimiter.contains(_box) ) {
retVal = ITYPE_DIR;
}
@@ -2343,7 +2345,7 @@
else
kdDebug(7116) << "IMAP4::parseURL: no login!" << endl;
- }
+ }
else // empty box
{
// the root is just a dir
@@ -2372,7 +2374,7 @@
if ( _hierarchyDelimiter.isEmpty() &&
(_type == "LIST" || _type == "LSUB" || _type == "LSUBNOCHECK") )
{
- // this shouldn't happen but when the delimiter is really empty
+ // this shouldn't happen but when the delimiter is really empty
// we try to reconstruct it from the URL
if (!_box.isEmpty())
{
_______________________________________________
KMail developers mailing list
KMail-devel@kde.org
https://mail.kde.org/mailman/listinfo/kmail-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic