Attempt to find right attendee on replying to invite

Closes #196
This commit is contained in:
M66B 2021-03-29 15:04:27 +02:00
parent b80ed6e939
commit 9800d018b9
1 changed files with 23 additions and 1 deletions

View File

@ -2876,7 +2876,29 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
if (event.getDateEnd() != null)
ev.setDateEnd(event.getDateEnd());
InternetAddress to = (InternetAddress) message.to[0];
InternetAddress to = null;
if (message.identity != null) {
EntityIdentity identity = db.identity().getIdentity(message.identity);
if (identity != null) {
InternetAddress same = null;
InternetAddress similar = null;
for (Address recipient : message.to)
if (identity.sameAddress(recipient))
same = (InternetAddress) recipient;
else if (identity.similarAddress(recipient))
similar = (InternetAddress) recipient;
if (same != null)
to = same;
else if (similar != null)
to = similar;
}
}
if (to == null)
to = (InternetAddress) message.to[0];
Attendee attendee = new Attendee(to.getPersonal(), to.getAddress());
if (action == R.id.btnCalendarAccept) {