show email address on forwarding

when forwarding a message to a one-to-one-chat,
it is useful to see the email address
as there may be various chats with the same user having the same name.
This commit is contained in:
B. Petersen 2019-10-05 12:32:10 +02:00
parent 9e5975a533
commit c6e3d3c12c
No known key found for this signature in database
GPG key ID: 3B88E92DEA8E9AFC

View file

@ -601,7 +601,14 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
} }
private void handleForwarding() { private void handleForwarding() {
String name = dcContext.getChat(chatId).getName(); DcChat dcChat = dcContext.getChat(chatId);
String name = dcChat.getName();
if( !dcChat.isGroup() ) {
int[] contactIds = dcContext.getChatContacts(chatId);
if( contactIds.length==1 || contactIds.length==2 ) {
name = dcContext.getContact(contactIds[0]).getNameNAddr();
}
}
new AlertDialog.Builder(this) new AlertDialog.Builder(this)
.setMessage(getString(R.string.ask_forward, name)) .setMessage(getString(R.string.ask_forward, name))
.setPositiveButton(R.string.ok, (dialogInterface, i) -> new RelayingTask(this, chatId).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR)) .setPositiveButton(R.string.ok, (dialogInterface, i) -> new RelayingTask(this, chatId).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR))