1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-08-13 17:03:48 -04:00

Changed SMTP code to handle reply codes without additional text.

Fixes issue 2801
This commit is contained in:
cketti 2011-01-01 18:45:33 +00:00
parent 2d7bd5a341
commit fe724c8c79

View File

@ -496,27 +496,32 @@ public class SmtpTransport extends Transport
writeLine(command, sensitive);
}
boolean cont = false;
do
/*
* Read lines as long as the length is 4 or larger, e.g. "220-banner text here".
* Shorter lines are either errors of contain only a reply code. Those cases will
* be handled by checkLine() below.
*/
String line = readLine();
while (line.length() >= 4)
{
String line = readLine();
checkLine(line);
if (line.length() > 4)
{
// Everything after the first four characters goes into the results array.
results.add(line.substring(4));
if (line.charAt(3) == '-')
{
cont = true;
}
else
{
cont = false;
}
}
}
while (cont);
return results;
if (line.charAt(3) != '-')
{
// If the fourth character isn't "-" this is the last line of the response.
break;
}
line = readLine();
}
// Check if the reply code indicates an error.
checkLine(line);
return results;
}