mirror of
https://github.com/moparisthebest/davmail
synced 2025-01-07 03:38:05 -05:00
Start IMAP server, do not start servers if port is empty
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@300 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
b84a2974f0
commit
66029f92cb
@ -8,6 +8,7 @@ import davmail.ldap.LdapServer;
|
|||||||
import davmail.pop.PopServer;
|
import davmail.pop.PopServer;
|
||||||
import davmail.smtp.SmtpServer;
|
import davmail.smtp.SmtpServer;
|
||||||
import davmail.tray.DavGatewayTray;
|
import davmail.tray.DavGatewayTray;
|
||||||
|
import davmail.imap.ImapServer;
|
||||||
import org.apache.commons.httpclient.HttpClient;
|
import org.apache.commons.httpclient.HttpClient;
|
||||||
import org.apache.commons.httpclient.HttpStatus;
|
import org.apache.commons.httpclient.HttpStatus;
|
||||||
import org.apache.commons.httpclient.methods.GetMethod;
|
import org.apache.commons.httpclient.methods.GetMethod;
|
||||||
@ -25,6 +26,7 @@ public class DavGateway {
|
|||||||
|
|
||||||
private static SmtpServer smtpServer;
|
private static SmtpServer smtpServer;
|
||||||
private static PopServer popServer;
|
private static PopServer popServer;
|
||||||
|
private static ImapServer imapServer;
|
||||||
private static CaldavServer caldavServer;
|
private static CaldavServer caldavServer;
|
||||||
private static LdapServer ldapServer;
|
private static LdapServer ldapServer;
|
||||||
|
|
||||||
@ -49,19 +51,39 @@ public class DavGateway {
|
|||||||
try {
|
try {
|
||||||
// prepare HTTP connection pool
|
// prepare HTTP connection pool
|
||||||
DavGatewayHttpClientFacade.start();
|
DavGatewayHttpClientFacade.start();
|
||||||
smtpServer = new SmtpServer(Settings.getIntProperty("davmail.smtpPort"));
|
|
||||||
popServer = new PopServer(Settings.getIntProperty("davmail.popPort"));
|
|
||||||
caldavServer = new CaldavServer(Settings.getIntProperty("davmail.caldavPort"));
|
|
||||||
ldapServer = new LdapServer(Settings.getIntProperty("davmail.ldapPort"));
|
|
||||||
smtpServer.start();
|
|
||||||
popServer.start();
|
|
||||||
caldavServer.start();
|
|
||||||
ldapServer.start();
|
|
||||||
|
|
||||||
String message = "DavMail gateway listening on SMTP port " + smtpServer.getPort() +
|
String message = "DavMail gateway listening on";
|
||||||
", Caldav port " + caldavServer.getPort() +
|
int smtpPort = Settings.getIntProperty("davmail.smtpPort");
|
||||||
", LDAP port " + ldapServer.getPort() +
|
if (smtpPort != 0) {
|
||||||
" and POP port " + popServer.getPort();
|
smtpServer = new SmtpServer(smtpPort);
|
||||||
|
smtpServer.start();
|
||||||
|
message += " SMTP port " + smtpServer.getPort();
|
||||||
|
}
|
||||||
|
int popPort = Settings.getIntProperty("davmail.popPort");
|
||||||
|
if (popPort != 0) {
|
||||||
|
popServer = new PopServer(Settings.getIntProperty("davmail.popPort"));
|
||||||
|
popServer.start();
|
||||||
|
message += " POP port " + popServer.getPort();
|
||||||
|
}
|
||||||
|
int imapPort = Settings.getIntProperty("davmail.imapPort");
|
||||||
|
if (imapPort != 0) {
|
||||||
|
imapServer = new ImapServer(Settings.getIntProperty("davmail.imapPort"));
|
||||||
|
imapServer.start();
|
||||||
|
message += " IMAP port " + imapServer.getPort();
|
||||||
|
}
|
||||||
|
int caldavPort = Settings.getIntProperty("davmail.caldavPort");
|
||||||
|
if (caldavPort != 0) {
|
||||||
|
caldavServer = new CaldavServer(Settings.getIntProperty("davmail.caldavPort"));
|
||||||
|
caldavServer.start();
|
||||||
|
message += " Caldav port " + caldavServer.getPort();
|
||||||
|
}
|
||||||
|
int ldapPort = Settings.getIntProperty("davmail.ldapPort");
|
||||||
|
if (ldapPort != 0) {
|
||||||
|
ldapServer = new LdapServer(Settings.getIntProperty("davmail.ldapPort"));
|
||||||
|
ldapServer.start();
|
||||||
|
message += " LDAP port " + ldapServer.getPort();
|
||||||
|
}
|
||||||
|
|
||||||
DavGatewayTray.info(message);
|
DavGatewayTray.info(message);
|
||||||
|
|
||||||
// check for new version
|
// check for new version
|
||||||
@ -92,6 +114,7 @@ public class DavGateway {
|
|||||||
public static void stop() {
|
public static void stop() {
|
||||||
stopServer(smtpServer);
|
stopServer(smtpServer);
|
||||||
stopServer(popServer);
|
stopServer(popServer);
|
||||||
|
stopServer(imapServer);
|
||||||
stopServer(caldavServer);
|
stopServer(caldavServer);
|
||||||
stopServer(ldapServer);
|
stopServer(ldapServer);
|
||||||
// close pooled connections
|
// close pooled connections
|
||||||
|
Loading…
Reference in New Issue
Block a user