mirror of
https://github.com/moparisthebest/davmail
synced 2025-01-13 06:28:19 -05:00
IMAP: implement a new imapAutoExpunge setting to delete messages immediately over IMAP
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1038 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
0910d22a93
commit
4763d94aca
@ -151,6 +151,7 @@ public final class Settings {
|
|||||||
SETTINGS.put("davmail.caldavAlarmSound", "");
|
SETTINGS.put("davmail.caldavAlarmSound", "");
|
||||||
SETTINGS.put("davmail.forceActiveSyncUpdate", Boolean.FALSE.toString());
|
SETTINGS.put("davmail.forceActiveSyncUpdate", Boolean.FALSE.toString());
|
||||||
SETTINGS.put("davmail.showStartupBanner", Boolean.TRUE.toString());
|
SETTINGS.put("davmail.showStartupBanner", Boolean.TRUE.toString());
|
||||||
|
SETTINGS.put("davmail.imapAutoExpunge", Boolean.TRUE.toString());
|
||||||
SETTINGS.put("davmail.ssl.keystoreType", "");
|
SETTINGS.put("davmail.ssl.keystoreType", "");
|
||||||
SETTINGS.put("davmail.ssl.keystoreFile", "");
|
SETTINGS.put("davmail.ssl.keystoreFile", "");
|
||||||
SETTINGS.put("davmail.ssl.keystorePass", "");
|
SETTINGS.put("davmail.ssl.keystorePass", "");
|
||||||
|
@ -220,9 +220,10 @@ public class ImapConnection extends AbstractConnection {
|
|||||||
sendClient(commandId + " BAD command unrecognized");
|
sendClient(commandId + " BAD command unrecognized");
|
||||||
}
|
}
|
||||||
} else if ("expunge".equalsIgnoreCase(command)) {
|
} else if ("expunge".equalsIgnoreCase(command)) {
|
||||||
expunge(false);
|
if (expunge(false)) {
|
||||||
// need to refresh folder to avoid 404 errors
|
// need to refresh folder to avoid 404 errors
|
||||||
session.refreshFolder(currentFolder);
|
session.refreshFolder(currentFolder);
|
||||||
|
}
|
||||||
sendClient(commandId + " OK " + command + " completed");
|
sendClient(commandId + " OK " + command + " completed");
|
||||||
} else if ("close".equalsIgnoreCase(command)) {
|
} else if ("close".equalsIgnoreCase(command)) {
|
||||||
expunge(true);
|
expunge(true);
|
||||||
@ -712,6 +713,12 @@ public class ImapConnection extends AbstractConnection {
|
|||||||
updateFlags(message, action, flags);
|
updateFlags(message, action, flags);
|
||||||
sendClient("* " + (rangeIterator.getCurrentIndex()) + " FETCH (UID " + message.getImapUid() + " FLAGS (" + (message.getImapFlags()) + "))");
|
sendClient("* " + (rangeIterator.getCurrentIndex()) + " FETCH (UID " + message.getImapUid() + " FLAGS (" + (message.getImapFlags()) + "))");
|
||||||
}
|
}
|
||||||
|
// auto expunge
|
||||||
|
if (Settings.getBooleanProperty("davmail.imapAutoExpunge")) {
|
||||||
|
if (expunge(false)) {
|
||||||
|
session.refreshFolder(currentFolder);
|
||||||
|
}
|
||||||
|
}
|
||||||
sendClient(commandId + " OK STORE completed");
|
sendClient(commandId + " OK STORE completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1114,12 +1121,14 @@ public class ImapConnection extends AbstractConnection {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void expunge(boolean silent) throws IOException {
|
protected boolean expunge(boolean silent) throws IOException {
|
||||||
|
boolean hasDeleted = false;
|
||||||
if (currentFolder.messages != null) {
|
if (currentFolder.messages != null) {
|
||||||
int index = 1;
|
int index = 1;
|
||||||
for (ExchangeSession.Message message : currentFolder.messages) {
|
for (ExchangeSession.Message message : currentFolder.messages) {
|
||||||
if (message.deleted) {
|
if (message.deleted) {
|
||||||
message.delete();
|
message.delete();
|
||||||
|
hasDeleted = true;
|
||||||
if (!silent) {
|
if (!silent) {
|
||||||
sendClient("* " + index + " EXPUNGE");
|
sendClient("* " + index + " EXPUNGE");
|
||||||
}
|
}
|
||||||
@ -1128,6 +1137,7 @@ public class ImapConnection extends AbstractConnection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return hasDeleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateFlags(ExchangeSession.Message message, String action, String flags) throws IOException {
|
protected void updateFlags(ExchangeSession.Message message, String action, String flags) throws IOException {
|
||||||
|
@ -87,6 +87,7 @@ public class SettingsFrame extends JFrame {
|
|||||||
JCheckBox forceActiveSyncUpdateCheckBox;
|
JCheckBox forceActiveSyncUpdateCheckBox;
|
||||||
JTextField defaultDomainField;
|
JTextField defaultDomainField;
|
||||||
JCheckBox showStartupBannerCheckBox;
|
JCheckBox showStartupBannerCheckBox;
|
||||||
|
JCheckBox imapAutoExpungeCheckBox;
|
||||||
|
|
||||||
protected void addSettingComponent(JPanel panel, String label, JComponent component) {
|
protected void addSettingComponent(JPanel panel, String label, JComponent component) {
|
||||||
addSettingComponent(panel, label, component, null);
|
addSettingComponent(panel, label, component, null);
|
||||||
@ -369,7 +370,7 @@ public class SettingsFrame extends JFrame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected JPanel getOtherSettingsPanel() {
|
protected JPanel getOtherSettingsPanel() {
|
||||||
JPanel otherSettingsPanel = new JPanel(new GridLayout(4, 2));
|
JPanel otherSettingsPanel = new JPanel(new GridLayout(5, 2));
|
||||||
otherSettingsPanel.setBorder(BorderFactory.createTitledBorder(BundleMessage.format("UI_OTHER")));
|
otherSettingsPanel.setBorder(BorderFactory.createTitledBorder(BundleMessage.format("UI_OTHER")));
|
||||||
|
|
||||||
caldavAlarmSoundField = new JTextField(Settings.getProperty("davmail.caldavAlarmSound"), 15);
|
caldavAlarmSoundField = new JTextField(Settings.getProperty("davmail.caldavAlarmSound"), 15);
|
||||||
@ -378,6 +379,8 @@ public class SettingsFrame extends JFrame {
|
|||||||
defaultDomainField = new JTextField(Settings.getProperty("davmail.defaultDomain"), 15);
|
defaultDomainField = new JTextField(Settings.getProperty("davmail.defaultDomain"), 15);
|
||||||
showStartupBannerCheckBox = new JCheckBox();
|
showStartupBannerCheckBox = new JCheckBox();
|
||||||
showStartupBannerCheckBox.setSelected(Settings.getBooleanProperty("davmail.showStartupBanner", true));
|
showStartupBannerCheckBox.setSelected(Settings.getBooleanProperty("davmail.showStartupBanner", true));
|
||||||
|
imapAutoExpungeCheckBox = new JCheckBox();
|
||||||
|
imapAutoExpungeCheckBox.setSelected(Settings.getBooleanProperty("davmail.imapAutoExpunge", true));
|
||||||
|
|
||||||
addSettingComponent(otherSettingsPanel, BundleMessage.format("UI_CALDAV_ALARM_SOUND"), caldavAlarmSoundField,
|
addSettingComponent(otherSettingsPanel, BundleMessage.format("UI_CALDAV_ALARM_SOUND"), caldavAlarmSoundField,
|
||||||
BundleMessage.format("UI_CALDAV_ALARM_SOUND_HELP"));
|
BundleMessage.format("UI_CALDAV_ALARM_SOUND_HELP"));
|
||||||
@ -387,6 +390,8 @@ public class SettingsFrame extends JFrame {
|
|||||||
BundleMessage.format("UI_DEFAULT_DOMAIN_HELP"));
|
BundleMessage.format("UI_DEFAULT_DOMAIN_HELP"));
|
||||||
addSettingComponent(otherSettingsPanel, BundleMessage.format("UI_SHOW_STARTUP_BANNER"), showStartupBannerCheckBox,
|
addSettingComponent(otherSettingsPanel, BundleMessage.format("UI_SHOW_STARTUP_BANNER"), showStartupBannerCheckBox,
|
||||||
BundleMessage.format("UI_SHOW_STARTUP_BANNER_HELP"));
|
BundleMessage.format("UI_SHOW_STARTUP_BANNER_HELP"));
|
||||||
|
addSettingComponent(otherSettingsPanel, BundleMessage.format("UI_IMAP_AUTO_EXPUNGE"), imapAutoExpungeCheckBox,
|
||||||
|
BundleMessage.format("UI_IMAP_AUTO_EXPUNGE_HELP"));
|
||||||
|
|
||||||
Dimension preferredSize = otherSettingsPanel.getPreferredSize();
|
Dimension preferredSize = otherSettingsPanel.getPreferredSize();
|
||||||
preferredSize.width = Integer.MAX_VALUE;
|
preferredSize.width = Integer.MAX_VALUE;
|
||||||
@ -479,6 +484,7 @@ public class SettingsFrame extends JFrame {
|
|||||||
forceActiveSyncUpdateCheckBox.setSelected(Settings.getBooleanProperty("davmail.forceActiveSyncUpdate"));
|
forceActiveSyncUpdateCheckBox.setSelected(Settings.getBooleanProperty("davmail.forceActiveSyncUpdate"));
|
||||||
defaultDomainField.setText(Settings.getProperty("davmail.defaultDomain"));
|
defaultDomainField.setText(Settings.getProperty("davmail.defaultDomain"));
|
||||||
showStartupBannerCheckBox.setSelected(Settings.getBooleanProperty("davmail.showStartupBanner", true));
|
showStartupBannerCheckBox.setSelected(Settings.getBooleanProperty("davmail.showStartupBanner", true));
|
||||||
|
imapAutoExpungeCheckBox.setSelected(Settings.getBooleanProperty("davmail.imapAutoExpunge", true));
|
||||||
|
|
||||||
keystoreTypeCombo.setSelectedItem(Settings.getProperty("davmail.ssl.keystoreType"));
|
keystoreTypeCombo.setSelectedItem(Settings.getProperty("davmail.ssl.keystoreType"));
|
||||||
keystoreFileField.setText(Settings.getProperty("davmail.ssl.keystoreFile"));
|
keystoreFileField.setText(Settings.getProperty("davmail.ssl.keystoreFile"));
|
||||||
@ -590,6 +596,7 @@ public class SettingsFrame extends JFrame {
|
|||||||
Settings.setProperty("davmail.forceActiveSyncUpdate", String.valueOf(forceActiveSyncUpdateCheckBox.isSelected()));
|
Settings.setProperty("davmail.forceActiveSyncUpdate", String.valueOf(forceActiveSyncUpdateCheckBox.isSelected()));
|
||||||
Settings.setProperty("davmail.defaultDomain", String.valueOf(defaultDomainField.getText()));
|
Settings.setProperty("davmail.defaultDomain", String.valueOf(defaultDomainField.getText()));
|
||||||
Settings.setProperty("davmail.showStartupBanner", String.valueOf(showStartupBannerCheckBox.isSelected()));
|
Settings.setProperty("davmail.showStartupBanner", String.valueOf(showStartupBannerCheckBox.isSelected()));
|
||||||
|
Settings.setProperty("davmail.imapAutoExpunge", String.valueOf(imapAutoExpungeCheckBox.isSelected()));
|
||||||
|
|
||||||
Settings.setProperty("davmail.ssl.keystoreType", (String) keystoreTypeCombo.getSelectedItem());
|
Settings.setProperty("davmail.ssl.keystoreType", (String) keystoreTypeCombo.getSelectedItem());
|
||||||
Settings.setProperty("davmail.ssl.keystoreFile", keystoreFileField.getText());
|
Settings.setProperty("davmail.ssl.keystoreFile", keystoreFileField.getText());
|
||||||
|
@ -250,8 +250,10 @@ UI_FORCE_ACTIVESYNC_UPDATE=Force ActiveSync update:
|
|||||||
UI_FORCE_ACTIVESYNC_UPDATE_HELP=Force update of Caldav events for ActiveSync connected devices
|
UI_FORCE_ACTIVESYNC_UPDATE_HELP=Force update of Caldav events for ActiveSync connected devices
|
||||||
UI_DEFAULT_DOMAIN=Default domain:
|
UI_DEFAULT_DOMAIN=Default domain:
|
||||||
UI_DEFAULT_DOMAIN_HELP=Default windows domain name
|
UI_DEFAULT_DOMAIN_HELP=Default windows domain name
|
||||||
UI_USE_SYSTEM_PROXIES=Use system proxy settings :
|
UI_USE_SYSTEM_PROXIES=Use system proxy settings:
|
||||||
UI_SHOW_STARTUP_BANNER=Display startup banner
|
UI_SHOW_STARTUP_BANNER=Display startup banner
|
||||||
UI_SHOW_STARTUP_BANNER_HELP=Whether to show the initial startup notification window or not
|
UI_SHOW_STARTUP_BANNER_HELP=Whether to show the initial startup notification window or not
|
||||||
|
UI_IMAP_AUTO_EXPUNGE=IMAP auto expunge:
|
||||||
|
UI_IMAP_AUTO_EXPUNGE_HELP=Delete messages immediately on the server over IMAP
|
||||||
UI_IMAP_IDLE_DELAY=IDLE folder monitor delay (IMAP):
|
UI_IMAP_IDLE_DELAY=IDLE folder monitor delay (IMAP):
|
||||||
UI_IMAP_IDLE_DELAY_HELP=IMAP folder idle monitor delay in minutes, leave empty to disable IDLE support
|
UI_IMAP_IDLE_DELAY_HELP=IMAP folder idle monitor delay in minutes, leave empty to disable IDLE support
|
||||||
|
@ -249,8 +249,10 @@ UI_DEFAULT_DOMAIN_HELP=Nom du domaine windows par d
|
|||||||
EXCEPTION_UNSUPPORTED_PARAMETER=Paramètre non supporté : {0}
|
EXCEPTION_UNSUPPORTED_PARAMETER=Paramètre non supporté : {0}
|
||||||
EXCEPTION_INVALID_PARAMETER=Paramètre invalide : {0}
|
EXCEPTION_INVALID_PARAMETER=Paramètre invalide : {0}
|
||||||
UI_USE_SYSTEM_PROXIES=Utiliser la configuration système :
|
UI_USE_SYSTEM_PROXIES=Utiliser la configuration système :
|
||||||
UI_SHOW_STARTUP_BANNER=Notification au lancement
|
UI_SHOW_STARTUP_BANNER=Notification au lancement :
|
||||||
UI_SHOW_STARTUP_BANNER_HELP=Afficher ou non la fenêtre de notification au démarrage
|
UI_SHOW_STARTUP_BANNER_HELP=Afficher ou non la fenêtre de notification au démarrage
|
||||||
LOG_READ_CLIENT_AUTH_LOGIN=< AUTH LOGIN ********
|
LOG_READ_CLIENT_AUTH_LOGIN=< AUTH LOGIN ********
|
||||||
UI_IMAP_IDLE_DELAY=Délai de surveillance dossier (IMAP) :
|
UI_IMAP_IDLE_DELAY=Délai de surveillance dossier (IMAP) :
|
||||||
UI_IMAP_IDLE_DELAY_HELP=Délai de surveillance du dossier IMAP en minutes, laisser vide pour désactiver le support IDLE
|
UI_IMAP_IDLE_DELAY_HELP=Délai de surveillance du dossier IMAP en minutes, laisser vide pour désactiver le support IDLE
|
||||||
|
UI_IMAP_AUTO_EXPUNGE=IMAP suppression immédiate :
|
||||||
|
UI_IMAP_AUTO_EXPUNGE_HELP=Supprimer immédiatement les messages du serveur via IMAP
|
@ -172,6 +172,9 @@
|
|||||||
<p>A workaround with Thunderbird is to set the property
|
<p>A workaround with Thunderbird is to set the property
|
||||||
<code>mail.imap.expunge_after_delete=true</code>
|
<code>mail.imap.expunge_after_delete=true</code>
|
||||||
</p>
|
</p>
|
||||||
|
<p>New: a new setting is available in DavMail to delete messages immediately over IMAP:
|
||||||
|
<code>davmail.imapAutoExpunge=true</code>
|
||||||
|
</p>
|
||||||
</subsection>
|
</subsection>
|
||||||
|
|
||||||
<subsection name="Build">
|
<subsection name="Build">
|
||||||
|
@ -91,6 +91,11 @@
|
|||||||
<td>Use double event update to trigger ActiveSync mobile phones sync</td>
|
<td>Use double event update to trigger ActiveSync mobile phones sync</td>
|
||||||
<td>false</td>
|
<td>false</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>IMAP auto expunge</td>
|
||||||
|
<td>Delete messages immediately on the server over IMAP</td>
|
||||||
|
<td>true</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Display startup banner</td>
|
<td>Display startup banner</td>
|
||||||
<td>Whether to show the initial startup notification window or not</td>
|
<td>Whether to show the initial startup notification window or not</td>
|
||||||
|
Loading…
Reference in New Issue
Block a user