Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 87640719 authored by Jesse Vincent's avatar Jesse Vincent
Browse files

Disable "download by date range" for webdav and pop3.

The previous behavior caused catastrophic network abuse, downloading
messages outside the date range over and over.
parent b85c9b7b
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -977,6 +977,18 @@ public class Account implements BaseAccount {
        return Store.getRemoteInstance(this);
    }

    // It'd be great if this actually went into the store implementation
    // to get this, but that's expensive and not easilly accessible
    // during initialization
    public boolean isSearchByDateCapable() {
        if (getStoreUri().startsWith("imap")) {
            return true;
        } else {
            return false;
        }
    }


    @Override
    public synchronized String toString() {
        return mDescription;
+22 −12
Original line number Diff line number Diff line
@@ -385,7 +385,13 @@ public class AccountSettings extends K9PreferenceActivity {
            }
        });

    

        mMessageAge = (ListPreference) findPreference(PREFERENCE_MESSAGE_AGE);

        if (!mAccount.isSearchByDateCapable()) {
            mMessageAge.setEnabled(false);
        } else {
	        mMessageAge.setValue(String.valueOf(mAccount.getMaximumPolledMessageAge()));
	        mMessageAge.setSummary(mMessageAge.getEntry());
	        mMessageAge.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@@ -398,6 +404,8 @@ public class AccountSettings extends K9PreferenceActivity {
	            }
	        });
	
        }

        mMessageSize = (ListPreference) findPreference(PREFERENCE_MESSAGE_SIZE);
        mMessageSize.setValue(String.valueOf(mAccount.getMaximumAutoDownloadMessageSize()));
        mMessageSize.setSummary(mMessageSize.getEntry());
@@ -683,8 +691,10 @@ public class AccountSettings extends K9PreferenceActivity {
        mAccount.setNotifySelfNewMail(mAccountNotifySelf.isChecked());
        mAccount.setShowOngoing(mAccountNotifySync.isChecked());
        mAccount.setDisplayCount(Integer.parseInt(mDisplayCount.getValue()));
        mAccount.setMaximumPolledMessageAge(Integer.parseInt(mMessageAge.getValue()));
        mAccount.setMaximumAutoDownloadMessageSize(Integer.parseInt(mMessageSize.getValue()));
        if (mAccount.isSearchByDateCapable()) {
            mAccount.setMaximumPolledMessageAge(Integer.parseInt(mMessageAge.getValue()));
        }
        mAccount.getNotificationSetting().setVibrate(mAccountVibrate.isChecked());
        mAccount.getNotificationSetting().setVibratePattern(Integer.parseInt(mAccountVibratePattern.getValue()));
        mAccount.getNotificationSetting().setVibrateTimes(Integer.parseInt(mAccountVibrateTimes.getValue()));
+1 −1
Original line number Diff line number Diff line
@@ -1534,7 +1534,7 @@ public class MessagingController implements Runnable {
            return false;

        }
        if (message.olderThan(earliestDate)) {
        if (account.isSearchByDateCapable() && message.olderThan(earliestDate)) {
            if (K9.DEBUG) {
                Log.d(K9.LOG_TAG, "Message " + message.getUid() + " is older than "
                      + earliestDate + ", hence not saving");