aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-12-10 21:42:25 +0100
committerChristian Schneppe <christian@pix-art.de>2017-12-10 21:42:25 +0100
commitc528e0ac5e6db450304a7eaf1aeb5ced47757d8e (patch)
tree1bc06bcb35a33680d49596472c98d34f69d08176
parent869a475235833392042097d78424f57fe9e82e09 (diff)
possible fix for retry loop on pgp key annoucement
Diffstat (limited to '')
-rw-r--r--src/main/java/de/pixart/messenger/crypto/PgpEngine.java5
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationActivity.java6
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java3
-rw-r--r--src/main/java/de/pixart/messenger/ui/EditAccountActivity.java2
-rw-r--r--src/main/java/de/pixart/messenger/ui/ManageAccountActivity.java6
-rw-r--r--src/main/java/de/pixart/messenger/ui/SetPresenceActivity.java4
-rw-r--r--src/main/java/de/pixart/messenger/ui/XmppActivity.java4
7 files changed, 14 insertions, 16 deletions
diff --git a/src/main/java/de/pixart/messenger/crypto/PgpEngine.java b/src/main/java/de/pixart/messenger/crypto/PgpEngine.java
index 1979acbb9..5f8233807 100644
--- a/src/main/java/de/pixart/messenger/crypto/PgpEngine.java
+++ b/src/main/java/de/pixart/messenger/crypto/PgpEngine.java
@@ -209,12 +209,11 @@ public class PgpEngine {
});
}
- public void generateSignature(final Account account, String status,
- final UiCallback<Account> callback) {
+ public void generateSignature(Intent intent, final Account account, String status, final UiCallback<Account> callback) {
if (account.getPgpId() == 0) {
return;
}
- Intent params = new Intent();
+ Intent params = intent == null ? new Intent() : intent;
params.setAction(OpenPgpApi.ACTION_CLEARTEXT_SIGN);
params.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true);
params.putExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID, account.getPgpId());
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java
index ddda44cc8..c859264a9 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java
@@ -1076,7 +1076,7 @@ public class ConversationActivity extends XmppActivity
conversation.setNextEncryption(Message.ENCRYPTION_PGP);
item.setChecked(true);
} else {
- announcePgp(conversation.getAccount(), conversation, onOpenPGPKeyPublished);
+ announcePgp(conversation.getAccount(), conversation, null, onOpenPGPKeyPublished);
}
} else {
showInstallPgpDialog();
@@ -1598,7 +1598,7 @@ public class ConversationActivity extends XmppActivity
// associate selected PGP keyId with the account
mSelectedConversation.getAccount().setPgpSignId(data.getExtras().getLong(OpenPgpApi.EXTRA_SIGN_KEY_ID));
// we need to announce the key as described in XEP-027
- announcePgp(mSelectedConversation.getAccount(), null, onOpenPGPKeyPublished);
+ announcePgp(mSelectedConversation.getAccount(), null, null, onOpenPGPKeyPublished);
} else {
choosePgpSignId(mSelectedConversation.getAccount());
}
@@ -1608,7 +1608,7 @@ public class ConversationActivity extends XmppActivity
}
} else if (requestCode == REQUEST_ANNOUNCE_PGP) {
if (xmppConnectionServiceBound) {
- announcePgp(mSelectedConversation.getAccount(), mSelectedConversation, onOpenPGPKeyPublished);
+ announcePgp(mSelectedConversation.getAccount(), mSelectedConversation, data, onOpenPGPKeyPublished);
this.mPostponedActivityResult = null;
} else {
this.mPostponedActivityResult = new Pair<>(requestCode, data);
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
index 21d1953bc..1cbf8c1eb 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
@@ -1174,7 +1174,6 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
(Config.supportOpenPgp() && account.isPgpDecryptionServiceConnected()) ||
Config.supportOtr()))) {
if (ENCRYPTION_EXCEPTIONS.contains(conversation.getJid().toString()) || conversation.getJid().toString().equals(account.getJid().getDomainpart())) {
- Log.d(Config.LOGTAG, "Don't show unenctrypted warning because " + conversation.getJid().toString() + " is on exception list");
hideSnackbar();
} else {
showSnackbar(R.string.conversation_unencrypted_hint, R.string.ok, mHideUnencryptionHint, null);
@@ -1534,7 +1533,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
return;
}
if (conversation.getAccount().getPgpSignature() == null) {
- activity.announcePgp(conversation.getAccount(), conversation, activity.onOpenPGPKeyPublished);
+ activity.announcePgp(conversation.getAccount(), conversation, null, activity.onOpenPGPKeyPublished);
return;
}
if (!mSendingPgpMessage.compareAndSet(false, true)) {
diff --git a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
index 842a37aca..bb79bc67c 100644
--- a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
@@ -807,7 +807,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
private void publishOpenPGPPublicKey(Account account) {
if (EditAccountActivity.this.hasPgp()) {
- announcePgp(account, null, onOpenPGPKeyPublished);
+ announcePgp(account, null, null, onOpenPGPKeyPublished);
} else {
this.showInstallPgpDialog();
}
diff --git a/src/main/java/de/pixart/messenger/ui/ManageAccountActivity.java b/src/main/java/de/pixart/messenger/ui/ManageAccountActivity.java
index 4c36d2681..4a17a4fbc 100644
--- a/src/main/java/de/pixart/messenger/ui/ManageAccountActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ManageAccountActivity.java
@@ -331,7 +331,7 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
private void publishOpenPGPPublicKey(Account account) {
if (ManageAccountActivity.this.hasPgp()) {
- announcePgp(selectedAccount, null, onOpenPGPKeyPublished);
+ announcePgp(selectedAccount, null, null, onOpenPGPKeyPublished);
} else {
this.showInstallPgpDialog();
}
@@ -363,12 +363,12 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
if (requestCode == REQUEST_CHOOSE_PGP_ID) {
if (data.getExtras().containsKey(OpenPgpApi.EXTRA_SIGN_KEY_ID)) {
selectedAccount.setPgpSignId(data.getExtras().getLong(OpenPgpApi.EXTRA_SIGN_KEY_ID));
- announcePgp(selectedAccount, null, onOpenPGPKeyPublished);
+ announcePgp(selectedAccount, null, null, onOpenPGPKeyPublished);
} else {
choosePgpSignId(selectedAccount);
}
} else if (requestCode == REQUEST_ANNOUNCE_PGP) {
- announcePgp(selectedAccount, null, onOpenPGPKeyPublished);
+ announcePgp(selectedAccount, null, data, onOpenPGPKeyPublished);
}
this.mPostponedActivityResult = null;
} else {
diff --git a/src/main/java/de/pixart/messenger/ui/SetPresenceActivity.java b/src/main/java/de/pixart/messenger/ui/SetPresenceActivity.java
index c57f1e3ea..18d28914e 100644
--- a/src/main/java/de/pixart/messenger/ui/SetPresenceActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/SetPresenceActivity.java
@@ -94,7 +94,7 @@ public class SetPresenceActivity extends XmppActivity implements View.OnClickLis
if (resultCode == RESULT_OK) {
if (xmppConnectionServiceBound && mAccount != null) {
if (requestCode == REQUEST_ANNOUNCE_PGP) {
- announcePgp(mAccount, null, onPresenceChanged);
+ announcePgp(mAccount, null, data, onPresenceChanged);
}
this.mPostponedActivityResult = null;
} else {
@@ -116,7 +116,7 @@ public class SetPresenceActivity extends XmppActivity implements View.OnClickLis
finish();
} else {
xmppConnectionService.changeStatus(mAccount, status, statusMessage, false);
- announcePgp(mAccount, null, onPresenceChanged);
+ announcePgp(mAccount, null, null, onPresenceChanged);
}
}
}
diff --git a/src/main/java/de/pixart/messenger/ui/XmppActivity.java b/src/main/java/de/pixart/messenger/ui/XmppActivity.java
index df6f6980d..568fe4d16 100644
--- a/src/main/java/de/pixart/messenger/ui/XmppActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/XmppActivity.java
@@ -553,7 +553,7 @@ public abstract class XmppActivity extends Activity {
startActivityForResult(intent, REQUEST_INVITE_TO_CONVERSATION);
}
- protected void announcePgp(Account account, final Conversation conversation, final Runnable onSuccess) {
+ protected void announcePgp(Account account, final Conversation conversation, Intent intent, final Runnable onSuccess) {
if (account.getPgpId() == 0) {
choosePgpSignId(account);
} else {
@@ -564,7 +564,7 @@ public abstract class XmppActivity extends Activity {
if (status == null) {
status = "";
}
- xmppConnectionService.getPgpEngine().generateSignature(account, status, new UiCallback<Account>() {
+ xmppConnectionService.getPgpEngine().generateSignature(intent, account, status, new UiCallback<Account>() {
@Override
public void userInputRequried(PendingIntent pi, Account account) {