diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-11-12 12:45:59 +0100 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-11-12 12:45:59 +0100 |
commit | f1e2be4096d1c023adc2c9eec49bcf64b9a453de (patch) | |
tree | 61906bcc5b3b3da2a077638dcac4ce734d804c91 /src/main/java/eu/siacs/conversations/ui | |
parent | 52ca2e7391acd6e34eb1dfc4c6f893bc154dec37 (diff) |
check if account is online before doing smp
Diffstat (limited to 'src/main/java/eu/siacs/conversations/ui')
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/VerifyOTRActivity.java | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/VerifyOTRActivity.java b/src/main/java/eu/siacs/conversations/ui/VerifyOTRActivity.java index 2a425d12..31884bd2 100644 --- a/src/main/java/eu/siacs/conversations/ui/VerifyOTRActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/VerifyOTRActivity.java @@ -50,29 +50,33 @@ public class VerifyOTRActivity extends XmppActivity implements XmppConnectionSer private View.OnClickListener mCreateSharedSecretListener = new View.OnClickListener() { @Override public void onClick(final View view) { - final String question = mSharedSecretHint.getText().toString(); - final String secret = mSharedSecretSecret.getText().toString(); - if (!initSmp(question,secret)) { - Toast.makeText(getApplicationContext(),"smp failed",Toast.LENGTH_SHORT).show(); + if (isAccountOnline()) { + final String question = mSharedSecretHint.getText().toString(); + final String secret = mSharedSecretSecret.getText().toString(); + initSmp(question, secret); + updateView(); } - updateView(); } }; private View.OnClickListener mCancelSharedSecretListener = new View.OnClickListener() { @Override public void onClick(View view) { - abortSmp(); - updateView(); + if (isAccountOnline()) { + abortSmp(); + updateView(); + } } }; private View.OnClickListener mRespondSharedSecretListener = new View.OnClickListener() { @Override public void onClick(View view) { - final String question = mSharedSecretHint.getText().toString(); - final String secret = mSharedSecretSecret.getText().toString(); - respondSmp(question,secret); - updateView(); + if (isAccountOnline()) { + final String question = mSharedSecretHint.getText().toString(); + final String secret = mSharedSecretSecret.getText().toString(); + respondSmp(question, secret); + updateView(); + } } }; private View.OnClickListener mRetrySharedSecretListener = new View.OnClickListener() { @@ -138,6 +142,15 @@ public class VerifyOTRActivity extends XmppActivity implements XmppConnectionSer } } + protected boolean isAccountOnline() { + if (this.mAccount.getStatus() != Account.STATUS_ONLINE) { + Toast.makeText(this,R.string.not_connected_try_again,Toast.LENGTH_SHORT).show(); + return false; + } else { + return true; + } + } + protected boolean handleIntent(Intent intent) { if (intent.getAction().equals(ACTION_VERIFY_CONTACT)) { try { |