include name in locations received in MUCs

This commit is contained in:
Daniel Gultsch 2016-05-15 11:08:00 +02:00
parent a25912c32c
commit c9e9dc2ef2
2 changed files with 12 additions and 8 deletions

View file

@ -9,6 +9,7 @@ import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import eu.siacs.conversations.entities.Contact;
import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.entities.Message;
@ -54,13 +55,16 @@ public class GeoHelper {
Intent locationPluginIntent = new Intent("eu.siacs.conversations.location.show");
locationPluginIntent.putExtra("latitude",latitude);
locationPluginIntent.putExtra("longitude",longitude);
if (conversation.getMode() == Conversation.MODE_SINGLE) {
if (message.getStatus() == Message.STATUS_RECEIVED) {
locationPluginIntent.putExtra("name",conversation.getName());
locationPluginIntent.putExtra("jid",message.getCounterpart().toString());
}
else {
if (message.getStatus() != Message.STATUS_RECEIVED) {
locationPluginIntent.putExtra("jid",conversation.getAccount().getJid().toString());
locationPluginIntent.putExtra("name",conversation.getAccount().getJid().getLocalpart());
} else {
Contact contact = message.getContact();
if (contact != null) {
locationPluginIntent.putExtra("name", contact.getDisplayName());
locationPluginIntent.putExtra("jid", contact.getJid().toString());
} else {
locationPluginIntent.putExtra("name", UIHelper.getDisplayedMucCounterpart(message.getCounterpart()));
}
}
intents.add(locationPluginIntent);

View file

@ -249,7 +249,7 @@ public class UIHelper {
}
}
private static String getDisplayedMucCounterpart(final Jid counterpart) {
public static String getDisplayedMucCounterpart(final Jid counterpart) {
if (counterpart==null) {
return "";
} else if (!counterpart.isBareJid()) {