mirror of
https://github.com/moparisthebest/davmail
synced 2025-02-28 09:21:49 -05:00
Add a new auto value to davmail.enableEws setting to avoid unwanted switch from WebDav to EWS on temporary Exchange connection issue
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1835 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
b0162703f1
commit
dcf7c93705
@ -144,6 +144,7 @@ public final class Settings {
|
||||
SETTINGS.put("davmail.bindAddress", "");
|
||||
SETTINGS.put("davmail.useSystemProxies", Boolean.TRUE.toString());
|
||||
SETTINGS.put("davmail.enableProxy", Boolean.FALSE.toString());
|
||||
SETTINGS.put("davmail.enableEws", "auto");
|
||||
SETTINGS.put("davmail.proxyHost", "");
|
||||
SETTINGS.put("davmail.proxyPort", "");
|
||||
SETTINGS.put("davmail.proxyUser", "");
|
||||
@ -318,6 +319,22 @@ public final class Settings {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get property value or default.
|
||||
*
|
||||
* @param property property name
|
||||
* @param defaultValue default property value
|
||||
* @return property value
|
||||
*/
|
||||
public static synchronized String getProperty(String property, String defaultValue) {
|
||||
String value = SETTINGS.getProperty(property);
|
||||
if (value == null) {
|
||||
value = defaultValue;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a property value as char[].
|
||||
*
|
||||
|
@ -26,6 +26,7 @@ import davmail.exception.WebdavNotAvailableException;
|
||||
import davmail.exchange.dav.DavExchangeSession;
|
||||
import davmail.exchange.ews.EwsExchangeSession;
|
||||
import davmail.http.DavGatewayHttpClientFacade;
|
||||
import davmail.ui.tray.DavGatewayTray;
|
||||
import org.apache.commons.httpclient.HttpClient;
|
||||
import org.apache.commons.httpclient.HttpStatus;
|
||||
import org.apache.commons.httpclient.methods.GetMethod;
|
||||
@ -138,18 +139,19 @@ public final class ExchangeSessionFactory {
|
||||
}
|
||||
|
||||
if (session == null) {
|
||||
if (Settings.getBooleanProperty("davmail.enableEws")) {
|
||||
String enableEws = Settings.getProperty("davmail.enableEws", "auto");
|
||||
if ("true".equals(enableEws)) {
|
||||
session = new EwsExchangeSession(poolKey.url, poolKey.userName, poolKey.password);
|
||||
} else {
|
||||
try {
|
||||
session = new DavExchangeSession(poolKey.url, poolKey.userName, poolKey.password);
|
||||
} catch (WebdavNotAvailableException e) {
|
||||
ExchangeSession.LOGGER.debug(e.getMessage() + ", retry with EWS");
|
||||
session = new EwsExchangeSession(poolKey.url, poolKey.userName, poolKey.password);
|
||||
// success, enable EWS flag
|
||||
ExchangeSession.LOGGER.debug("EWS found, changing davmail.enableEws setting");
|
||||
Settings.setProperty("davmail.enableEws", "true");
|
||||
Settings.save();
|
||||
if ("auto".equals(enableEws)) {
|
||||
ExchangeSession.LOGGER.debug(e.getMessage() + ", retry with EWS");
|
||||
session = new EwsExchangeSession(poolKey.url, poolKey.userName, poolKey.password);
|
||||
} else {
|
||||
DavGatewayTray.warn(new BundleMessage("LOG_WEBDAV_NOT_AVAILABLE"));
|
||||
}
|
||||
}
|
||||
}
|
||||
ExchangeSession.LOGGER.debug("Created new session: " + session);
|
||||
|
@ -98,7 +98,7 @@ public class SettingsFrame extends JFrame {
|
||||
JCheckBox showStartupBannerCheckBox;
|
||||
JCheckBox disableGuiNotificationsCheckBox;
|
||||
JCheckBox imapAutoExpungeCheckBox;
|
||||
JCheckBox enableEwsCheckBox;
|
||||
JComboBox enableEwsComboBox;
|
||||
JCheckBox smtpSaveInSentCheckBox;
|
||||
|
||||
protected void addSettingComponent(JPanel panel, String label, JComponent component) {
|
||||
@ -392,12 +392,26 @@ public class SettingsFrame extends JFrame {
|
||||
return networkSettingsPanel;
|
||||
}
|
||||
|
||||
protected static final String WEBDAV = "WebDav";
|
||||
protected static final String EWS = "EWS";
|
||||
protected static final String AUTO = "Auto";
|
||||
|
||||
protected void setEwsModeSelectedItem(String ewsMode) {
|
||||
if ("true".equals(ewsMode)) {
|
||||
enableEwsComboBox.setSelectedItem(EWS);
|
||||
} else if ("false".equals(ewsMode)) {
|
||||
enableEwsComboBox.setSelectedItem(WEBDAV);
|
||||
} else {
|
||||
enableEwsComboBox.setSelectedItem(AUTO);
|
||||
}
|
||||
}
|
||||
|
||||
protected JPanel getOtherSettingsPanel() {
|
||||
JPanel otherSettingsPanel = new JPanel(new GridLayout(10, 2));
|
||||
otherSettingsPanel.setBorder(BorderFactory.createTitledBorder(BundleMessage.format("UI_OTHER")));
|
||||
|
||||
enableEwsCheckBox = new JCheckBox();
|
||||
enableEwsCheckBox.setSelected(Settings.getBooleanProperty("davmail.enableEws", false));
|
||||
enableEwsComboBox = new JComboBox(new String[]{WEBDAV, EWS, AUTO});
|
||||
setEwsModeSelectedItem(Settings.getProperty("davmail.enableEws", "auto"));
|
||||
caldavEditNotificationsField = new JCheckBox();
|
||||
caldavEditNotificationsField.setSelected(Settings.getBooleanProperty("davmail.caldavEditNotifications"));
|
||||
caldavAlarmSoundField = new JTextField(Settings.getProperty("davmail.caldavAlarmSound"), 15);
|
||||
@ -415,7 +429,7 @@ public class SettingsFrame extends JFrame {
|
||||
disableUpdateCheck = new JCheckBox();
|
||||
disableUpdateCheck.setSelected(Settings.getBooleanProperty("davmail.disableUpdateCheck"));
|
||||
|
||||
addSettingComponent(otherSettingsPanel, BundleMessage.format("UI_ENABLE_EWS"), enableEwsCheckBox,
|
||||
addSettingComponent(otherSettingsPanel, BundleMessage.format("UI_ENABLE_EWS"), enableEwsComboBox,
|
||||
BundleMessage.format("UI_ENABLE_EWS_HELP"));
|
||||
addSettingComponent(otherSettingsPanel, BundleMessage.format("UI_CALDAV_EDIT_NOTIFICATIONS"), caldavEditNotificationsField,
|
||||
BundleMessage.format("UI_CALDAV_EDIT_NOTIFICATIONS_HELP"));
|
||||
@ -549,7 +563,7 @@ public class SettingsFrame extends JFrame {
|
||||
showStartupBannerCheckBox.setSelected(Settings.getBooleanProperty("davmail.showStartupBanner", true));
|
||||
disableGuiNotificationsCheckBox.setSelected(Settings.getBooleanProperty("davmail.disableGuiNotifications", false));
|
||||
imapAutoExpungeCheckBox.setSelected(Settings.getBooleanProperty("davmail.imapAutoExpunge", true));
|
||||
enableEwsCheckBox.setSelected(Settings.getBooleanProperty("davmail.enableEws", false));
|
||||
setEwsModeSelectedItem(Settings.getProperty("davmail.enableEws", "auto"));
|
||||
smtpSaveInSentCheckBox.setSelected(Settings.getBooleanProperty("davmail.smtpSaveInSent", true));
|
||||
|
||||
keystoreTypeCombo.setSelectedItem(Settings.getProperty("davmail.ssl.keystoreType"));
|
||||
@ -692,7 +706,16 @@ public class SettingsFrame extends JFrame {
|
||||
Settings.setProperty("davmail.showStartupBanner", String.valueOf(showStartupBannerCheckBox.isSelected()));
|
||||
Settings.setProperty("davmail.disableGuiNotifications", String.valueOf(disableGuiNotificationsCheckBox.isSelected()));
|
||||
Settings.setProperty("davmail.imapAutoExpunge", String.valueOf(imapAutoExpungeCheckBox.isSelected()));
|
||||
Settings.setProperty("davmail.enableEws", String.valueOf(enableEwsCheckBox.isSelected()));
|
||||
String selectedEwsMode = (String) enableEwsComboBox.getSelectedItem();
|
||||
String enableEws;
|
||||
if (EWS.equals(selectedEwsMode)) {
|
||||
enableEws = "true";
|
||||
} else if (WEBDAV.equals(selectedEwsMode)) {
|
||||
enableEws = "false";
|
||||
} else {
|
||||
enableEws = "auto";
|
||||
}
|
||||
Settings.setProperty("davmail.enableEws", enableEws);
|
||||
Settings.setProperty("davmail.smtpSaveInSent", String.valueOf(smtpSaveInSentCheckBox.isSelected()));
|
||||
|
||||
Settings.setProperty("davmail.ssl.keystoreType", (String) keystoreTypeCombo.getSelectedItem());
|
||||
|
@ -133,6 +133,7 @@ LOG_UNSUPPORTED_REQUEST=Unsupported request: {0}
|
||||
LOG_INVALID_TIMEZONE=Invalid timezone: {0}
|
||||
LOG_ACCESS_FORBIDDEN=Access to {0} forbidden: {1}
|
||||
LOG_DOWNLOAD_PROGRESS=Downloaded {0} KBytes from {1}
|
||||
LOG_WEBDAV_NOT_AVAILABLE=WebDav not available, retry with EWS mode
|
||||
UI_ABOUT=About...
|
||||
UI_ABOUT_DAVMAIL=About DavMail Gateway
|
||||
UI_ABOUT_DAVMAIL_AUTHOR=<html><b>DavMail Gateway</b><br>By Mickaël Guessant<br><br>
|
||||
@ -266,8 +267,8 @@ NEEDS-ACTION=
|
||||
ACCEPTED=Accepted:
|
||||
TENTATIVE=Tentative:
|
||||
DECLINED=Declined:
|
||||
UI_ENABLE_EWS=Enable EWS
|
||||
UI_ENABLE_EWS_HELP=Enable EWS mode on Exchange 2010 or Exchange 2007 with Webdav disabled
|
||||
UI_ENABLE_EWS=Exchange Protocol
|
||||
UI_ENABLE_EWS_HELP=Choose EWS on Exchange 2010 or Exchange 2007 with Webdav disabled
|
||||
UI_CALDAV_NOTIFICATION=DavMail: Caldav scheduling notification
|
||||
UI_BUTTON_SEND=Send
|
||||
UI_TO=To:
|
||||
|
@ -123,6 +123,7 @@ LOG_UNABLE_TO_SET_SYSTEM_LOOK_AND_FEEL=Impossible de d
|
||||
LOG_UNABLE_TO_STORE_SETTINGS=Impossible d''enregistrer la configuration
|
||||
LOG_UNSUPPORTED_REQUEST=Requête non supportée : {0}
|
||||
LOG_DOWNLOAD_PROGRESS={0} KOctets téléchargés de {1}
|
||||
LOG_WEBDAV_NOT_AVAILABLE=WebDav non disponible, réessayer en activant EWS
|
||||
UI_ABOUT=A propos...
|
||||
UI_ABOUT_DAVMAIL=A propos de la Passerelle DavMail
|
||||
UI_ABOUT_DAVMAIL_AUTHOR=<html><b>Passerelle DavMail</b><br>Par Mickaël Guessant<br><br>
|
||||
@ -253,7 +254,7 @@ EXCEPTION_INVALID_PARAMETER=Param
|
||||
UI_USE_SYSTEM_PROXIES=Utiliser la configuration système :
|
||||
UI_SHOW_STARTUP_BANNER=Notification au lancement :
|
||||
UI_SHOW_STARTUP_BANNER_HELP=Afficher ou non la fenêtre de notification au démarrage
|
||||
UI_DISABLE_GUI_NOTIFICATIONS=Désactiver notifications graphiques
|
||||
UI_DISABLE_GUI_NOTIFICATIONS=Désactiver notifications graphiques :
|
||||
UI_DISABLE_GUI_NOTIFICATIONS_HELP=Supprimer toutes les notifications graphiques
|
||||
LOG_READ_CLIENT_AUTH_LOGIN=< AUTH LOGIN ********
|
||||
UI_IMAP_IDLE_DELAY=Délai de surveillance dossier (IMAP) :
|
||||
@ -266,8 +267,8 @@ UNKNOWN_ATTRIBUTE=Attribut inconnu: {0}
|
||||
ACCEPTED=Accepté :
|
||||
TENTATIVE=Provisoire :
|
||||
DECLINED=Refusé :
|
||||
UI_ENABLE_EWS=Activer EWS :
|
||||
UI_ENABLE_EWS_HELP=Activer le mode EWS sur Exchange 2010 ou Exchange 2007 sans support Webdav
|
||||
UI_ENABLE_EWS=Protocole Exchange :
|
||||
UI_ENABLE_EWS_HELP=Activer EWS sur Exchange 2010 ou Exchange 2007 sans support Webdav
|
||||
UI_CALDAV_NOTIFICATION=DavMail : Notification Caldav
|
||||
UI_BUTTON_SEND=Envoyer
|
||||
UI_SUBJECT=Sujet :
|
||||
|
Loading…
x
Reference in New Issue
Block a user