aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2017-12-05 19:16:53 +0100
committerDaniel Gultsch <daniel@gultsch.de>2017-12-05 19:16:53 +0100
commit97821f0633ee708939a95cf4b71599cb2367b036 (patch)
tree4bf575c2d5143be51dd8fdd798bd00629d0bf137
parent0e6d3db92622cb1e6bc5e9b89ae6089a5433cc70 (diff)
possible fix for retry loop on pgp key annoucement
-rw-r--r--src/main/java/eu/siacs/conversations/crypto/PgpEngine.java5
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConversationActivity.java6
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConversationFragment.java2
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ManageAccountActivity.java6
-rw-r--r--src/main/java/eu/siacs/conversations/ui/SetPresenceActivity.java4
-rw-r--r--src/main/java/eu/siacs/conversations/ui/XmppActivity.java4
6 files changed, 13 insertions, 14 deletions
diff --git a/src/main/java/eu/siacs/conversations/crypto/PgpEngine.java b/src/main/java/eu/siacs/conversations/crypto/PgpEngine.java
index 3c40697..ce04508 100644
--- a/src/main/java/eu/siacs/conversations/crypto/PgpEngine.java
+++ b/src/main/java/eu/siacs/conversations/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/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
index f8f5159..3e161f9 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
@@ -913,7 +913,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();
@@ -1420,7 +1420,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());
}
@@ -1430,7 +1430,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/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
index 4dd7f84..897bd7c 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
@@ -1510,7 +1510,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/eu/siacs/conversations/ui/ManageAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/ManageAccountActivity.java
index 3783519..defffd8 100644
--- a/src/main/java/eu/siacs/conversations/ui/ManageAccountActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ManageAccountActivity.java
@@ -346,7 +346,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();
}
@@ -378,12 +378,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/eu/siacs/conversations/ui/SetPresenceActivity.java b/src/main/java/eu/siacs/conversations/ui/SetPresenceActivity.java
index ca1fb8f..38f51d4 100644
--- a/src/main/java/eu/siacs/conversations/ui/SetPresenceActivity.java
+++ b/src/main/java/eu/siacs/conversations/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/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
index e23dfd5..8bf84af 100644
--- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
@@ -543,7 +543,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 {
@@ -554,7 +554,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) {