From d67c054d4dc565c7e102ac742c5e14c76a1c66f0 Mon Sep 17 00:00:00 2001 From: Joe Steele Date: Fri, 28 Feb 2014 19:33:25 -0500 Subject: [PATCH] Restart pushers after editing server settings If an error occurs while connecting for push (for example, if the server's certificate fails authentication), several more attempts will be made to connect, then finally all attempts will cease. This commit makes it so that pushers are restarted if the user goes in and edits the server settings (presumably because the user was notified of a problem and is attempting to fix it). Without this, the user could fix the problem and would still not receive email via push. --- .../fsck/k9/activity/setup/AccountSetupIncoming.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/com/fsck/k9/activity/setup/AccountSetupIncoming.java b/src/com/fsck/k9/activity/setup/AccountSetupIncoming.java index abecd290e..b275e005d 100644 --- a/src/com/fsck/k9/activity/setup/AccountSetupIncoming.java +++ b/src/com/fsck/k9/activity/setup/AccountSetupIncoming.java @@ -15,6 +15,7 @@ import android.widget.*; import android.widget.CompoundButton.OnCheckedChangeListener; import com.fsck.k9.*; +import com.fsck.k9.Account.FolderMode; import com.fsck.k9.activity.K9Activity; import com.fsck.k9.activity.setup.AccountSetupCheckSettings.CheckDirection; import com.fsck.k9.helper.Utility; @@ -27,6 +28,7 @@ import com.fsck.k9.mail.store.Pop3Store; import com.fsck.k9.mail.store.WebDavStore; import com.fsck.k9.mail.store.ImapStore.ImapStoreSettings; import com.fsck.k9.mail.store.WebDavStore.WebDavStoreSettings; +import com.fsck.k9.service.MailService; import java.io.UnsupportedEncodingException; import java.net.URI; @@ -356,6 +358,16 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { if (Intent.ACTION_EDIT.equals(getIntent().getAction())) { + boolean isPushCapable = false; + try { + Store store = mAccount.getRemoteStore(); + isPushCapable = store.isPushCapable(); + } catch (Exception e) { + Log.e(K9.LOG_TAG, "Could not get remote store", e); + } + if (isPushCapable && mAccount.getFolderPushMode() != FolderMode.NONE) { + MailService.actionRestartPushers(this, null); + } mAccount.save(Preferences.getPreferences(this)); finish(); } else {