|
|
@ -49,7 +49,6 @@ import android.net.Uri;
|
|
|
|
import android.os.Build;
|
|
|
|
import android.os.Build;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.os.Handler;
|
|
|
|
import android.os.Handler;
|
|
|
|
import android.os.OperationCanceledException;
|
|
|
|
|
|
|
|
import android.provider.ContactsContract;
|
|
|
|
import android.provider.ContactsContract;
|
|
|
|
import android.provider.MediaStore;
|
|
|
|
import android.provider.MediaStore;
|
|
|
|
import android.provider.Settings;
|
|
|
|
import android.provider.Settings;
|
|
|
@ -1676,11 +1675,14 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
if (recipients.size() == 0)
|
|
|
|
if (recipients.size() == 0)
|
|
|
|
throw new IllegalArgumentException(getString(R.string.title_to_missing));
|
|
|
|
throw new IllegalArgumentException(getString(R.string.title_to_missing));
|
|
|
|
|
|
|
|
|
|
|
|
pgpUserIds = new String[recipients.size()];
|
|
|
|
List<String> emails = new ArrayList<>();
|
|
|
|
for (int i = 0; i < recipients.size(); i++) {
|
|
|
|
for (int i = 0; i < recipients.size(); i++) {
|
|
|
|
InternetAddress recipient = (InternetAddress) recipients.get(i);
|
|
|
|
InternetAddress recipient = (InternetAddress) recipients.get(i);
|
|
|
|
pgpUserIds[i] = recipient.getAddress().toLowerCase();
|
|
|
|
String email = recipient.getAddress().toLowerCase();
|
|
|
|
|
|
|
|
if (!emails.contains(email))
|
|
|
|
|
|
|
|
emails.add(email);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pgpUserIds = emails.toArray(new String[0]);
|
|
|
|
|
|
|
|
|
|
|
|
Intent intent;
|
|
|
|
Intent intent;
|
|
|
|
if (EntityMessage.PGP_SIGNONLY.equals(draft.ui_encrypt))
|
|
|
|
if (EntityMessage.PGP_SIGNONLY.equals(draft.ui_encrypt))
|
|
|
@ -2206,8 +2208,9 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
// Sign/encrypt
|
|
|
|
// Sign/encrypt
|
|
|
|
pgpKeyIds = result.getLongArrayExtra(OpenPgpApi.EXTRA_KEY_IDS);
|
|
|
|
pgpKeyIds = result.getLongArrayExtra(OpenPgpApi.EXTRA_KEY_IDS);
|
|
|
|
Log.i("Keys=" + pgpKeyIds.length);
|
|
|
|
Log.i("Keys=" + pgpKeyIds.length);
|
|
|
|
if (pgpKeyIds.length == 0)
|
|
|
|
if (pgpKeyIds.length != pgpUserIds.length)
|
|
|
|
throw new OperationCanceledException("Got no key");
|
|
|
|
throw new IllegalArgumentException(context.getString(R.string.title_key_missing,
|
|
|
|
|
|
|
|
TextUtils.join(", ", pgpUserIds)));
|
|
|
|
|
|
|
|
|
|
|
|
if (identity.sign_key != null) {
|
|
|
|
if (identity.sign_key != null) {
|
|
|
|
pgpSignKeyId = identity.sign_key;
|
|
|
|
pgpSignKeyId = identity.sign_key;
|
|
|
@ -2336,9 +2339,7 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void onException(Bundle args, Throwable ex) {
|
|
|
|
protected void onException(Bundle args, Throwable ex) {
|
|
|
|
if (ex instanceof OperationCanceledException)
|
|
|
|
if (ex instanceof IllegalArgumentException
|
|
|
|
; // Do nothing
|
|
|
|
|
|
|
|
else if (ex instanceof IllegalArgumentException
|
|
|
|
|
|
|
|
|| ex instanceof GeneralSecurityException /* InvalidKeyException */) {
|
|
|
|
|| ex instanceof GeneralSecurityException /* InvalidKeyException */) {
|
|
|
|
Log.i(ex);
|
|
|
|
Log.i(ex);
|
|
|
|
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG)
|
|
|
|
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG)
|
|
|
|