mirror of
https://github.com/moparisthebest/davmail
synced 2025-02-28 09:21:49 -05:00
IMAP: fix 3480516, () instead of NIL on empty envelope header
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1886 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
dd9616ad7d
commit
94948efb73
@ -82,7 +82,7 @@ public class ImapConnection extends AbstractConnection {
|
|||||||
try {
|
try {
|
||||||
ExchangeSessionFactory.checkConfig();
|
ExchangeSessionFactory.checkConfig();
|
||||||
sendClient("* OK [" + capabilities + "] IMAP4rev1 DavMail " + DavGateway.getCurrentVersion() + " server ready");
|
sendClient("* OK [" + capabilities + "] IMAP4rev1 DavMail " + DavGateway.getCurrentVersion() + " server ready");
|
||||||
for (; ;) {
|
for (; ; ) {
|
||||||
line = readClient();
|
line = readClient();
|
||||||
// unable to read line, connection closed ?
|
// unable to read line, connection closed ?
|
||||||
if (line == null) {
|
if (line == null) {
|
||||||
@ -880,7 +880,7 @@ public class ImapConnection extends AbstractConnection {
|
|||||||
} else if ("CHARSET".equals(token)) {
|
} else if ("CHARSET".equals(token)) {
|
||||||
String charset = tokens.nextQuotedToken().toUpperCase();
|
String charset = tokens.nextQuotedToken().toUpperCase();
|
||||||
if (!("ASCII".equals(charset) || "UTF-8".equals(charset))) {
|
if (!("ASCII".equals(charset) || "UTF-8".equals(charset))) {
|
||||||
throw new IOException("Unsupported charset "+charset);
|
throw new IOException("Unsupported charset " + charset);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (condition == null) {
|
if (condition == null) {
|
||||||
@ -959,28 +959,32 @@ public class ImapConnection extends AbstractConnection {
|
|||||||
try {
|
try {
|
||||||
String unfoldedValue = MimeUtility.unfold(value[0]);
|
String unfoldedValue = MimeUtility.unfold(value[0]);
|
||||||
InternetAddress[] addresses = InternetAddress.parseHeader(unfoldedValue, false);
|
InternetAddress[] addresses = InternetAddress.parseHeader(unfoldedValue, false);
|
||||||
buffer.append('(');
|
if (addresses != null && addresses.length > 1) {
|
||||||
for (InternetAddress address : addresses) {
|
|
||||||
buffer.append('(');
|
buffer.append('(');
|
||||||
String personal = address.getPersonal();
|
for (InternetAddress address : addresses) {
|
||||||
if (personal != null) {
|
buffer.append('(');
|
||||||
appendEnvelopeHeaderValue(buffer, personal);
|
String personal = address.getPersonal();
|
||||||
} else {
|
if (personal != null) {
|
||||||
buffer.append("NIL");
|
appendEnvelopeHeaderValue(buffer, personal);
|
||||||
}
|
} else {
|
||||||
buffer.append(" NIL ");
|
buffer.append("NIL");
|
||||||
String mail = address.getAddress();
|
}
|
||||||
int atIndex = mail.indexOf('@');
|
buffer.append(" NIL ");
|
||||||
if (atIndex >= 0) {
|
String mail = address.getAddress();
|
||||||
buffer.append('"').append(mail.substring(0, atIndex)).append('"');
|
int atIndex = mail.indexOf('@');
|
||||||
buffer.append(' ');
|
if (atIndex >= 0) {
|
||||||
buffer.append('"').append(mail.substring(atIndex + 1)).append('"');
|
buffer.append('"').append(mail.substring(0, atIndex)).append('"');
|
||||||
} else {
|
buffer.append(' ');
|
||||||
buffer.append("NIL NIL");
|
buffer.append('"').append(mail.substring(atIndex + 1)).append('"');
|
||||||
|
} else {
|
||||||
|
buffer.append("NIL NIL");
|
||||||
|
}
|
||||||
|
buffer.append(')');
|
||||||
}
|
}
|
||||||
buffer.append(')');
|
buffer.append(')');
|
||||||
|
} else {
|
||||||
|
buffer.append("NIL");
|
||||||
}
|
}
|
||||||
buffer.append(')');
|
|
||||||
} catch (AddressException e) {
|
} catch (AddressException e) {
|
||||||
DavGatewayTray.warn(e);
|
DavGatewayTray.warn(e);
|
||||||
buffer.append("NIL");
|
buffer.append("NIL");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user