diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-11-09 18:24:01 +0100 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-11-09 18:24:01 +0100 |
commit | eb9e9883611f5f5c0c2bd7466e434794ab074c22 (patch) | |
tree | 8feb354f80e6c6159a12a608886ef5943f9312ce /src | |
parent | 69ef17efc054c9f3b7b3b5a26f419e6b920ffd13 (diff) |
fixed muc sender history for some cases (where the previous nick was a valid jid)
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/ConversationFragment.java | 9 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java | 16 |
2 files changed, 17 insertions, 8 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index cb7988cb6..5d133e877 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -280,10 +280,11 @@ public class ConversationFragment extends Fragment { if (message.getStatus() <= Message.STATUS_RECEIVED) { if (message.getConversation().getMode() == Conversation.MODE_MULTI) { if (message.getCounterpart() != null) { - highlightInConference(message.getCounterpart().getResourcepart()); - } else { - highlightInConference(message - .getContact().getDisplayName()); + if (!message.getCounterpart().getResourcepart().isEmpty()) { + highlightInConference(message.getCounterpart().getResourcepart()); + } else { + highlightInConference(message.getCounterpart().toString()); + } } } else { Contact contact = message.getConversation() diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java index cefe42a77..16239ec82 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java @@ -135,10 +135,8 @@ public class MessageAdapter extends ArrayAdapter<Message> { Contact contact = message.getContact(); if (contact != null) { info = contact.getDisplayName(); - } else if (message.getCounterpart() != null) { - info = message.getCounterpart().getResourcepart(); } else { - info = ""; + info = getDisplayedMucCounterpart(message.getCounterpart()); } } break; @@ -303,6 +301,16 @@ public class MessageAdapter extends ArrayAdapter<Message> { viewHolder.image.setOnLongClickListener(openContextMenu); } + private String getDisplayedMucCounterpart(final Jid counterpart) { + if (counterpart==null) { + return ""; + } else if (!counterpart.getResourcepart().isEmpty()) { + return counterpart.getResourcepart(); + } else { + return counterpart.toString(); + } + } + @Override public View getView(int position, View view, ViewGroup parent) { final Message item = getItem(position); @@ -411,7 +419,7 @@ public class MessageAdapter extends ArrayAdapter<Message> { if (contact != null) { viewHolder.contact_picture.setImageBitmap(activity.avatarService().get(contact, activity.getPixel(48))); } else if (item.getConversation().getMode() == Conversation.MODE_MULTI) { - viewHolder.contact_picture.setImageBitmap(activity.avatarService().get(item.getCounterpart().getResourcepart(), + viewHolder.contact_picture.setImageBitmap(activity.avatarService().get(getDisplayedMucCounterpart(item.getCounterpart()), activity.getPixel(48))); } } else if (type == SENT) { |