mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-13 03:02:22 -05:00
Add DavMail version in welcome IMAP and SMTP header
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1508 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
fac66c021f
commit
adfc4a8103
@ -154,7 +154,7 @@ public final class DavGateway {
|
||||
@Override
|
||||
public void run() {
|
||||
String releasedVersion = getReleasedVersion();
|
||||
if (currentVersion != null && releasedVersion != null && currentVersion.compareTo(releasedVersion) < 0) {
|
||||
if (currentVersion != null && currentVersion.length() > 0 && releasedVersion != null && currentVersion.compareTo(releasedVersion) < 0) {
|
||||
DavGatewayTray.info(new BundleMessage("LOG_NEW_VERSION_AVAILABLE", releasedVersion));
|
||||
}
|
||||
|
||||
@ -187,13 +187,13 @@ public final class DavGateway {
|
||||
|
||||
private static void stopServers() {
|
||||
for (AbstractServer server : SERVER_LIST) {
|
||||
server.close();
|
||||
try {
|
||||
server.join();
|
||||
} catch (InterruptedException e) {
|
||||
DavGatewayTray.warn(new BundleMessage("LOG_EXCEPTION_WAITING_SERVER_THREAD_DIE"), e);
|
||||
}
|
||||
}
|
||||
server.close();
|
||||
try {
|
||||
server.join();
|
||||
} catch (InterruptedException e) {
|
||||
DavGatewayTray.warn(new BundleMessage("LOG_EXCEPTION_WAITING_SERVER_THREAD_DIE"), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -203,7 +203,11 @@ public final class DavGateway {
|
||||
*/
|
||||
public static String getCurrentVersion() {
|
||||
Package davmailPackage = DavGateway.class.getPackage();
|
||||
return davmailPackage.getImplementationVersion();
|
||||
String currentVersion = davmailPackage.getImplementationVersion();
|
||||
if (currentVersion == null) {
|
||||
currentVersion = "";
|
||||
}
|
||||
return currentVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1158,8 +1158,7 @@ public class CaldavConnection extends AbstractConnection {
|
||||
public void sendHttpResponse(int status, Map<String, String> headers, String contentType, byte[] content, boolean keepAlive) throws IOException {
|
||||
sendClient("HTTP/1.1 " + status + ' ' + HttpStatus.getStatusText(status));
|
||||
if (status != HttpStatus.SC_UNAUTHORIZED) {
|
||||
String version = DavGateway.getCurrentVersion();
|
||||
sendClient("Server: DavMail Gateway " + (version == null ? "" : version));
|
||||
sendClient("Server: DavMail Gateway " + DavGateway.getCurrentVersion());
|
||||
sendClient("DAV: 1, calendar-access, calendar-schedule, calendarserver-private-events, addressbook");
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", Locale.ENGLISH);
|
||||
// force GMT timezone
|
||||
|
@ -22,6 +22,7 @@ import com.sun.mail.imap.protocol.BASE64MailboxDecoder;
|
||||
import com.sun.mail.imap.protocol.BASE64MailboxEncoder;
|
||||
import davmail.AbstractConnection;
|
||||
import davmail.BundleMessage;
|
||||
import davmail.DavGateway;
|
||||
import davmail.Settings;
|
||||
import davmail.exception.DavMailException;
|
||||
import davmail.exception.HttpForbiddenException;
|
||||
@ -80,7 +81,7 @@ public class ImapConnection extends AbstractConnection {
|
||||
IMAPTokenizer tokens;
|
||||
try {
|
||||
ExchangeSessionFactory.checkConfig();
|
||||
sendClient("* OK [" + capabilities + "] IMAP4rev1 DavMail server ready");
|
||||
sendClient("* OK [" + capabilities + "] IMAP4rev1 DavMail " + DavGateway.getCurrentVersion() + "server ready");
|
||||
for (; ;) {
|
||||
line = readClient();
|
||||
// unable to read line, connection closed ?
|
||||
@ -1016,9 +1017,9 @@ public class ImapConnection extends AbstractConnection {
|
||||
int charsetindex = contentType.indexOf("charset=");
|
||||
int nameindex = contentType.indexOf("name=");
|
||||
if (charsetindex >= 0 || nameindex >= 0) {
|
||||
buffer.append(" (");
|
||||
buffer.append(" (");
|
||||
|
||||
if (charsetindex >=0) {
|
||||
if (charsetindex >= 0) {
|
||||
buffer.append("\"CHARSET\" ");
|
||||
int charsetSemiColonIndex = contentType.indexOf(';', charsetindex);
|
||||
int charsetEndIndex;
|
||||
@ -1035,10 +1036,10 @@ public class ImapConnection extends AbstractConnection {
|
||||
if (!charSet.endsWith("\"")) {
|
||||
buffer.append('"');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nameindex >= 0) {
|
||||
if (charsetindex >=0) {
|
||||
if (nameindex >= 0) {
|
||||
if (charsetindex >= 0) {
|
||||
buffer.append(' ');
|
||||
}
|
||||
|
||||
@ -1058,7 +1059,7 @@ public class ImapConnection extends AbstractConnection {
|
||||
if (!name.endsWith("\"")) {
|
||||
buffer.append('"');
|
||||
}
|
||||
}
|
||||
}
|
||||
buffer.append(')');
|
||||
} else {
|
||||
buffer.append(" NIL");
|
||||
@ -1700,7 +1701,7 @@ public class ImapConnection extends AbstractConnection {
|
||||
nextToken.append(' ').append(super.nextToken());
|
||||
}
|
||||
while (hasMoreTokens() && nextToken.length() > 0 && nextToken.indexOf("[") != -1
|
||||
&& nextToken.charAt(nextToken.length() - 1) != ']') {
|
||||
&& nextToken.charAt(nextToken.length() - 1) != ']') {
|
||||
nextToken.append(' ').append(super.nextToken());
|
||||
}
|
||||
return nextToken.toString();
|
||||
|
@ -20,6 +20,7 @@ package davmail.smtp;
|
||||
|
||||
import davmail.AbstractConnection;
|
||||
import davmail.BundleMessage;
|
||||
import davmail.DavGateway;
|
||||
import davmail.exception.DavMailException;
|
||||
import davmail.exchange.DoubleDotInputStream;
|
||||
import davmail.exchange.ExchangeSessionFactory;
|
||||
@ -61,7 +62,7 @@ public class SmtpConnection extends AbstractConnection {
|
||||
|
||||
try {
|
||||
ExchangeSessionFactory.checkConfig();
|
||||
sendClient("220 DavMail SMTP ready at " + new Date());
|
||||
sendClient("220 DavMail "+ DavGateway.getCurrentVersion()+" SMTP ready at " + new Date());
|
||||
for (; ;) {
|
||||
line = readClient();
|
||||
// unable to read line, connection closed ?
|
||||
|
Loading…
Reference in New Issue
Block a user