mirror of
https://github.com/moparisthebest/davmail
synced 2025-02-28 09:21:49 -05:00
I18N: externalize all DavGatewayTray log statements for i18n
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@535 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
974edf0ee3
commit
ce864c36c6
@ -71,13 +71,12 @@ public class AbstractConnection extends Thread {
|
||||
* @throws IOException on error
|
||||
*/
|
||||
public void sendClient(String prefix, String message) throws IOException {
|
||||
StringBuilder logBuffer = new StringBuilder("> ");
|
||||
if (prefix != null) {
|
||||
logBuffer.append(prefix);
|
||||
os.write(prefix.getBytes());
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_SEND_CLIENT_PREFIX_MESSAGE", prefix, message));
|
||||
} else {
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_SEND_CLIENT_MESSAGE", message));
|
||||
}
|
||||
logBuffer.append(message);
|
||||
DavGatewayTray.debug(logBuffer.toString());
|
||||
os.write(message.getBytes());
|
||||
os.write((char) 13);
|
||||
os.write((char) 10);
|
||||
@ -121,20 +120,20 @@ public class AbstractConnection extends Thread {
|
||||
String line = in.readLine();
|
||||
if (line != null) {
|
||||
if (line.startsWith("PASS")) {
|
||||
DavGatewayTray.debug("< PASS ********");
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_READ_CLIENT_PASS"));
|
||||
// IMAP LOGIN
|
||||
} else if (state == State.INITIAL && line.indexOf(' ') >= 0 &&
|
||||
line.substring(line.indexOf(' ') + 1).startsWith("LOGIN")) {
|
||||
DavGatewayTray.debug("< LOGIN ********");
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_READ_CLIENT_LOGIN"));
|
||||
} else if (state == State.PASSWORD) {
|
||||
DavGatewayTray.debug("< ********");
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_READ_CLIENT_PASSWORD"));
|
||||
// HTTP Basic Authentication
|
||||
} else if (line.startsWith("Authorization:")) {
|
||||
DavGatewayTray.debug("< Authorization: ********");
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_READ_CLIENT_AUTHORIZATION"));
|
||||
} else if (line.startsWith("AUTH PLAIN")) {
|
||||
DavGatewayTray.debug("< AUTH PLAIN ********");
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_READ_CLIENT_AUTH_PLAIN"));
|
||||
} else {
|
||||
DavGatewayTray.debug("< " + line);
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_READ_CLIENT_LINE", line));
|
||||
}
|
||||
}
|
||||
DavGatewayTray.switchIcon();
|
||||
|
@ -54,6 +54,8 @@ public class DavGateway {
|
||||
// prepare HTTP connection pool
|
||||
DavGatewayHttpClientFacade.start();
|
||||
|
||||
serverList.clear();
|
||||
|
||||
int smtpPort = Settings.getIntProperty("davmail.smtpPort");
|
||||
if (smtpPort != 0) {
|
||||
serverList.add(new SmtpServer(smtpPort));
|
||||
@ -90,7 +92,7 @@ public class DavGateway {
|
||||
}
|
||||
}
|
||||
|
||||
DavGatewayTray.info(message.toString());
|
||||
DavGatewayTray.info(new BundleMessage("LOG_MESSAGE", message.toString()));
|
||||
if (errorMessage.length() > 0) {
|
||||
DavGatewayTray.error(new BundleMessage("LOG_SOCKET_BIND_FAILED", errorMessage.toString()));
|
||||
}
|
||||
@ -125,6 +127,7 @@ public class DavGateway {
|
||||
}
|
||||
|
||||
public static String getReleasedVersion() {
|
||||
long start = System.currentTimeMillis();
|
||||
String version = null;
|
||||
BufferedReader versionReader = null;
|
||||
HttpClient httpClient = DavGatewayHttpClientFacade.getInstance();
|
||||
@ -148,6 +151,7 @@ public class DavGateway {
|
||||
}
|
||||
getMethod.releaseConnection();
|
||||
}
|
||||
System.out.println("Elapsed time: "+(System.currentTimeMillis()-start)+" ms");
|
||||
return version;
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package davmail.caldav;
|
||||
|
||||
import davmail.AbstractConnection;
|
||||
import davmail.Settings;
|
||||
import davmail.BundleMessage;
|
||||
import davmail.exchange.ExchangeSession;
|
||||
import davmail.exchange.ExchangeSessionFactory;
|
||||
import davmail.exchange.ICSBufferedReader;
|
||||
@ -37,7 +38,7 @@ public class CaldavConnection extends AbstractConnection {
|
||||
|
||||
// Initialize the streams and start the thread
|
||||
public CaldavConnection(Socket clientSocket) {
|
||||
super("CaldavConnection", clientSocket, "UTF-8");
|
||||
super(CaldavConnection.class.getName(), clientSocket, "UTF-8");
|
||||
wireLogger.setLevel(Settings.getLoggingLevel("httpclient.wire"));
|
||||
}
|
||||
|
||||
@ -94,7 +95,7 @@ public class CaldavConnection extends AbstractConnection {
|
||||
keepAlive = MAX_KEEP_ALIVE_TIME;
|
||||
}
|
||||
client.setSoTimeout(keepAlive * 1000);
|
||||
DavGatewayTray.debug("Set socket timeout to " + keepAlive + " seconds");
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_SET_SOCKET_TIMEOUT", keepAlive));
|
||||
}
|
||||
}
|
||||
|
||||
@ -142,15 +143,15 @@ public class CaldavConnection extends AbstractConnection {
|
||||
DavGatewayTray.resetIcon();
|
||||
}
|
||||
} catch (SocketTimeoutException e) {
|
||||
DavGatewayTray.debug("Closing connection on timeout");
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_CLOSE_CONNECTION_ON_TIMEOUT"));
|
||||
} catch (SocketException e) {
|
||||
DavGatewayTray.debug("Connection closed");
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_CONNECTION_CLOSED"));
|
||||
} catch (Exception e) {
|
||||
DavGatewayTray.error(e);
|
||||
try {
|
||||
sendErr(e);
|
||||
} catch (IOException e2) {
|
||||
DavGatewayTray.debug("Exception sending error to client", e2);
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_EXCEPTION_SENDING_ERROR_TO_CLIENT"), e2);
|
||||
}
|
||||
} finally {
|
||||
close();
|
||||
@ -258,7 +259,7 @@ public class CaldavConnection extends AbstractConnection {
|
||||
int size = events.size();
|
||||
int count = 0;
|
||||
for (ExchangeSession.Event event : events) {
|
||||
DavGatewayTray.debug("Listing event " + (++count) + "/" + size);
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_LISTING_EVENT", ++count, size));
|
||||
DavGatewayTray.switchIcon();
|
||||
appendEventResponse(response, request, event);
|
||||
}
|
||||
@ -383,9 +384,9 @@ public class CaldavConnection extends AbstractConnection {
|
||||
response.startMultistatus();
|
||||
appendInbox(response, request, null);
|
||||
if (request.getDepth() == 1) {
|
||||
DavGatewayTray.debug("Searching calendar messages...");
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_SEARCHING_CALENDAR_MESSAGES"));
|
||||
List<ExchangeSession.Event> events = session.getEventMessages(request.getExchangeFolderPath());
|
||||
DavGatewayTray.debug("Found " + events.size() + " calendar messages");
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_FOUND_CALENDAR_MESSAGES", events.size()));
|
||||
appendEventsResponses(response, request, events);
|
||||
}
|
||||
response.endMultistatus();
|
||||
@ -406,9 +407,9 @@ public class CaldavConnection extends AbstractConnection {
|
||||
response.startMultistatus();
|
||||
appendCalendar(response, request, null);
|
||||
if (request.getDepth() == 1) {
|
||||
DavGatewayTray.debug("Searching calendar events at " + folderPath + " ...");
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_SEARCHING_CALENDAR_EVENTS", folderPath));
|
||||
List<ExchangeSession.Event> events = session.getAllEvents(folderPath);
|
||||
DavGatewayTray.debug("Found " + events.size() + " calendar events");
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_FOUND_CALENDAR_EVENTS", events.size()));
|
||||
appendEventsResponses(response, request, events);
|
||||
}
|
||||
response.endMultistatus();
|
||||
@ -443,7 +444,7 @@ public class CaldavConnection extends AbstractConnection {
|
||||
int count = 0;
|
||||
int total = request.getHrefs().size();
|
||||
for (String href : request.getHrefs()) {
|
||||
DavGatewayTray.debug("Report event " + (++count) + "/" + total);
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_REPORT_EVENT", ++count, total));
|
||||
DavGatewayTray.switchIcon();
|
||||
try {
|
||||
String eventName = getEventFileNameFromPath(href);
|
||||
@ -455,7 +456,7 @@ public class CaldavConnection extends AbstractConnection {
|
||||
appendEventResponse(response, request, session.getEvent(folderPath, eventName));
|
||||
}
|
||||
} catch (HttpException e) {
|
||||
DavGatewayTray.warn("Event not found:" + href);
|
||||
DavGatewayTray.warn(new BundleMessage("LOG_EVENT_NOT_FOUND", href));
|
||||
notFound.add(href);
|
||||
}
|
||||
}
|
||||
@ -645,10 +646,9 @@ public class CaldavConnection extends AbstractConnection {
|
||||
}
|
||||
|
||||
public void sendUnsupported(CaldavRequest request) throws IOException {
|
||||
StringBuilder message = new StringBuilder();
|
||||
message.append("Unsupported request: ").append(request.toString());
|
||||
DavGatewayTray.error(message.toString());
|
||||
sendErr(HttpStatus.SC_BAD_REQUEST, message.toString());
|
||||
BundleMessage message = new BundleMessage("LOG_UNSUPORTED_REQUEST",request);
|
||||
DavGatewayTray.error(message);
|
||||
sendErr(HttpStatus.SC_BAD_REQUEST, message.format());
|
||||
}
|
||||
|
||||
public void sendErr(int status, String message) throws IOException {
|
||||
@ -902,7 +902,7 @@ public class CaldavConnection extends AbstractConnection {
|
||||
try {
|
||||
depth = Integer.valueOf(depthValue);
|
||||
} catch (NumberFormatException e) {
|
||||
DavGatewayTray.warn("Invalid depth value: " + depthValue);
|
||||
DavGatewayTray.warn(new BundleMessage("LOG_INVALID_DEPTH", depthValue));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package davmail.http;
|
||||
|
||||
import davmail.Settings;
|
||||
import davmail.BundleMessage;
|
||||
import davmail.ui.tray.DavGatewayTray;
|
||||
import org.apache.commons.httpclient.*;
|
||||
import org.apache.commons.httpclient.auth.AuthPolicy;
|
||||
@ -165,7 +166,7 @@ public final class DavGatewayHttpClientFacade {
|
||||
public static HttpMethod executeFollowRedirects(HttpClient httpClient, HttpMethod method) throws IOException {
|
||||
HttpMethod currentMethod = method;
|
||||
try {
|
||||
DavGatewayTray.debug("executeFollowRedirects: " + currentMethod.getURI());
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_EXECUTE_FOLLOW_REDIRECTS", currentMethod.getURI()));
|
||||
httpClient.executeMethod(currentMethod);
|
||||
Header location = currentMethod.getResponseHeader("Location");
|
||||
int redirectCount = 0;
|
||||
@ -175,7 +176,7 @@ public final class DavGatewayHttpClientFacade {
|
||||
currentMethod.releaseConnection();
|
||||
currentMethod = new GetMethod(location.getValue());
|
||||
currentMethod.setFollowRedirects(false);
|
||||
DavGatewayTray.debug("executeFollowRedirects: " + currentMethod.getURI() + " redirectCount:" + redirectCount);
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_EXECUTE_FOLLOW_REDIRECTS_COUNT", currentMethod.getURI(), redirectCount));
|
||||
httpClient.executeMethod(currentMethod);
|
||||
location = currentMethod.getResponseHeader("Location");
|
||||
}
|
||||
@ -305,7 +306,7 @@ public final class DavGatewayHttpClientFacade {
|
||||
if (multiThreadedHttpConnectionManager == null) {
|
||||
multiThreadedHttpConnectionManager = new MultiThreadedHttpConnectionManager();
|
||||
multiThreadedHttpConnectionManager.getParams().setDefaultMaxConnectionsPerHost(100);
|
||||
httpConnectionManagerThread = new Thread("HttpConnectionManager") {
|
||||
httpConnectionManagerThread = new Thread(HttpConnectionManager.class.getName()) {
|
||||
@Override public void run() {
|
||||
boolean terminated = false;
|
||||
while (!terminated) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package davmail.http;
|
||||
|
||||
import davmail.Settings;
|
||||
import davmail.BundleMessage;
|
||||
import davmail.ui.tray.DavGatewayTray;
|
||||
import org.apache.commons.httpclient.HttpsURL;
|
||||
import org.apache.commons.httpclient.params.HttpConnectionParams;
|
||||
@ -41,7 +42,7 @@ public class DavGatewaySSLProtocolSocketFactory implements SecureProtocolSocketF
|
||||
new Protocol(protocol, (ProtocolSocketFactory)new DavGatewaySSLProtocolSocketFactory(), port));
|
||||
}
|
||||
} catch (MalformedURLException e) {
|
||||
DavGatewayTray.error("Exception handling url: " + urlString);
|
||||
DavGatewayTray.error(new BundleMessage("LOG_INVALID_URL", urlString));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package davmail.http;
|
||||
|
||||
import davmail.Settings;
|
||||
import davmail.BundleMessage;
|
||||
import davmail.ui.tray.DavGatewayTray;
|
||||
import davmail.ui.AcceptCertificateDialog;
|
||||
|
||||
@ -61,7 +62,7 @@ public class DavGatewayX509TrustManager implements X509TrustManager {
|
||||
// if user already accepted a certificate,
|
||||
if (acceptedCertificateHash != null && acceptedCertificateHash.length() > 0
|
||||
&& acceptedCertificateHash.equals(certificateHash)) {
|
||||
DavGatewayTray.debug("Found permanently accepted certificate, hash " + acceptedCertificateHash);
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_FOUND_ACCEPTED_CERTIFICATE", acceptedCertificateHash));
|
||||
} else {
|
||||
boolean isCertificateTrusted;
|
||||
if (Settings.getBooleanProperty("davmail.server")) {
|
||||
@ -82,29 +83,33 @@ public class DavGatewayX509TrustManager implements X509TrustManager {
|
||||
protected boolean isCertificateTrusted(X509Certificate certificate) {
|
||||
BufferedReader inReader = new BufferedReader(new InputStreamReader(System.in));
|
||||
String answer = null;
|
||||
while (!"y".equals(answer) && !"Y".equals(answer) && !"n".equals(answer) && !"N".equals(answer) ) {
|
||||
System.out.println("Server Certificate:");
|
||||
System.out.println("Issued to: " + DavGatewayX509TrustManager.getRDN(certificate.getSubjectDN()));
|
||||
System.out.println("Issued by: " + getRDN(certificate.getIssuerDN()));
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy");
|
||||
String notBefore = formatter.format(certificate.getNotBefore());
|
||||
System.out.println("Valid from: " + notBefore);
|
||||
String notAfter = formatter.format(certificate.getNotAfter());
|
||||
System.out.println("Valid until: " + notAfter);
|
||||
System.out.println("Serial: " + getFormattedSerial(certificate));
|
||||
String sha1Hash = DavGatewayX509TrustManager.getFormattedHash(certificate);
|
||||
System.out.println("FingerPrint: " + sha1Hash);
|
||||
System.out.println();
|
||||
System.out.println("Server provided an untrusted certificate,");
|
||||
System.out.println("you can choose to accept or deny access.");
|
||||
System.out.println("Accept certificate (y/n)?");
|
||||
String yes = BundleMessage.format("UI_ANSWER_YES");
|
||||
String no = BundleMessage.format("UI_ANSWER_NO");
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
buffer.append(BundleMessage.format("UI_SERVER_CERTIFICATE")).append(":\n");
|
||||
buffer.append(BundleMessage.format("UI_ISSUED_TO")).append(": ")
|
||||
.append(DavGatewayX509TrustManager.getRDN(certificate.getSubjectDN())).append('\n');
|
||||
buffer.append(BundleMessage.format("UI_ISSUED_BY")).append(": ")
|
||||
.append(getRDN(certificate.getIssuerDN())).append('\n');
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy");
|
||||
String notBefore = formatter.format(certificate.getNotBefore());
|
||||
buffer.append(BundleMessage.format("UI_VALID_FROM")).append(": ").append(notBefore).append('\n');
|
||||
String notAfter = formatter.format(certificate.getNotAfter());
|
||||
buffer.append(BundleMessage.format("UI_VALID_UNTIL")).append(": ").append(notAfter).append('\n');
|
||||
buffer.append(BundleMessage.format("UI_SERIAL")).append(": ").append(getFormattedSerial(certificate)).append('\n');
|
||||
String sha1Hash = DavGatewayX509TrustManager.getFormattedHash(certificate);
|
||||
buffer.append(BundleMessage.format("UI_FINGERPRINT")).append(": ").append(sha1Hash).append('\n');
|
||||
buffer.append('\n');
|
||||
buffer.append(BundleMessage.format("UI_UNTRUSTED_CERTIFICATE")).append('\n');
|
||||
while (!yes.equals(answer) && !no.equals(answer)) {
|
||||
System.out.println(buffer.toString());
|
||||
try {
|
||||
answer = inReader.readLine();
|
||||
answer = inReader.readLine().toLowerCase();
|
||||
} catch (IOException e) {
|
||||
System.err.println(e);
|
||||
}
|
||||
}
|
||||
return "y".equals(answer) || "Y".equals(answer);
|
||||
return yes.equals(answer);
|
||||
}
|
||||
|
||||
public static String getRDN(Principal principal) {
|
||||
|
@ -3,6 +3,7 @@ package davmail.imap;
|
||||
import com.sun.mail.imap.protocol.BASE64MailboxDecoder;
|
||||
import com.sun.mail.imap.protocol.BASE64MailboxEncoder;
|
||||
import davmail.AbstractConnection;
|
||||
import davmail.BundleMessage;
|
||||
import davmail.exchange.ExchangeSession;
|
||||
import davmail.exchange.ExchangeSessionFactory;
|
||||
import davmail.ui.tray.DavGatewayTray;
|
||||
@ -31,7 +32,7 @@ public class ImapConnection extends AbstractConnection {
|
||||
|
||||
// Initialize the streams and start the thread
|
||||
public ImapConnection(Socket clientSocket) {
|
||||
super("ImapConnection", clientSocket, null);
|
||||
super(ImapConnection.class.getName(), clientSocket, null);
|
||||
}
|
||||
|
||||
@Override public void run() {
|
||||
@ -231,7 +232,7 @@ public class ImapConnection extends AbstractConnection {
|
||||
}
|
||||
conditions.append(")");
|
||||
String query = conditions.query.toString();
|
||||
DavGatewayTray.debug("Search: " + conditions.query);
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_SEARCH_QUERY", conditions.query));
|
||||
if ("AND ()".equals(query)) {
|
||||
query = null;
|
||||
}
|
||||
@ -360,7 +361,7 @@ public class ImapConnection extends AbstractConnection {
|
||||
sendClient(commandId + " OK APPEND completed");
|
||||
} else if ("noop".equalsIgnoreCase(command) || "check".equalsIgnoreCase(command)) {
|
||||
if (currentFolder != null) {
|
||||
DavGatewayTray.debug(command + " on " + currentFolder.folderName);
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_IMAP_COMMAND", command, currentFolder.folderName));
|
||||
currentFolder = session.getFolder(currentFolder.folderName);
|
||||
currentFolder.loadMessages();
|
||||
sendClient("* " + currentFolder.size() + " EXISTS");
|
||||
@ -428,32 +429,26 @@ public class ImapConnection extends AbstractConnection {
|
||||
|
||||
os.flush();
|
||||
} catch (SocketTimeoutException e) {
|
||||
DavGatewayTray.debug("Closing connection on timeout");
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_CLOSE_CONNECTION_ON_TIMEOUT"));
|
||||
try {
|
||||
sendClient("* BYE Closing connection");
|
||||
} catch (IOException e1) {
|
||||
DavGatewayTray.debug("Exception closing connection on timeout");
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_EXCEPTION_CLOSING_CONNECTION_ON_TIMEOUT"));
|
||||
}
|
||||
} catch (SocketException e) {
|
||||
DavGatewayTray.debug("Connection closed");
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_CONNECTION_CLOSED"));
|
||||
} catch (Exception e) {
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
if (e.getMessage() != null) {
|
||||
buffer.append(e.getMessage());
|
||||
} else {
|
||||
buffer.append(e);
|
||||
}
|
||||
String message = buffer.toString();
|
||||
DavGatewayTray.error(e);
|
||||
try {
|
||||
String message = (e.getMessage()==null)?e.toString():e.getMessage();
|
||||
if (commandId != null) {
|
||||
sendClient(commandId + " BAD unable to handle request: " + message);
|
||||
} else {
|
||||
sendClient("* BYE unable to handle request: " + message);
|
||||
}
|
||||
} catch (IOException e2) {
|
||||
DavGatewayTray.warn("Exception sending error to client", e2);
|
||||
DavGatewayTray.warn(new BundleMessage("LOG_EXCEPTION_SENDING_ERROR_TO_CLIENT"), e2);
|
||||
}
|
||||
DavGatewayTray.error("Exception handling client: " + message, e);
|
||||
} finally {
|
||||
close();
|
||||
}
|
||||
@ -528,7 +523,7 @@ public class ImapConnection extends AbstractConnection {
|
||||
message.write(bodyOutputStream);
|
||||
rfc822size = bodyOutputStream.size;
|
||||
baos.close();
|
||||
DavGatewayTray.debug("Message RFC822 size: " + rfc822size + " buffer size:" + baos.size());
|
||||
|
||||
if (bodystructure) {
|
||||
// Apple Mail: need to build full bodystructure
|
||||
appendBodyStructure(buffer, baos);
|
||||
|
@ -278,7 +278,7 @@ public class LdapConnection extends AbstractConnection {
|
||||
|
||||
// Initialize the streams and start the thread
|
||||
public LdapConnection(Socket clientSocket) {
|
||||
super(LdapConnection.class.getName() + '-' + clientSocket.getPort(), clientSocket);
|
||||
super(LdapConnection.class.getName(), clientSocket);
|
||||
try {
|
||||
is = new BufferedInputStream(client.getInputStream());
|
||||
os = new BufferedOutputStream(client.getOutputStream());
|
||||
@ -522,7 +522,7 @@ public class LdapConnection extends AbstractConnection {
|
||||
} else {
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_LDAP_REQ_SEARCH_ANONYMOUS_ACCESS_FORBIDDEN", currentMessageId, dn));
|
||||
}
|
||||
} else if (dn != null && dn.length() > 0){
|
||||
} else if (dn != null && dn.length() > 0) {
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_LDAP_REQ_SEARCH_INVALID_DN", currentMessageId, dn));
|
||||
}
|
||||
|
||||
@ -752,7 +752,7 @@ public class LdapConnection extends AbstractConnection {
|
||||
}
|
||||
|
||||
protected String hostName() throws UnknownHostException {
|
||||
return InetAddress.getLocalHost().getCanonicalHostName();
|
||||
return InetAddress.getLocalHost().getCanonicalHostName();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,7 @@
|
||||
package davmail.pop;
|
||||
|
||||
import davmail.AbstractConnection;
|
||||
import davmail.BundleMessage;
|
||||
import davmail.exchange.ExchangeSession;
|
||||
import davmail.exchange.ExchangeSessionFactory;
|
||||
import davmail.ui.tray.DavGatewayTray;
|
||||
@ -22,7 +23,7 @@ public class PopConnection extends AbstractConnection {
|
||||
|
||||
// Initialize the streams and start the thread
|
||||
public PopConnection(Socket clientSocket) {
|
||||
super("PopConnection", clientSocket, null);
|
||||
super(PopConnection.class.getName(), clientSocket, null);
|
||||
}
|
||||
|
||||
protected long getTotalMessagesLength() {
|
||||
@ -112,7 +113,7 @@ public class PopConnection extends AbstractConnection {
|
||||
state = State.AUTHENTICATED;
|
||||
} catch (SocketException e) {
|
||||
// can not send error to client after a socket exception
|
||||
DavGatewayTray.warn("Client closed connection ", e);
|
||||
DavGatewayTray.warn(new BundleMessage("LOG_CLIENT_CLOSED_CONNECTION"), e);
|
||||
} catch (Exception e) {
|
||||
DavGatewayTray.error(e);
|
||||
sendERR(e);
|
||||
@ -172,30 +173,30 @@ public class PopConnection extends AbstractConnection {
|
||||
sendClient(".");
|
||||
} catch (SocketException e) {
|
||||
// can not send error to client after a socket exception
|
||||
DavGatewayTray.warn("Client closed connection ", e);
|
||||
DavGatewayTray.warn(new BundleMessage("LOG_CLIENT_CLOSED_CONNECTION"), e);
|
||||
} catch (Exception e) {
|
||||
DavGatewayTray.error("Error retreiving message", e);
|
||||
DavGatewayTray.error(new BundleMessage("LOG_ERROR_RETRIEVING_MESSAGE"), e);
|
||||
sendERR("error retreiving message " + e + " " + e.getMessage());
|
||||
}
|
||||
} else {
|
||||
sendERR("invalid message number");
|
||||
sendERR("invalid message index");
|
||||
}
|
||||
} else if ("DELE".equalsIgnoreCase(command)) {
|
||||
if (tokens.hasMoreTokens()) {
|
||||
ExchangeSession.Message message;
|
||||
try {
|
||||
int messageNumber = Integer.valueOf(tokens.
|
||||
nextToken()) - 1;
|
||||
messages.get(messageNumber).moveToTrash();
|
||||
message = messages.get(messageNumber);
|
||||
message.moveToTrash();
|
||||
sendOK("DELETE");
|
||||
} catch (SocketException e) {
|
||||
// can not send error to client after a socket exception
|
||||
DavGatewayTray.warn("Client closed connection ", e);
|
||||
} catch (Exception e) {
|
||||
DavGatewayTray.error("Error deleting message", e);
|
||||
sendERR("error deleting message");
|
||||
} catch (NumberFormatException e) {
|
||||
sendERR("invalid message index");
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
sendERR("invalid message index");
|
||||
}
|
||||
} else {
|
||||
sendERR("invalid message number");
|
||||
sendERR("invalid message index");
|
||||
}
|
||||
} else if ("TOP".equalsIgnoreCase(command)) {
|
||||
int message = 0;
|
||||
@ -207,14 +208,13 @@ public class PopConnection extends AbstractConnection {
|
||||
m.write(new TopOutputStream(os, lines));
|
||||
sendClient("");
|
||||
sendClient(".");
|
||||
} catch (SocketException e) {
|
||||
// can not send error to client after a socket exception
|
||||
DavGatewayTray.warn("Client closed connection ", e);
|
||||
} catch (NumberFormatException e) {
|
||||
sendERR("invalid command");
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
sendERR("Invalid message index: " + message);
|
||||
sendERR("invalid message index: " + message);
|
||||
} catch (Exception e) {
|
||||
sendERR("error retreiving top of messages");
|
||||
DavGatewayTray.error(e.getMessage(), e);
|
||||
DavGatewayTray.error(e);
|
||||
}
|
||||
} else if ("RSET".equalsIgnoreCase(command)) {
|
||||
sendOK("RSET");
|
||||
@ -229,12 +229,14 @@ public class PopConnection extends AbstractConnection {
|
||||
|
||||
os.flush();
|
||||
}
|
||||
} catch (SocketException e) {
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_CONNECTION_CLOSED"));
|
||||
} catch (Exception e) {
|
||||
DavGatewayTray.error(e);
|
||||
try {
|
||||
sendERR(e.getMessage());
|
||||
} catch (IOException e2) {
|
||||
DavGatewayTray.debug("Exception sending error to client", e2);
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_EXCEPTION_SENDING_ERROR_TO_CLIENT"), e2);
|
||||
}
|
||||
} finally {
|
||||
close();
|
||||
|
@ -1,6 +1,7 @@
|
||||
package davmail.smtp;
|
||||
|
||||
import davmail.AbstractConnection;
|
||||
import davmail.BundleMessage;
|
||||
import davmail.exchange.ExchangeSessionFactory;
|
||||
import davmail.ui.tray.DavGatewayTray;
|
||||
|
||||
@ -21,7 +22,7 @@ public class SmtpConnection extends AbstractConnection {
|
||||
|
||||
// Initialize the streams and start the thread
|
||||
public SmtpConnection(Socket clientSocket) {
|
||||
super("SmtpConnection", clientSocket, null);
|
||||
super(SmtpConnection.class.getName(), clientSocket, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -117,7 +118,7 @@ public class SmtpConnection extends AbstractConnection {
|
||||
state = State.AUTHENTICATED;
|
||||
sendClient("250 Queued mail for delivery");
|
||||
} catch (Exception e) {
|
||||
DavGatewayTray.error("Authentication failed", e);
|
||||
DavGatewayTray.error(e);
|
||||
state = State.AUTHENTICATED;
|
||||
sendClient("451 Error : " + e + " " + e.getMessage());
|
||||
}
|
||||
@ -136,13 +137,13 @@ public class SmtpConnection extends AbstractConnection {
|
||||
}
|
||||
|
||||
} catch (SocketException e) {
|
||||
DavGatewayTray.debug("Connection closed");
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_CONNECTION_CLOSED"));
|
||||
} catch (Exception e) {
|
||||
DavGatewayTray.error(e);
|
||||
try {
|
||||
sendClient("500 " + ((e.getMessage()==null)?e:e.getMessage()));
|
||||
} catch (IOException e2) {
|
||||
DavGatewayTray.debug("Exception sending error to client", e2);
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_EXCEPTION_SENDING_ERROR_TO_CLIENT"), e2);
|
||||
}
|
||||
} finally {
|
||||
close();
|
||||
|
@ -1,6 +1,7 @@
|
||||
package davmail.ui;
|
||||
|
||||
import davmail.DavGateway;
|
||||
import davmail.BundleMessage;
|
||||
import davmail.ui.tray.DavGatewayTray;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
@ -24,7 +25,7 @@ public class AboutFrame extends JFrame {
|
||||
|
||||
public AboutFrame() {
|
||||
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
setTitle("About DavMail Gateway");
|
||||
setTitle(BundleMessage.format("UI_ABOUT_DAVMAIL"));
|
||||
setIconImage(DavGatewayTray.getFrameIcon());
|
||||
try {
|
||||
JLabel imageLabel = new JLabel();
|
||||
@ -37,7 +38,7 @@ public class AboutFrame extends JFrame {
|
||||
imagePanel.add(imageLabel);
|
||||
add(BorderLayout.WEST, imagePanel);
|
||||
} catch (IOException e) {
|
||||
DavGatewayTray.error("Unable to create icon", e);
|
||||
DavGatewayTray.error(new BundleMessage("LOG_UNABLE_TO_CREATE_ICON"), e);
|
||||
}
|
||||
|
||||
jEditorPane = new JEditorPane();
|
||||
@ -46,7 +47,7 @@ public class AboutFrame extends JFrame {
|
||||
stylesheet.addRule("body { font-size:small;font-family: " + jEditorPane.getFont().getFamily() + "}");
|
||||
jEditorPane.setEditorKit(htmlEditorKit);
|
||||
jEditorPane.setContentType("text/html");
|
||||
jEditorPane.setText(getContent());
|
||||
jEditorPane.setText(getContent(null));
|
||||
|
||||
jEditorPane.setEditable(false);
|
||||
jEditorPane.setOpaque(false);
|
||||
@ -56,7 +57,7 @@ public class AboutFrame extends JFrame {
|
||||
try {
|
||||
DesktopBrowser.browse(hle.getURL().toURI());
|
||||
} catch (URISyntaxException e) {
|
||||
DavGatewayTray.error("Unable to open link", e);
|
||||
DavGatewayTray.error(new BundleMessage("LOG_UNABLE_TO_OPEN_LINK"), e);
|
||||
}
|
||||
dispose();
|
||||
}
|
||||
@ -69,7 +70,7 @@ public class AboutFrame extends JFrame {
|
||||
add(BorderLayout.CENTER, mainPanel);
|
||||
|
||||
JPanel buttonPanel = new JPanel();
|
||||
JButton ok = new JButton("OK");
|
||||
JButton ok = new JButton(BundleMessage.format("UI_BUTTON_OK"));
|
||||
ActionListener close = new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
dispose();
|
||||
@ -90,34 +91,24 @@ public class AboutFrame extends JFrame {
|
||||
getSize().height / 2);
|
||||
}
|
||||
|
||||
String getContent() {
|
||||
String getContent(String releasedVersion) {
|
||||
Package davmailPackage = DavGateway.class.getPackage();
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
buffer.append("<html><b>DavMail Gateway</b><br>");
|
||||
buffer.append("By Mickaël Guessant<br><br>");
|
||||
buffer.append(BundleMessage.format("UI_ABOUT_DAVMAIL_AUTHOR"));
|
||||
String currentVersion = davmailPackage.getImplementationVersion();
|
||||
if (currentVersion != null) {
|
||||
buffer.append("Current version: ").append(currentVersion).append("<br>");
|
||||
buffer.append(BundleMessage.format("UI_CURRENT_VERSION", currentVersion));
|
||||
}
|
||||
String releasedVersion = DavGateway.getReleasedVersion();
|
||||
if (currentVersion != null && releasedVersion != null && currentVersion.compareTo(releasedVersion) < 0) {
|
||||
buffer.append("Latest version available: ").append(releasedVersion).append("<br>" +
|
||||
"A new version of DavMail Gateway is available.<br>" +
|
||||
"<a href=\"http://sourceforge.net/project/platformdownload.php?group_id=184600\">Download latest version</a><br>");
|
||||
buffer.append(BundleMessage.format("UI_LATEST_VERSION", releasedVersion));
|
||||
}
|
||||
buffer.append("<br>Help and setup instructions available at:<br>" +
|
||||
"<a href=\"http://davmail.sourceforge.net\">http://davmail.sourceforge.net</a><br>" +
|
||||
"<br>" +
|
||||
"To send comments or report bugs, <br>use <a href=\"http://sourceforge.net/tracker/?group_id=184600\">" +
|
||||
"DavMail Sourceforge trackers</a><br>" +
|
||||
"or contact me at <a href=\"mailto:mguessan@free.fr\">mguessan@free.fr</a>" +
|
||||
"</html>");
|
||||
buffer.append(BundleMessage.format("UI_HELP_INSTRUCTIONS"));
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
|
||||
public void update() {
|
||||
jEditorPane.setText(getContent());
|
||||
jEditorPane.setText(getContent(DavGateway.getReleasedVersion()));
|
||||
pack();
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ package davmail.ui;
|
||||
|
||||
import davmail.http.DavGatewayX509TrustManager;
|
||||
import davmail.ui.tray.DavGatewayTray;
|
||||
import davmail.BundleMessage;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@ -38,36 +39,36 @@ public class AcceptCertificateDialog extends JDialog {
|
||||
String sha1Hash = DavGatewayX509TrustManager.getFormattedHash(certificate);
|
||||
DateFormat formatter = DateFormat.getDateInstance(DateFormat.MEDIUM);
|
||||
|
||||
setTitle("DavMail: Accept certificate ?");
|
||||
setTitle(BundleMessage.format("UI_ACCEPT_CERTIFICATE"));
|
||||
try {
|
||||
setIconImage(DavGatewayTray.getFrameIcon());
|
||||
} catch (NoSuchMethodError error) {
|
||||
DavGatewayTray.debug("Unable to set JDialog icon image (not available under Java 1.5)");
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_UNABLE_TO_SET_ICON_IMAGE"));
|
||||
}
|
||||
|
||||
JPanel subjectPanel = new JPanel();
|
||||
subjectPanel.setLayout(new BoxLayout(subjectPanel, BoxLayout.Y_AXIS));
|
||||
subjectPanel.setBorder(BorderFactory.createTitledBorder("Server Certificate"));
|
||||
addFieldValue(subjectPanel, "Issued to", DavGatewayX509TrustManager.getRDN(certificate.getSubjectDN()));
|
||||
addFieldValue(subjectPanel, "Issued by", DavGatewayX509TrustManager.getRDN(certificate.getIssuerDN()));
|
||||
subjectPanel.setBorder(BorderFactory.createTitledBorder(BundleMessage.format("UI_SERVER_CERTIFICATE")));
|
||||
addFieldValue(subjectPanel, BundleMessage.format("UI_ISSUED_TO"), DavGatewayX509TrustManager.getRDN(certificate.getSubjectDN()));
|
||||
addFieldValue(subjectPanel, BundleMessage.format("UI_ISSUED_BY"), DavGatewayX509TrustManager.getRDN(certificate.getIssuerDN()));
|
||||
Date now = new Date();
|
||||
String notBefore = formatter.format(certificate.getNotBefore());
|
||||
if (now.before(certificate.getNotBefore())) {
|
||||
notBefore = "<html><font color=\"#FF0000\">"+notBefore+"</font></html>";
|
||||
}
|
||||
addFieldValue(subjectPanel, "Valid from", notBefore);
|
||||
addFieldValue(subjectPanel, BundleMessage.format("UI_VALID_FROM"), notBefore);
|
||||
String notAfter = formatter.format(certificate.getNotAfter());
|
||||
if (now.after(certificate.getNotAfter())) {
|
||||
notAfter = "<html><font color=\"#FF0000\">"+notAfter+"</font></html>";
|
||||
}
|
||||
addFieldValue(subjectPanel, "Valid until", notAfter);
|
||||
addFieldValue(subjectPanel, "Serial", DavGatewayX509TrustManager.getFormattedSerial(certificate));
|
||||
addFieldValue(subjectPanel, "FingerPrint", sha1Hash);
|
||||
addFieldValue(subjectPanel, BundleMessage.format("UI_VALID_UNTIL"), notAfter);
|
||||
addFieldValue(subjectPanel, BundleMessage.format("UI_SERIAL"), DavGatewayX509TrustManager.getFormattedSerial(certificate));
|
||||
addFieldValue(subjectPanel, BundleMessage.format("UI_FINGERPRINT"), sha1Hash);
|
||||
|
||||
JPanel warningPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||
JLabel imageLabel = new JLabel();
|
||||
imageLabel.setIcon(UIManager.getIcon("OptionPane.warningIcon"));
|
||||
imageLabel.setText("<html><b>Server provided an untrusted certificate,<br> you can choose to accept or deny access</b></html>");
|
||||
imageLabel.setText(BundleMessage.format("UI_UNTRUSTED_CERTIFICATE_HTML"));
|
||||
warningPanel.add(imageLabel);
|
||||
add(warningPanel, BorderLayout.NORTH);
|
||||
add(subjectPanel, BorderLayout.CENTER);
|
||||
@ -85,8 +86,8 @@ public class AcceptCertificateDialog extends JDialog {
|
||||
|
||||
protected JPanel getButtonPanel() {
|
||||
JPanel buttonPanel = new JPanel();
|
||||
JButton accept = new JButton("Accept");
|
||||
JButton deny = new JButton("Deny");
|
||||
JButton accept = new JButton(BundleMessage.format("UI_BUTTON_ACCEPT"));
|
||||
JButton deny = new JButton(BundleMessage.format("UI_BUTTON_DENY"));
|
||||
accept.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
accepted = true;
|
||||
@ -116,9 +117,9 @@ public class AcceptCertificateDialog extends JDialog {
|
||||
}
|
||||
});
|
||||
} catch (InterruptedException ie) {
|
||||
DavGatewayTray.error("Error waiting for certificate check", ie);
|
||||
DavGatewayTray.error(new BundleMessage("UI_ERROR_WAITING_FOR_CERTIFICATE_CHECK"), ie);
|
||||
} catch (InvocationTargetException ite) {
|
||||
DavGatewayTray.error("Error waiting for certificate check", ite);
|
||||
DavGatewayTray.error(new BundleMessage("UI_ERROR_WAITING_FOR_CERTIFICATE_CHECK"), ite);
|
||||
}
|
||||
|
||||
return answer[0];
|
||||
|
@ -1,6 +1,7 @@
|
||||
package davmail.ui;
|
||||
|
||||
import davmail.ui.tray.DavGatewayTray;
|
||||
import davmail.BundleMessage;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
@ -21,13 +22,13 @@ public final class DesktopBrowser {
|
||||
// Open link in default browser
|
||||
AwtDesktopBrowser.browse(location);
|
||||
} catch (ClassNotFoundException e) {
|
||||
DavGatewayTray.debug("Java 6 Desktop class not available");
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_JAVA6_DESKTOP_UNAVAILABLE"));
|
||||
// failover for MacOSX
|
||||
if (System.getProperty("os.name").toLowerCase().startsWith("mac os x")) {
|
||||
try {
|
||||
OSXDesktopBrowser.browse(location);
|
||||
} catch (Exception e2) {
|
||||
DavGatewayTray.error("Unable to open link", e2);
|
||||
DavGatewayTray.error(new BundleMessage("LOG_UNABLE_TO_OPEN_LINK"), e2);
|
||||
}
|
||||
} else {
|
||||
// failover : try SWT
|
||||
@ -37,13 +38,13 @@ public final class DesktopBrowser {
|
||||
classloader.loadClass("org.eclipse.swt.program.Program");
|
||||
SwtDesktopBrowser.browse(location);
|
||||
} catch (ClassNotFoundException e2) {
|
||||
DavGatewayTray.error("Open link not supported (tried AWT Desktop and SWT Program");
|
||||
DavGatewayTray.error(new BundleMessage("LOG_OPEN_LINK_NOT_SUPPORTED"));
|
||||
} catch (Exception e2) {
|
||||
DavGatewayTray.error("Unable to open link", e2);
|
||||
DavGatewayTray.error(new BundleMessage("LOG_UNABLE_TO_OPEN_LINK"), e2);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
DavGatewayTray.error("Unable to open link", e);
|
||||
DavGatewayTray.error(new BundleMessage("LOG_UNABLE_TO_OPEN_LINK"), e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,7 +52,7 @@ public final class DesktopBrowser {
|
||||
try {
|
||||
DesktopBrowser.browse(new URI(location));
|
||||
} catch (URISyntaxException e) {
|
||||
DavGatewayTray.error("Unable to open link", e);
|
||||
DavGatewayTray.error(new BundleMessage("LOG_UNABLE_TO_OPEN_LINK"), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ package davmail.ui;
|
||||
|
||||
import davmail.DavGateway;
|
||||
import davmail.Settings;
|
||||
import davmail.BundleMessage;
|
||||
import davmail.ui.tray.DavGatewayTray;
|
||||
import org.apache.log4j.Level;
|
||||
|
||||
@ -86,7 +87,7 @@ public class SettingsFrame extends JFrame {
|
||||
|
||||
protected JPanel getSettingsPanel() {
|
||||
JPanel settingsPanel = new JPanel(new GridLayout(6, 2));
|
||||
settingsPanel.setBorder(BorderFactory.createTitledBorder("Gateway"));
|
||||
settingsPanel.setBorder(BorderFactory.createTitledBorder(BundleMessage.format("UI_GATEWAY")));
|
||||
|
||||
urlField = new JTextField(Settings.getProperty("davmail.url"), 17);
|
||||
popPortField = new JTextField(Settings.getProperty("davmail.popPort"), 4);
|
||||
@ -139,40 +140,40 @@ public class SettingsFrame extends JFrame {
|
||||
}
|
||||
});
|
||||
|
||||
addSettingComponent(settingsPanel, "OWA url: ", urlField, "Base outlook web access URL");
|
||||
addPortSettingComponent(settingsPanel, "Local POP port: ", popPortField, popPortCheckBox,
|
||||
"Local POP server port to configure in POP client");
|
||||
addPortSettingComponent(settingsPanel, "Local IMAP port: ", imapPortField, imapPortCheckBox,
|
||||
"Local IMAP server port to configure in IMAP client");
|
||||
addPortSettingComponent(settingsPanel, "Local SMTP port: ", smtpPortField, smtpPortCheckBox,
|
||||
"Local SMTP server port to configure in POP client");
|
||||
addPortSettingComponent(settingsPanel, "Caldav HTTP port: ", caldavPortField, caldavPortCheckBox,
|
||||
"Local Caldav server port to configure in Caldav (calendar) client");
|
||||
addPortSettingComponent(settingsPanel, "Local LDAP port: ", ldapPortField, ldapPortCheckBox,
|
||||
"Local LDAP server port to configure in add directory (addresse book) client");
|
||||
addSettingComponent(settingsPanel, BundleMessage.format("UI_OWA_URL"), urlField, BundleMessage.format("UI_OWA_URL_HELP"));
|
||||
addPortSettingComponent(settingsPanel, BundleMessage.format("UI_POP_PORT"), popPortField, popPortCheckBox,
|
||||
BundleMessage.format("UI_POP_PORT_HELP"));
|
||||
addPortSettingComponent(settingsPanel, BundleMessage.format("UI_IMAP_PORT"), imapPortField, imapPortCheckBox,
|
||||
BundleMessage.format("UI_IMAP_PORT_HELP"));
|
||||
addPortSettingComponent(settingsPanel, BundleMessage.format("UI_SMTP_PORT"), smtpPortField, smtpPortCheckBox,
|
||||
BundleMessage.format("UI_SMTP_PORT_HELP"));
|
||||
addPortSettingComponent(settingsPanel, BundleMessage.format("UI_CALDAV_PORT"), caldavPortField, caldavPortCheckBox,
|
||||
BundleMessage.format("UI_CALDAV_PORT_HELP"));
|
||||
addPortSettingComponent(settingsPanel, BundleMessage.format("UI_LDAP_PORT"), ldapPortField, ldapPortCheckBox,
|
||||
BundleMessage.format("UI_LDAP_PORT_HELP"));
|
||||
return settingsPanel;
|
||||
}
|
||||
|
||||
protected JPanel getDelaysPanel() {
|
||||
JPanel delaysPanel = new JPanel(new GridLayout(3, 2));
|
||||
delaysPanel.setBorder(BorderFactory.createTitledBorder("Delays"));
|
||||
delaysPanel.setBorder(BorderFactory.createTitledBorder(BundleMessage.format("UI_DELAYS")));
|
||||
|
||||
keepDelayField = new JTextField(Settings.getProperty("davmail.keepDelay"), 4);
|
||||
sentKeepDelayField = new JTextField(Settings.getProperty("davmail.sentKeepDelay"), 4);
|
||||
caldavPastDelayField = new JTextField(Settings.getProperty("davmail.caldavPastDelay"), 4);
|
||||
|
||||
addSettingComponent(delaysPanel, "Keep delay: ", keepDelayField,
|
||||
"Number of days to keep messages in trash");
|
||||
addSettingComponent(delaysPanel, "Sent keep delay: ", sentKeepDelayField,
|
||||
"Number of days to keep messages in sent folder");
|
||||
addSettingComponent(delaysPanel, "Calendar past events: ", caldavPastDelayField,
|
||||
"Get events in the past not older than specified days count, leave empty for no limits");
|
||||
addSettingComponent(delaysPanel, BundleMessage.format("UI_KEEP_DELAY"), keepDelayField,
|
||||
BundleMessage.format("UI_KEEP_DELAY_HELP"));
|
||||
addSettingComponent(delaysPanel, BundleMessage.format("UI_SENT_KEEP_DELAY"), sentKeepDelayField,
|
||||
BundleMessage.format("UI_SENT_KEEP_DELAY_HELP"));
|
||||
addSettingComponent(delaysPanel, BundleMessage.format("UI_CALENDAR_PAST_EVENTS"), caldavPastDelayField,
|
||||
BundleMessage.format("UI_CALENDAR_PAST_EVENTS_HELP"));
|
||||
return delaysPanel;
|
||||
}
|
||||
|
||||
protected JPanel getProxyPanel() {
|
||||
JPanel proxyPanel = new JPanel(new GridLayout(5, 2));
|
||||
proxyPanel.setBorder(BorderFactory.createTitledBorder("Proxy"));
|
||||
proxyPanel.setBorder(BorderFactory.createTitledBorder(BundleMessage.format("UI_PROXY")));
|
||||
|
||||
boolean enableProxy = Settings.getBooleanProperty("davmail.enableProxy");
|
||||
enableProxyField = new JCheckBox();
|
||||
@ -197,17 +198,17 @@ public class SettingsFrame extends JFrame {
|
||||
}
|
||||
});
|
||||
|
||||
addSettingComponent(proxyPanel, "Enable proxy: ", enableProxyField);
|
||||
addSettingComponent(proxyPanel, "Proxy server: ", httpProxyField);
|
||||
addSettingComponent(proxyPanel, "Proxy port: ", httpProxyPortField);
|
||||
addSettingComponent(proxyPanel, "Proxy user: ", httpProxyUserField);
|
||||
addSettingComponent(proxyPanel, "Proxy password: ", httpProxyPasswordField);
|
||||
addSettingComponent(proxyPanel, BundleMessage.format("UI_ENABLE_PROXY"), enableProxyField);
|
||||
addSettingComponent(proxyPanel, BundleMessage.format("UI_PROXY_SERVER"), httpProxyField);
|
||||
addSettingComponent(proxyPanel, BundleMessage.format("UI_PROXY_PORT"), httpProxyPortField);
|
||||
addSettingComponent(proxyPanel, BundleMessage.format("UI_PROXY_USER"), httpProxyUserField);
|
||||
addSettingComponent(proxyPanel, BundleMessage.format("UI_PROXY_PASSWORD"), httpProxyPasswordField);
|
||||
return proxyPanel;
|
||||
}
|
||||
|
||||
public JPanel getNetworkSettingsPanel() {
|
||||
JPanel networkSettingsPanel = new JPanel(new GridLayout(4, 2));
|
||||
networkSettingsPanel.setBorder(BorderFactory.createTitledBorder("Network"));
|
||||
networkSettingsPanel.setBorder(BorderFactory.createTitledBorder(BundleMessage.format("UI_NETWORK")));
|
||||
|
||||
allowRemoteField = new JCheckBox();
|
||||
allowRemoteField.setSelected(Settings.getBooleanProperty("davmail.allowRemote"));
|
||||
@ -219,20 +220,20 @@ public class SettingsFrame extends JFrame {
|
||||
disableUpdateCheck = new JCheckBox();
|
||||
disableUpdateCheck.setSelected(Settings.getBooleanProperty("davmail.disableUpdateCheck"));
|
||||
|
||||
addSettingComponent(networkSettingsPanel, "Bind address: ", bindAddressField,
|
||||
"Bind only to the specified network address");
|
||||
addSettingComponent(networkSettingsPanel, "Allow Remote Connections: ", allowRemoteField,
|
||||
"Allow remote connections to the gateway (server mode)");
|
||||
addSettingComponent(networkSettingsPanel, "Server certificate hash: ", certHashField,
|
||||
"Manually accepted server certificate hash");
|
||||
addSettingComponent(networkSettingsPanel, "Disable update check: ", disableUpdateCheck,
|
||||
"Disable DavMail check for new version");
|
||||
addSettingComponent(networkSettingsPanel, BundleMessage.format("UI_BIND_ADDRESS"), bindAddressField,
|
||||
BundleMessage.format("UI_BIND_ADDRESS_HELP"));
|
||||
addSettingComponent(networkSettingsPanel, BundleMessage.format("UI_ALLOW_REMOTE_CONNECTION"), allowRemoteField,
|
||||
BundleMessage.format("UI_ALLOW_REMOTE_CONNECTION_HELP"));
|
||||
addSettingComponent(networkSettingsPanel, BundleMessage.format("UI_SERVER_CERTIFICATE_HASH"), certHashField,
|
||||
BundleMessage.format("UI_SERVER_CERTIFICATE_HASH_HELP"));
|
||||
addSettingComponent(networkSettingsPanel, BundleMessage.format("UI_DISABLE_UPDATE_CHECK"), disableUpdateCheck,
|
||||
BundleMessage.format("UI_DISABLE_VERSION_CHECK"));
|
||||
return networkSettingsPanel;
|
||||
}
|
||||
|
||||
public JPanel getLoggingSettingsPanel() {
|
||||
JPanel loggingSettingsPanel = new JPanel(new GridLayout(4, 2));
|
||||
loggingSettingsPanel.setBorder(BorderFactory.createTitledBorder("Logging levels"));
|
||||
loggingSettingsPanel.setBorder(BorderFactory.createTitledBorder(BundleMessage.format("UI_LOGGING_LEVELS")));
|
||||
|
||||
rootLoggingLevelField = new JComboBox(LOG_LEVELS);
|
||||
davmailLoggingLevelField = new JComboBox(LOG_LEVELS);
|
||||
@ -244,10 +245,10 @@ public class SettingsFrame extends JFrame {
|
||||
httpclientLoggingLevelField.setSelectedItem(Settings.getLoggingLevel("org.apache.commons.httpclient"));
|
||||
wireLoggingLevelField.setSelectedItem(Settings.getLoggingLevel("httpclient.wire"));
|
||||
|
||||
addSettingComponent(loggingSettingsPanel, "Default: ", rootLoggingLevelField);
|
||||
addSettingComponent(loggingSettingsPanel, "DavMail: ", davmailLoggingLevelField);
|
||||
addSettingComponent(loggingSettingsPanel, "HttpClient: ", httpclientLoggingLevelField);
|
||||
addSettingComponent(loggingSettingsPanel, "Wire: ", wireLoggingLevelField);
|
||||
addSettingComponent(loggingSettingsPanel, BundleMessage.format("UI_LOG_DEFAULT"), rootLoggingLevelField);
|
||||
addSettingComponent(loggingSettingsPanel, BundleMessage.format("UI_LOG_DAVMAIL"), davmailLoggingLevelField);
|
||||
addSettingComponent(loggingSettingsPanel, BundleMessage.format("UI_LOG_HTTPCLIENT"), httpclientLoggingLevelField);
|
||||
addSettingComponent(loggingSettingsPanel, BundleMessage.format("UI_LOG_WIRE"), wireLoggingLevelField);
|
||||
|
||||
return loggingSettingsPanel;
|
||||
}
|
||||
@ -292,7 +293,7 @@ public class SettingsFrame extends JFrame {
|
||||
|
||||
public SettingsFrame() {
|
||||
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
setTitle("DavMail Gateway Settings");
|
||||
setTitle(BundleMessage.format("UI_DAVMAIL_SETTINGS"));
|
||||
setIconImage(DavGatewayTray.getFrameIcon());
|
||||
|
||||
JTabbedPane tabbedPane = new JTabbedPane();
|
||||
@ -311,7 +312,7 @@ public class SettingsFrame extends JFrame {
|
||||
mainPanel.add(getDelaysPanel());
|
||||
mainPanel.add(Box.createVerticalGlue());
|
||||
|
||||
tabbedPane.add("Main", mainPanel);
|
||||
tabbedPane.add(BundleMessage.format("UI_TAB_MAIN"), mainPanel);
|
||||
|
||||
JPanel advancedPanel = new JPanel();
|
||||
advancedPanel.setLayout(new BoxLayout(advancedPanel, BoxLayout.Y_AXIS));
|
||||
@ -321,19 +322,19 @@ public class SettingsFrame extends JFrame {
|
||||
proxyPanel.add(getProxyPanel());
|
||||
// empty panel
|
||||
proxyPanel.add(new JPanel());
|
||||
tabbedPane.add("Proxy", proxyPanel);
|
||||
tabbedPane.add(BundleMessage.format("UI_TAB_PROXY"), proxyPanel);
|
||||
|
||||
advancedPanel.add(getNetworkSettingsPanel());
|
||||
advancedPanel.add(getLoggingSettingsPanel());
|
||||
|
||||
tabbedPane.add("Advanced", advancedPanel);
|
||||
tabbedPane.add(BundleMessage.format("UI_TAB_ADVANCED"), advancedPanel);
|
||||
|
||||
add(BorderLayout.CENTER, tabbedPane);
|
||||
|
||||
JPanel buttonPanel = new JPanel();
|
||||
JButton cancel = new JButton("Cancel");
|
||||
JButton ok = new JButton("Save");
|
||||
JButton help = new JButton("Help");
|
||||
JButton cancel = new JButton(BundleMessage.format("UI_BUTTON_CANCEL"));
|
||||
JButton ok = new JButton(BundleMessage.format("UI_BUTTON_SAVE"));
|
||||
JButton help = new JButton(BundleMessage.format("UI_BUTTON_HELP"));
|
||||
ActionListener save = new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
// save options
|
||||
|
@ -1,6 +1,7 @@
|
||||
package davmail.ui.tray;
|
||||
|
||||
import davmail.Settings;
|
||||
import davmail.BundleMessage;
|
||||
import davmail.ui.AboutFrame;
|
||||
import davmail.ui.SettingsFrame;
|
||||
import org.apache.log4j.Logger;
|
||||
@ -85,9 +86,9 @@ public class AwtGatewayTray implements DavGatewayTrayInterface {
|
||||
messageType = TrayIcon.MessageType.ERROR;
|
||||
}
|
||||
if (messageType != null) {
|
||||
trayIcon.displayMessage("DavMail gateway", message, messageType);
|
||||
trayIcon.displayMessage(BundleMessage.format("UI_DAVMAIL_GATEWAY"), message, messageType);
|
||||
}
|
||||
trayIcon.setToolTip("DavMail gateway \n" + message);
|
||||
trayIcon.setToolTip(BundleMessage.format("UI_DAVMAIL_GATEWAY") + '\n' + message);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -125,7 +126,7 @@ public class AwtGatewayTray implements DavGatewayTrayInterface {
|
||||
try {
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
} catch (Exception e) {
|
||||
DavGatewayTray.warn("Unable to set system look and feel", e);
|
||||
DavGatewayTray.warn(new BundleMessage("LOG_UNABLE_TO_SET_SYSTEM_LOOK_AND_FEEL"), e);
|
||||
}
|
||||
|
||||
// get the SystemTray instance
|
||||
@ -145,7 +146,7 @@ public class AwtGatewayTray implements DavGatewayTrayInterface {
|
||||
}
|
||||
};
|
||||
// create menu item for the default action
|
||||
MenuItem aboutItem = new MenuItem("About...");
|
||||
MenuItem aboutItem = new MenuItem(BundleMessage.format("UI_ABOUT"));
|
||||
aboutItem.addActionListener(aboutListener);
|
||||
popup.add(aboutItem);
|
||||
|
||||
@ -157,11 +158,11 @@ public class AwtGatewayTray implements DavGatewayTrayInterface {
|
||||
}
|
||||
};
|
||||
// create menu item for the default action
|
||||
MenuItem defaultItem = new MenuItem("Settings...");
|
||||
MenuItem defaultItem = new MenuItem(BundleMessage.format("UI_SETTINGS"));
|
||||
defaultItem.addActionListener(settingsListener);
|
||||
popup.add(defaultItem);
|
||||
|
||||
MenuItem logItem = new MenuItem("Show logs...");
|
||||
MenuItem logItem = new MenuItem(BundleMessage.format("UI_SHOW_LOGS"));
|
||||
logItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Logger rootLogger = Logger.getRootLogger();
|
||||
@ -189,13 +190,13 @@ public class AwtGatewayTray implements DavGatewayTrayInterface {
|
||||
}
|
||||
};
|
||||
// create menu item for the exit action
|
||||
MenuItem exitItem = new MenuItem("Exit");
|
||||
MenuItem exitItem = new MenuItem(BundleMessage.format("UI_EXIT"));
|
||||
exitItem.addActionListener(exitListener);
|
||||
popup.add(exitItem);
|
||||
|
||||
/// ... add other items
|
||||
// construct a TrayIcon
|
||||
trayIcon = new TrayIcon(image, "DavMail Gateway", popup);
|
||||
trayIcon = new TrayIcon(image, BundleMessage.format("UI_DAVMAIL_GATEWAY"), popup);
|
||||
// set the TrayIcon properties
|
||||
trayIcon.addActionListener(settingsListener);
|
||||
// ...
|
||||
@ -203,7 +204,7 @@ public class AwtGatewayTray implements DavGatewayTrayInterface {
|
||||
try {
|
||||
tray.add(trayIcon);
|
||||
} catch (AWTException e) {
|
||||
DavGatewayTray.warn("Unable to create tray", e);
|
||||
DavGatewayTray.warn(new BundleMessage("LOG_UNABLE_TO_CREATE_TRAY"), e);
|
||||
}
|
||||
|
||||
// display settings frame on first start
|
||||
|
@ -82,6 +82,10 @@ public class DavGatewayTray {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param message
|
||||
*/
|
||||
public static void debug(String message) {
|
||||
displayMessage(message, Priority.DEBUG);
|
||||
}
|
||||
@ -89,6 +93,10 @@ public class DavGatewayTray {
|
||||
public static void debug(BundleMessage message) {
|
||||
displayMessage(message, Priority.DEBUG);
|
||||
}
|
||||
/**
|
||||
* @deprecated
|
||||
* @param message
|
||||
*/
|
||||
|
||||
public static void info(String message) {
|
||||
displayMessage(message, Priority.INFO);
|
||||
@ -97,6 +105,10 @@ public class DavGatewayTray {
|
||||
public static void info(BundleMessage message) {
|
||||
displayMessage(message, Priority.INFO);
|
||||
}
|
||||
/**
|
||||
* @deprecated
|
||||
* @param message
|
||||
*/
|
||||
|
||||
public static void warn(String message) {
|
||||
displayMessage(message, Priority.WARN);
|
||||
@ -105,6 +117,10 @@ public class DavGatewayTray {
|
||||
public static void warn(BundleMessage message) {
|
||||
displayMessage(message, Priority.WARN);
|
||||
}
|
||||
/**
|
||||
* @deprecated
|
||||
* @param message
|
||||
*/
|
||||
|
||||
public static void error(String message) {
|
||||
displayMessage(message, Priority.ERROR);
|
||||
@ -117,6 +133,10 @@ public class DavGatewayTray {
|
||||
public static void error(Exception e) {
|
||||
displayMessage((String) null, e, Priority.ERROR);
|
||||
}
|
||||
/**
|
||||
* @deprecated
|
||||
* @param message
|
||||
*/
|
||||
|
||||
public static void debug(String message, Exception e) {
|
||||
displayMessage(message, e, Priority.DEBUG);
|
||||
@ -125,10 +145,18 @@ public class DavGatewayTray {
|
||||
public static void debug(BundleMessage message, Exception e) {
|
||||
displayMessage(message, e, Priority.DEBUG);
|
||||
}
|
||||
/**
|
||||
* @deprecated
|
||||
* @param message
|
||||
*/
|
||||
|
||||
public static void info(String message, Exception e) {
|
||||
displayMessage(message, e, Priority.INFO);
|
||||
}
|
||||
/**
|
||||
* @deprecated
|
||||
* @param message
|
||||
*/
|
||||
|
||||
public static void warn(String message, Exception e) {
|
||||
displayMessage(message, e, Priority.WARN);
|
||||
@ -137,7 +165,10 @@ public class DavGatewayTray {
|
||||
public static void warn(BundleMessage message, Exception e) {
|
||||
displayMessage(message, e, Priority.WARN);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param message
|
||||
*/
|
||||
public static void error(String message, Exception e) {
|
||||
displayMessage(message, e, Priority.ERROR);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package davmail.ui.tray;
|
||||
|
||||
import davmail.Settings;
|
||||
import davmail.BundleMessage;
|
||||
import davmail.ui.AboutFrame;
|
||||
import davmail.ui.SettingsFrame;
|
||||
import org.apache.log4j.Logger;
|
||||
@ -188,7 +189,7 @@ public class FrameGatewayTray implements DavGatewayTrayInterface {
|
||||
try {
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
} catch (Exception e) {
|
||||
DavGatewayTray.warn("Unable to set system look and feel", e);
|
||||
DavGatewayTray.warn(new BundleMessage("LOG_UNABLE_TO_SET_SYSTEM_LOOK_AND_FEEL"), e);
|
||||
}
|
||||
|
||||
image = DavGatewayTray.loadImage("tray.png");
|
||||
|
@ -1,6 +1,7 @@
|
||||
package davmail.ui.tray;
|
||||
|
||||
import davmail.ui.OSXAdapter;
|
||||
import davmail.BundleMessage;
|
||||
|
||||
/**
|
||||
* Extended Awt tray with OSX extensions.
|
||||
@ -20,7 +21,7 @@ public class OSXAwtGatewayTray extends AwtGatewayTray {
|
||||
OSXAdapter.setPreferencesHandler(this, AwtGatewayTray.class.getDeclaredMethod("preferences", (Class[]) null));
|
||||
OSXAdapter.setQuitHandler(this, OSXAwtGatewayTray.class.getDeclaredMethod("quit", (Class[]) null));
|
||||
} catch (Exception e) {
|
||||
DavGatewayTray.error("Error while loading the OSXAdapter", e);
|
||||
DavGatewayTray.error(new BundleMessage("LOG_ERROR_LOADING_OSXADAPTER"), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package davmail.ui.tray;
|
||||
|
||||
import davmail.ui.OSXAdapter;
|
||||
import davmail.BundleMessage;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
@ -19,12 +20,12 @@ public class OSXFrameGatewayTray extends FrameGatewayTray {
|
||||
@Override
|
||||
protected void buildMenu() {
|
||||
// create a popup menu
|
||||
JMenu menu = new JMenu("Logs");
|
||||
JMenu menu = new JMenu(BundleMessage.format("UI_LOGS"));
|
||||
JMenuBar menuBar = new JMenuBar();
|
||||
menuBar.add(menu);
|
||||
mainFrame.setJMenuBar(menuBar);
|
||||
|
||||
JMenuItem logItem = new JMenuItem("Show logs...");
|
||||
JMenuItem logItem = new JMenuItem(BundleMessage.format("UI_SHOW_LOGS"));
|
||||
logItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
showLogs();
|
||||
@ -43,7 +44,7 @@ public class OSXFrameGatewayTray extends FrameGatewayTray {
|
||||
OSXAdapter.setPreferencesHandler(this, FrameGatewayTray.class.getDeclaredMethod("preferences", (Class[]) null));
|
||||
OSXAdapter.setQuitHandler(this, OSXFrameGatewayTray.class.getDeclaredMethod("quit", (Class[]) null));
|
||||
} catch (Exception e) {
|
||||
DavGatewayTray.error("Error while loading the OSXAdapter", e);
|
||||
DavGatewayTray.error(new BundleMessage("LOG_ERROR_LOADING_OSXADAPTER"), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package davmail.ui.tray;
|
||||
|
||||
import davmail.Settings;
|
||||
import davmail.BundleMessage;
|
||||
import davmail.ui.AboutFrame;
|
||||
import davmail.ui.SettingsFrame;
|
||||
import org.apache.log4j.Logger;
|
||||
@ -88,12 +89,12 @@ public class SwtGatewayTray implements DavGatewayTrayInterface {
|
||||
}
|
||||
if (messageType != 0) {
|
||||
final ToolTip toolTip = new ToolTip(shell, SWT.BALLOON | messageType);
|
||||
toolTip.setText("DavMail gateway");
|
||||
toolTip.setText(BundleMessage.format("UI_DAVMAIL_GATEWAY"));
|
||||
toolTip.setMessage(message);
|
||||
trayItem.setToolTip(toolTip);
|
||||
toolTip.setVisible(true);
|
||||
}
|
||||
trayItem.setToolTipText("DavMail gateway \n" + message);
|
||||
trayItem.setToolTipText(BundleMessage.format("UI_DAVMAIL_GATEWAY") + '\n' + message);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -112,7 +113,7 @@ public class SwtGatewayTray implements DavGatewayTrayInterface {
|
||||
URL imageUrl = classloader.getResource(fileName);
|
||||
result = new Image(display, imageUrl.openStream());
|
||||
} catch (IOException e) {
|
||||
DavGatewayTray.warn("Unable to load image", e);
|
||||
DavGatewayTray.warn(new BundleMessage("LOG_UNABLE_TO_LOAD_IMAGE"), e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -127,7 +128,7 @@ public class SwtGatewayTray implements DavGatewayTrayInterface {
|
||||
}
|
||||
UIManager.setLookAndFeel(lafClassName);
|
||||
} catch (Exception e) {
|
||||
DavGatewayTray.warn("Unable to set look and feel");
|
||||
DavGatewayTray.warn(new BundleMessage("LOG_UNABLE_TO_SET_LOOK_AND_FEEL"));
|
||||
}
|
||||
|
||||
new Thread("SWT") {
|
||||
@ -140,7 +141,7 @@ public class SwtGatewayTray implements DavGatewayTrayInterface {
|
||||
if (tray != null) {
|
||||
|
||||
trayItem = new TrayItem(tray, SWT.NONE);
|
||||
trayItem.setToolTipText("DavMail gateway");
|
||||
trayItem.setToolTipText(BundleMessage.format("UI_DAVMAIL_GATEWAY"));
|
||||
|
||||
awtImage = DavGatewayTray.loadImage("tray.png");
|
||||
image = loadSwtImage("tray.png");
|
||||
@ -163,7 +164,7 @@ public class SwtGatewayTray implements DavGatewayTrayInterface {
|
||||
});
|
||||
|
||||
MenuItem aboutItem = new MenuItem(popup, SWT.PUSH);
|
||||
aboutItem.setText("About...");
|
||||
aboutItem.setText(BundleMessage.format("UI_ABOUT"));
|
||||
final AboutFrame aboutFrame = new AboutFrame();
|
||||
aboutItem.addListener(SWT.Selection, new Listener() {
|
||||
public void handleEvent(Event event) {
|
||||
@ -194,7 +195,7 @@ public class SwtGatewayTray implements DavGatewayTrayInterface {
|
||||
|
||||
// create menu item for the default action
|
||||
MenuItem defaultItem = new MenuItem(popup, SWT.PUSH);
|
||||
defaultItem.setText("Settings...");
|
||||
defaultItem.setText(BundleMessage.format("UI_SETTINGS"));
|
||||
defaultItem.addListener(SWT.Selection, new Listener() {
|
||||
public void handleEvent(Event event) {
|
||||
SwingUtilities.invokeLater(
|
||||
@ -210,7 +211,7 @@ public class SwtGatewayTray implements DavGatewayTrayInterface {
|
||||
});
|
||||
|
||||
MenuItem logItem = new MenuItem(popup, SWT.PUSH);
|
||||
logItem.setText("Show logs...");
|
||||
logItem.setText(BundleMessage.format("UI_SHOW_LOGS"));
|
||||
logItem.addListener(SWT.Selection, new Listener() {
|
||||
public void handleEvent(Event event) {
|
||||
SwingUtilities.invokeLater(
|
||||
@ -236,7 +237,7 @@ public class SwtGatewayTray implements DavGatewayTrayInterface {
|
||||
});
|
||||
|
||||
MenuItem exitItem = new MenuItem(popup, SWT.PUSH);
|
||||
exitItem.setText("Exit");
|
||||
exitItem.setText(BundleMessage.format("UI_EXIT"));
|
||||
exitItem.addListener(SWT.Selection, new Listener() {
|
||||
public void handleEvent(Event event) {
|
||||
shell.dispose();
|
||||
@ -290,7 +291,7 @@ public class SwtGatewayTray implements DavGatewayTrayInterface {
|
||||
mainThread.wait(1000);
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
DavGatewayTray.error("Error waiting for SWT init", e);
|
||||
DavGatewayTray.error(new BundleMessage("LOG_ERROR_WAITING_FOR_SWT_INIT"), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package davmail.web;
|
||||
|
||||
import davmail.Settings;
|
||||
import davmail.DavGateway;
|
||||
import davmail.BundleMessage;
|
||||
import davmail.ui.tray.DavGatewayTray;
|
||||
|
||||
import javax.servlet.ServletContextListener;
|
||||
@ -20,21 +21,21 @@ public class DavGatewayServletContextListener implements ServletContextListener
|
||||
Settings.load(settingInputStream);
|
||||
DavGateway.start();
|
||||
} catch (IOException e) {
|
||||
DavGatewayTray.error("Error loading settings file from classpath: ", e);
|
||||
DavGatewayTray.error(new BundleMessage("LOG_ERROR_LOADING_SETTINGS"), e);
|
||||
} finally {
|
||||
if (settingInputStream != null) {
|
||||
try {
|
||||
settingInputStream.close();
|
||||
} catch (IOException e) {
|
||||
DavGatewayTray.debug("Error closing configuration file: ", e);
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_ERROR_CLOSING_CONFIGURATION_FILE"), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
DavGatewayTray.debug("DavMail Gateway started");
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_DAVMAIL_STARTED"));
|
||||
}
|
||||
|
||||
public void contextDestroyed(ServletContextEvent event) {
|
||||
DavGatewayTray.debug("Stopping DavMail Gateway...");
|
||||
DavGatewayTray.debug(new BundleMessage("LOG_STOPPING_DAVMAIL"));
|
||||
DavGateway.stop();
|
||||
}
|
||||
}
|
||||
|
@ -44,4 +44,124 @@ LOG_LDAP_SEND_COMPUTER_CONTEXT=Sending computer context {0} {1}
|
||||
LOG_LDAP_IGNORE_FILTER_ATTRIBUTE=Ignoring filter attribute: {0} = {1}
|
||||
LOG_LDAP_UNSUPPORTED_FILTER_ATTRIBUTE=Unsupported filter attribute: {0} = {1}
|
||||
LOG_LDAP_REQ_SEARCH_SIZE_LIMIT_EXCEEDED=LDAP_REQ_SEARCH {0} size limit exceeded
|
||||
LOG_LDAP_REQ_SEARCH_SUCCESS=LDAP_REQ_SEARCH {0} success
|
||||
LOG_LDAP_REQ_SEARCH_SUCCESS=LDAP_REQ_SEARCH {0} success
|
||||
LOG_ERROR_LOADING_SETTINGS=Error loading settings file from classpath:
|
||||
LOG_ERROR_CLOSING_CONFIGURATION_FILE=Error closing configuration file:
|
||||
LOG_DAVMAIL_STARTED=DavMail Gateway started
|
||||
LOG_STOPPING_DAVMAIL=Stopping DavMail Gateway...
|
||||
UI_DAVMAIL_GATEWAY=DavMail Gateway
|
||||
LOG_UNABLE_TO_SET_SYSTEM_LOOK_AND_FEEL=Unable to set system look and feel
|
||||
UI_ABOUT=About...
|
||||
UI_SETTINGS=Settings...
|
||||
UI_SHOW_LOGS=Show logs...
|
||||
UI_EXIT=Exit
|
||||
LOG_UNABLE_TO_CREATE_TRAY=Unable to create tray
|
||||
LOG_ERROR_LOADING_OSXADAPTER=Error while loading the OSXAdapter
|
||||
UI_LOGS=Logs
|
||||
LOG_UNABLE_TO_SET_LOOK_AND_FEEL=Unable to set look and feel
|
||||
LOG_ERROR_WAITING_FOR_SWT_INIT=Error waiting for SWT init
|
||||
UI_GATEWAY=Gateway
|
||||
UI_OWA_URL=OWA url:
|
||||
UI_OWA_URL_HELP=Base outlook web access URL
|
||||
UI_POP_PORT=Local POP port:
|
||||
UI_POP_PORT_HELP=Local POP server port to configure in POP client
|
||||
UI_IMAP_PORT=Local IMAP port:
|
||||
UI_IMAP_PORT_HELP=Local IMAP server port to configure in IMAP client
|
||||
UI_SMTP_PORT=Local SMTP port:
|
||||
UI_SMTP_PORT_HELP=Local SMTP server port to configure in POP client
|
||||
UI_CALDAV_PORT=Caldav HTTP port:
|
||||
UI_CALDAV_PORT_HELP=Local Caldav server port to configure in Caldav (calendar) client
|
||||
UI_LDAP_PORT=Local LDAP port:
|
||||
UI_LDAP_PORT_HELP=Local LDAP server port to configure in add directory (addresse book) client
|
||||
UI_DELAYS=Delays
|
||||
UI_KEEP_DELAY=Keep delay:
|
||||
UI_KEEP_DELAY_HELP=Number of days to keep messages in trash
|
||||
UI_SENT_KEEP_DELAY=Sent keep delay:
|
||||
UI_SENT_KEEP_DELAY_HELP=Number of days to keep messages in sent folder
|
||||
UI_CALENDAR_PAST_EVENTS=Calendar past events:
|
||||
UI_CALENDAR_PAST_EVENTS_HELP=Get events in the past not older than specified days count, leave empty for no limits
|
||||
UI_PROXY=Proxy
|
||||
UI_ENABLE_PROXY=Enable proxy:
|
||||
UI_PROXY_SERVER=Proxy server:
|
||||
UI_PROXY_PORT=Proxy port:
|
||||
UI_PROXY_USER=Proxy user:
|
||||
UI_PROXY_PASSWORD=Proxy password:
|
||||
UI_NETWORK=Network
|
||||
UI_BIND_ADDRESS=Bind address:
|
||||
UI_BIND_ADDRESS_HELP=Bind only to the specified network address
|
||||
UI_ALLOW_REMOTE_CONNECTION=Allow Remote Connections:
|
||||
UI_ALLOW_REMOTE_CONNECTION_HELP=Allow remote connections to the gateway (server mode)
|
||||
UI_SERVER_CERTIFICATE_HASH=Server certificate hash:
|
||||
UI_SERVER_CERTIFICATE_HASH_HELP=Manually accepted server certificate hash
|
||||
UI_DISABLE_UPDATE_CHECK=Disable update check:
|
||||
UI_DISABLE_VERSION_CHECK=Disable DavMail check for new version
|
||||
UI_LOGGING_LEVELS=Logging levels
|
||||
UI_LOG_DEFAULT=Default:
|
||||
UI_LOG_DAVMAIL=DavMail:
|
||||
UI_LOG_HTTPCLIENT=HttpClient:
|
||||
UI_LOG_WIRE=Wire:
|
||||
UI_DAVMAIL_SETTINGS=DavMail Gateway Settings
|
||||
UI_TAB_MAIN=Main
|
||||
UI_TAB_PROXY=Proxy
|
||||
UI_TAB_ADVANCED=Advanced
|
||||
UI_BUTTON_CANCEL=Cancel
|
||||
UI_BUTTON_SAVE=Save
|
||||
UI_BUTTON_HELP=Help
|
||||
LOG_JAVA6_DESKTOP_UNAVAILABLE=Java 6 Desktop class not available
|
||||
LOG_UNABLE_TO_OPEN_LINK=Unable to open link
|
||||
LOG_OPEN_LINK_NOT_SUPPORTED=Open link not supported (tried AWT Desktop and SWT Program
|
||||
UI_ACCEPT_CERTIFICATE=DavMail: Accept certificate ?
|
||||
LOG_UNABLE_TO_SET_ICON_IMAGE=Unable to set JDialog icon image (not available under Java 1.5)
|
||||
UI_SERVER_CERTIFICATE=Server Certificate
|
||||
UI_ISSUED_TO=Issued to
|
||||
UI_ISSUED_BY=Issued by
|
||||
UI_VALID_FROM=Valid from
|
||||
UI_VALID_UNTIL=Valid until
|
||||
UI_SERIAL=Serial
|
||||
UI_FINGERPRINT=FingerPrint
|
||||
UI_UNTRUSTED_CERTIFICATE_HTML=<html><b>Server provided an untrusted certificate,<br> you can choose to accept or deny access</b></html>
|
||||
UI_BUTTON_ACCEPT=Accept
|
||||
UI_BUTTON_DENY=Deny
|
||||
UI_ERROR_WAITING_FOR_CERTIFICATE_CHECK=Error waiting for certificate check
|
||||
UI_ABOUT_DAVMAIL=About DavMail Gateway
|
||||
LOG_UNABLE_TO_CREATE_ICON=Unable to create icon
|
||||
UI_BUTTON_OK=OK
|
||||
UI_ABOUT_DAVMAIL_AUTHOR=<html><b>DavMail Gateway</b><br>By Mickaël Guessant<br><br>
|
||||
UI_CURRENT_VERSION=Current version: {0}<br>
|
||||
UI_LATEST_VERSION=Latest version available: {0} \
|
||||
<br>A new version of DavMail Gateway is available.\
|
||||
<br><a href=\"http://sourceforge.net/project/platformdownload.php?group_id=184600\">Download latest version</a><br>
|
||||
UI_HELP_INSTRUCTIONS=<br>Help and setup instructions available at:<br><a href=\"http://davmail.sourceforge.net\">http://davmail.sourceforge.net</a><br><br>To send comments or report bugs, <br>use <a href=\"http://sourceforge.net/tracker/?group_id=184600\">DavMail Sourceforge trackers</a><br>or contact me at <a href=\"mailto:mguessan@free.fr\">mguessan@free.fr</a></html>
|
||||
LOG_CLIENT_CLOSED_CONNECTION=Client closed connection
|
||||
LOG_SEARCH_QUERY=Search: {0}
|
||||
LOG_EXCEPTION_CLOSING_CONNECTION_ON_TIMEOUT=Exception closing connection on timeout
|
||||
LOG_IMAP_COMMAND={0} on {1}
|
||||
LOG_SEND_CLIENT_PREFIX_MESSAGE=> {0}{1}
|
||||
LOG_SEND_CLIENT_MESSAGE=> {0}
|
||||
LOG_READ_CLIENT_PASS=< PASS ********
|
||||
LOG_READ_CLIENT_LOGIN=< LOGIN ********
|
||||
LOG_READ_CLIENT_PASSWORD=< ********
|
||||
LOG_READ_CLIENT_AUTHORIZATION=< Authorization: ********
|
||||
LOG_READ_CLIENT_AUTH_PLAIN=< AUTH PLAIN ********
|
||||
LOG_READ_CLIENT_LINE=< {0}
|
||||
LOG_ERROR_RETRIEVING_MESSAGE=Error retreiving message
|
||||
LOG_EXECUTE_FOLLOW_REDIRECTS=executeFollowRedirects({0})
|
||||
LOG_EXECUTE_FOLLOW_REDIRECTS_COUNT=executeFollowRedirects: {0} redirectCount:{1}
|
||||
LOG_INVALID_URL=Invalid URL: {0}
|
||||
LOG_FOUND_ACCEPTED_CERTIFICATE=Found permanently accepted certificate, hash {0}
|
||||
UI_UNTRUSTED_CERTIFICATE=Server provided an untrusted certificate, \n\
|
||||
you can choose to accept or deny access.\n\
|
||||
Accept certificate (y/n)?
|
||||
UI_ANSWER_YES=y
|
||||
UI_ANSWER_NO=n
|
||||
LOG_MESSAGE={0}
|
||||
LOG_INVALID_DEPTH=Invalid depth value: {0}
|
||||
LOG_UNSUPORTED_REQUEST=Unsupported request: {0}
|
||||
LOG_EVENT_NOT_FOUND=Event not found:{0}
|
||||
LOG_REPORT_EVENT=Report event {0}/{1}
|
||||
LOG_FOUND_CALENDAR_EVENTS=Found {0} calendar events
|
||||
LOG_SEARCHING_CALENDAR_EVENTS=Searching calendar events at {0} ...
|
||||
LOG_FOUND_CALENDAR_MESSAGES=Found {0} calendar messages
|
||||
LOG_SEARCHING_CALENDAR_MESSAGES=Searching calendar messages...
|
||||
LOG_LISTING_EVENT=Listing event {0}/{1}
|
||||
LOG_SET_SOCKET_TIMEOUT=Set socket timeout to {0} seconds
|
Loading…
x
Reference in New Issue
Block a user