Check for S/MIME public key

pull/194/head
M66B 5 years ago
parent 18367a9093
commit 6339800a81

@ -4710,9 +4710,8 @@ public class FragmentCompose extends FragmentBase {
// identity != null && identity.sender_extra) // identity != null && identity.sender_extra)
// args.putBoolean("remind_extra", true); // args.putBoolean("remind_extra", true);
if (pgpService != null && pgpService.isBound() && if (draft.ui_encrypt == null ||
(draft.ui_encrypt == null || EntityMessage.ENCRYPT_NONE.equals(draft.ui_encrypt)) {
EntityMessage.ENCRYPT_NONE.equals(draft.ui_encrypt))) {
List<Address> recipients = new ArrayList<>(); List<Address> recipients = new ArrayList<>();
if (draft.to != null) if (draft.to != null)
recipients.addAll(Arrays.asList(draft.to)); recipients.addAll(Arrays.asList(draft.to));
@ -4722,6 +4721,7 @@ public class FragmentCompose extends FragmentBase {
recipients.addAll(Arrays.asList(draft.bcc)); recipients.addAll(Arrays.asList(draft.bcc));
if (recipients.size() > 0) { if (recipients.size() > 0) {
if (pgpService != null && pgpService.isBound()) {
String[] userIds = new String[recipients.size()]; String[] userIds = new String[recipients.size()];
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);
@ -4743,7 +4743,18 @@ public class FragmentCompose extends FragmentBase {
Log.w(ex); Log.w(ex);
} }
} }
for (Address address : recipients) {
String email = ((InternetAddress) address).getAddress();
List<EntityCertificate> certs = db.certificate().getCertificateByEmail(email);
if (certs != null && certs.size() > 0) {
args.putBoolean("remind_smime", true);
break;
}
}
} }
}
if (TextUtils.isEmpty(draft.subject)) if (TextUtils.isEmpty(draft.subject))
args.putBoolean("remind_subject", true); args.putBoolean("remind_subject", true);
@ -4982,6 +4993,7 @@ public class FragmentCompose extends FragmentBase {
boolean remind_dsn = args.getBoolean("remind_dsn", false); boolean remind_dsn = args.getBoolean("remind_dsn", false);
boolean remind_size = args.getBoolean("remind_size", false); boolean remind_size = args.getBoolean("remind_size", false);
boolean remind_pgp = args.getBoolean("remind_pgp", false); boolean remind_pgp = args.getBoolean("remind_pgp", false);
boolean remind_smime = args.getBoolean("remind_smime", false);
boolean remind_to = args.getBoolean("remind_to", false); boolean remind_to = args.getBoolean("remind_to", false);
boolean remind_extra = args.getBoolean("remind_extra", false); boolean remind_extra = args.getBoolean("remind_extra", false);
boolean remind_subject = args.getBoolean("remind_subject", false); boolean remind_subject = args.getBoolean("remind_subject", false);
@ -4993,7 +5005,7 @@ public class FragmentCompose extends FragmentBase {
(draft.cc == null ? 0 : draft.cc.length) + (draft.cc == null ? 0 : draft.cc.length) +
(draft.bcc == null ? 0 : draft.bcc.length); (draft.bcc == null ? 0 : draft.bcc.length);
if (send_dialog || force_dialog || if (send_dialog || force_dialog ||
address_error != null || mx_error != null || remind_dsn || remind_size || remind_pgp || remind_to || address_error != null || mx_error != null || remind_dsn || remind_size || remind_pgp || remind_smime || remind_to ||
recipients > RECIPIENTS_WARNING || recipients > RECIPIENTS_WARNING ||
(formatted && (draft.plain_only != null && draft.plain_only)) || (formatted && (draft.plain_only != null && draft.plain_only)) ||
(send_reminders && (send_reminders &&
@ -5617,6 +5629,7 @@ public class FragmentCompose extends FragmentBase {
final boolean remind_dsn = args.getBoolean("remind_dsn", false); final boolean remind_dsn = args.getBoolean("remind_dsn", false);
final boolean remind_size = args.getBoolean("remind_size", false); final boolean remind_size = args.getBoolean("remind_size", false);
final boolean remind_pgp = args.getBoolean("remind_pgp", false); final boolean remind_pgp = args.getBoolean("remind_pgp", false);
final boolean remind_smime = args.getBoolean("remind_smime", false);
final boolean remind_to = args.getBoolean("remind_to", false); final boolean remind_to = args.getBoolean("remind_to", false);
final boolean remind_extra = args.getBoolean("remind_extra", false); final boolean remind_extra = args.getBoolean("remind_extra", false);
final boolean remind_subject = args.getBoolean("remind_subject", false); final boolean remind_subject = args.getBoolean("remind_subject", false);
@ -5641,6 +5654,7 @@ public class FragmentCompose extends FragmentBase {
final TextView tvRemindDsn = dview.findViewById(R.id.tvRemindDsn); final TextView tvRemindDsn = dview.findViewById(R.id.tvRemindDsn);
final TextView tvRemindSize = dview.findViewById(R.id.tvRemindSize); final TextView tvRemindSize = dview.findViewById(R.id.tvRemindSize);
final TextView tvRemindPgp = dview.findViewById(R.id.tvRemindPgp); final TextView tvRemindPgp = dview.findViewById(R.id.tvRemindPgp);
final TextView tvRemindSmime = dview.findViewById(R.id.tvRemindSmime);
final TextView tvRemindTo = dview.findViewById(R.id.tvRemindTo); final TextView tvRemindTo = dview.findViewById(R.id.tvRemindTo);
final TextView tvRemindExtra = dview.findViewById(R.id.tvRemindExtra); final TextView tvRemindExtra = dview.findViewById(R.id.tvRemindExtra);
final TextView tvRemindSubject = dview.findViewById(R.id.tvRemindSubject); final TextView tvRemindSubject = dview.findViewById(R.id.tvRemindSubject);
@ -5675,6 +5689,7 @@ public class FragmentCompose extends FragmentBase {
tvRemindSize.setVisibility(remind_size ? View.VISIBLE : View.GONE); tvRemindSize.setVisibility(remind_size ? View.VISIBLE : View.GONE);
tvRemindPgp.setVisibility(remind_pgp ? View.VISIBLE : View.GONE); tvRemindPgp.setVisibility(remind_pgp ? View.VISIBLE : View.GONE);
tvRemindSmime.setVisibility(remind_smime ? View.VISIBLE : View.GONE);
tvRemindTo.setVisibility(remind_to ? View.VISIBLE : View.GONE); tvRemindTo.setVisibility(remind_to ? View.VISIBLE : View.GONE);
tvRemindExtra.setVisibility(send_reminders && remind_extra ? View.VISIBLE : View.GONE); tvRemindExtra.setVisibility(send_reminders && remind_extra ? View.VISIBLE : View.GONE);

@ -68,6 +68,18 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvRemindSize" /> app:layout_constraintTop_toBottomOf="@id/tvRemindSize" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvRemindSmime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_smime_reminder"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="?attr/colorError"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvRemindPgp" />
<eu.faircode.email.FixedTextView <eu.faircode.email.FixedTextView
android:id="@+id/tvRemindTo" android:id="@+id/tvRemindTo"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -78,7 +90,7 @@
android:textColor="?attr/colorError" android:textColor="?attr/colorError"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvRemindPgp" /> app:layout_constraintTop_toBottomOf="@id/tvRemindSmime" />
<eu.faircode.email.FixedTextView <eu.faircode.email.FixedTextView
android:id="@+id/tvRemindExtra" android:id="@+id/tvRemindExtra"

@ -1049,6 +1049,7 @@
<string name="title_extra_missing">Username missing</string> <string name="title_extra_missing">Username missing</string>
<string name="title_to_missing">Recipient missing</string> <string name="title_to_missing">Recipient missing</string>
<string name="title_pgp_reminder">PGP keys available</string> <string name="title_pgp_reminder">PGP keys available</string>
<string name="title_smime_reminder">S/MIME keys available</string>
<string name="title_subject_reminder">Subject is empty</string> <string name="title_subject_reminder">Subject is empty</string>
<string name="title_text_reminder">Message is empty</string> <string name="title_text_reminder">Message is empty</string>
<string name="title_attachment_keywords">attached,attachment,attachments,included</string> <string name="title_attachment_keywords">attached,attachment,attachments,included</string>

Loading…
Cancel
Save