aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/eu/siacs/conversations/crypto/PgpEngine.java10
-rw-r--r--src/eu/siacs/conversations/entities/MucOptions.java14
-rw-r--r--src/eu/siacs/conversations/ui/MucDetailsActivity.java9
3 files changed, 29 insertions, 4 deletions
diff --git a/src/eu/siacs/conversations/crypto/PgpEngine.java b/src/eu/siacs/conversations/crypto/PgpEngine.java
index 0f2aeff4..b10275f6 100644
--- a/src/eu/siacs/conversations/crypto/PgpEngine.java
+++ b/src/eu/siacs/conversations/crypto/PgpEngine.java
@@ -17,6 +17,7 @@ import org.openintents.openpgp.util.OpenPgpApi.IOpenPgpCallback;
import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Contact;
+import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.entities.Message;
import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.ui.UiCallback;
@@ -114,10 +115,15 @@ public class PgpEngine {
}
public void encrypt(final Message message,final UiCallback callback) {
- long[] keys = { message.getConversation().getContact().getPgpKeyId() };
+
Intent params = new Intent();
params.setAction(OpenPgpApi.ACTION_ENCRYPT);
- params.putExtra(OpenPgpApi.EXTRA_KEY_IDS, keys);
+ if (message.getConversation().getMode() == Conversation.MODE_SINGLE) {
+ long[] keys = { message.getConversation().getContact().getPgpKeyId() };
+ params.putExtra(OpenPgpApi.EXTRA_KEY_IDS, keys);
+ } else {
+ params.putExtra(OpenPgpApi.EXTRA_KEY_IDS, message.getConversation().getMucOptions().getPgpKeyIds());
+ }
params.putExtra(OpenPgpApi.EXTRA_ACCOUNT_NAME, message.getConversation().getAccount().getJid());
if (message.getType() == Message.TYPE_TEXT) {
diff --git a/src/eu/siacs/conversations/entities/MucOptions.java b/src/eu/siacs/conversations/entities/MucOptions.java
index ba2b9bbf..c1750334 100644
--- a/src/eu/siacs/conversations/entities/MucOptions.java
+++ b/src/eu/siacs/conversations/entities/MucOptions.java
@@ -236,4 +236,18 @@ public class MucOptions {
public void flagAboutToRename() {
this.aboutToRename = true;
}
+
+ public long[] getPgpKeyIds() {
+ List<Long> ids = new ArrayList<Long>();
+ for(User user : getUsers()) {
+ if(user.getPgpKeyId()!=0) {
+ ids.add(user.getPgpKeyId());
+ }
+ }
+ long[] primitivLongArray = new long[ids.size()];
+ for(int i = 0; i < ids.size(); ++i) {
+ primitivLongArray[i] = ids.get(i);
+ }
+ return primitivLongArray;
+ }
} \ No newline at end of file
diff --git a/src/eu/siacs/conversations/ui/MucDetailsActivity.java b/src/eu/siacs/conversations/ui/MucDetailsActivity.java
index bee7789f..48cf6e81 100644
--- a/src/eu/siacs/conversations/ui/MucDetailsActivity.java
+++ b/src/eu/siacs/conversations/ui/MucDetailsActivity.java
@@ -3,6 +3,8 @@ package eu.siacs.conversations.ui;
import java.util.ArrayList;
import java.util.List;
+import org.openintents.openpgp.util.OpenPgpUtils;
+
import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.entities.MucOptions;
@@ -176,12 +178,15 @@ public class MucDetailsActivity extends XmppActivity {
((TextView) view.findViewById(R.id.contact_display_name))
.setText(contact.getName());
TextView role = (TextView) view.findViewById(R.id.contact_jid);
- role.setText(getReadableRole(contact.getRole()));
+ if (contact.getPgpKeyId()==0) {
+ role.setText(getReadableRole(contact.getRole()));
+ } else {
+ role.setText(getReadableRole(contact.getRole())+" \u00B7 "+OpenPgpUtils.convertKeyIdToHex(contact.getPgpKeyId()));
+ }
ImageView imageView = (ImageView) view
.findViewById(R.id.contact_photo);
imageView.setImageBitmap(UIHelper.getContactPicture(contact.getName(), 48,this.getApplicationContext(), false));
membersView.addView(view);
- Log.d(LOGTAG,contact.getName()+" pgp id: "+contact.getPgpKeyId());
}
}
} else {