1
0
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:
mguessan 2010-10-14 21:57:37 +00:00
parent fac66c021f
commit adfc4a8103
4 changed files with 25 additions and 20 deletions

View File

@ -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));
}
@ -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;
}
/**

View File

@ -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

View File

@ -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 ?

View File

@ -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 ?