1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-24 02:12:15 -05:00

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.
This commit is contained in:
Joe Steele 2014-02-28 19:33:25 -05:00
parent 9dc5338501
commit d67c054d4d

View File

@ -15,6 +15,7 @@ import android.widget.*;
import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.CompoundButton.OnCheckedChangeListener;
import com.fsck.k9.*; import com.fsck.k9.*;
import com.fsck.k9.Account.FolderMode;
import com.fsck.k9.activity.K9Activity; import com.fsck.k9.activity.K9Activity;
import com.fsck.k9.activity.setup.AccountSetupCheckSettings.CheckDirection; import com.fsck.k9.activity.setup.AccountSetupCheckSettings.CheckDirection;
import com.fsck.k9.helper.Utility; 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.WebDavStore;
import com.fsck.k9.mail.store.ImapStore.ImapStoreSettings; import com.fsck.k9.mail.store.ImapStore.ImapStoreSettings;
import com.fsck.k9.mail.store.WebDavStore.WebDavStoreSettings; import com.fsck.k9.mail.store.WebDavStore.WebDavStoreSettings;
import com.fsck.k9.service.MailService;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URI; import java.net.URI;
@ -356,6 +358,16 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
public void onActivityResult(int requestCode, int resultCode, Intent data) { public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) { if (resultCode == RESULT_OK) {
if (Intent.ACTION_EDIT.equals(getIntent().getAction())) { 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)); mAccount.save(Preferences.getPreferences(this));
finish(); finish();
} else { } else {