diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-05-15 11:08:00 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2016-05-15 11:08:00 +0200 |
commit | c9e9dc2ef23f12f5b8f09acf9a4acbf17a409764 (patch) | |
tree | ee685352c23da2ab484ebe2df02f7cf0d72d089c /src/main/java/eu/siacs/conversations/utils | |
parent | a25912c32cced0683b59bea3095210d76a8d41a6 (diff) |
include name in locations received in MUCs
Diffstat (limited to 'src/main/java/eu/siacs/conversations/utils')
-rw-r--r-- | src/main/java/eu/siacs/conversations/utils/GeoHelper.java | 18 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/utils/UIHelper.java | 2 |
2 files changed, 12 insertions, 8 deletions
diff --git a/src/main/java/eu/siacs/conversations/utils/GeoHelper.java b/src/main/java/eu/siacs/conversations/utils/GeoHelper.java index 74f91a98b..9a93df38c 100644 --- a/src/main/java/eu/siacs/conversations/utils/GeoHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/GeoHelper.java @@ -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 { - locationPluginIntent.putExtra("jid",conversation.getAccount().getJid().toString()); + 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); diff --git a/src/main/java/eu/siacs/conversations/utils/UIHelper.java b/src/main/java/eu/siacs/conversations/utils/UIHelper.java index 5ab058d14..6ca5370a3 100644 --- a/src/main/java/eu/siacs/conversations/utils/UIHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/UIHelper.java @@ -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()) { |