Bug 1404049 - fix that mail.imap.use_literal_plus set to false may have no effect.

This is because it was only used in response to a CAPABILITY imap request. However, often CAPABILITY response occurs without a request so TB sees no need to do a request. Fix by moving the usage of use_literal_plus to where LITERAL+ capability is actually used.

Tag #1273
This commit is contained in:
Matt A. Tobin 2019-11-10 18:06:51 -05:00 committed by Roy Tam
commit f7f211f424

View file

@ -5418,14 +5418,6 @@ void nsImapProtocol::Capability()
nsresult rv = SendData(command.get());
if (NS_SUCCEEDED(rv))
ParseIMAPandCheckForNewMail();
if (!gUseLiteralPlus)
{
eIMAPCapabilityFlags capabilityFlag = GetServerStateParser().GetCapabilityFlag();
if (capabilityFlag & kLiteralPlusCapability)
{
GetServerStateParser().SetCapabilityFlag(capabilityFlag & ~kLiteralPlusCapability);
}
}
}
void nsImapProtocol::ID()
@ -6091,8 +6083,6 @@ void nsImapProtocol::UploadMessageFromFile (nsIFile* file,
nsresult rv;
bool eof = false;
nsCString flagString;
bool hasLiteralPlus = (GetServerStateParser().GetCapabilityFlag() &
kLiteralPlusCapability);
nsCOMPtr <nsIInputStream> fileInputStream;
@ -6155,7 +6145,13 @@ void nsImapProtocol::UploadMessageFromFile (nsIFile* file,
rv = NS_NewLocalFileInputStream(getter_AddRefs(fileInputStream), file);
if (NS_FAILED(rv) || !fileInputStream) goto done;
command.AppendInt((int32_t)fileSize);
if (hasLiteralPlus)
// Set useLiteralPlus to true if server has capability LITERAL+ and
// LITERAL+ useage is enabled in the config editor,
// i.e., "mail.imap.use_literal_plus" = true.
bool useLiteralPlus = (GetServerStateParser().GetCapabilityFlag() &
kLiteralPlusCapability) && gUseLiteralPlus;
if (useLiteralPlus)
command.Append("+}" CRLF);
else
command.Append("}" CRLF);
@ -6163,7 +6159,7 @@ void nsImapProtocol::UploadMessageFromFile (nsIFile* file,
rv = SendData(command.get());
if (NS_FAILED(rv)) goto done;
if (!hasLiteralPlus)
if (!useLiteralPlus)
ParseIMAPandCheckForNewMail();
totalSize = fileSize;