fixed muc sender history for some cases (where the previous nick was a valid jid)

This commit is contained in:
iNPUTmice 2014-11-09 18:24:01 +01:00
parent 69ef17efc0
commit eb9e988361
2 changed files with 17 additions and 8 deletions

View file

@ -280,10 +280,11 @@ public class ConversationFragment extends Fragment {
if (message.getStatus() <= Message.STATUS_RECEIVED) { if (message.getStatus() <= Message.STATUS_RECEIVED) {
if (message.getConversation().getMode() == Conversation.MODE_MULTI) { if (message.getConversation().getMode() == Conversation.MODE_MULTI) {
if (message.getCounterpart() != null) { if (message.getCounterpart() != null) {
highlightInConference(message.getCounterpart().getResourcepart()); if (!message.getCounterpart().getResourcepart().isEmpty()) {
} else { highlightInConference(message.getCounterpart().getResourcepart());
highlightInConference(message } else {
.getContact().getDisplayName()); highlightInConference(message.getCounterpart().toString());
}
} }
} else { } else {
Contact contact = message.getConversation() Contact contact = message.getConversation()

View file

@ -135,10 +135,8 @@ public class MessageAdapter extends ArrayAdapter<Message> {
Contact contact = message.getContact(); Contact contact = message.getContact();
if (contact != null) { if (contact != null) {
info = contact.getDisplayName(); info = contact.getDisplayName();
} else if (message.getCounterpart() != null) {
info = message.getCounterpart().getResourcepart();
} else { } else {
info = ""; info = getDisplayedMucCounterpart(message.getCounterpart());
} }
} }
break; break;
@ -303,6 +301,16 @@ public class MessageAdapter extends ArrayAdapter<Message> {
viewHolder.image.setOnLongClickListener(openContextMenu); 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 @Override
public View getView(int position, View view, ViewGroup parent) { public View getView(int position, View view, ViewGroup parent) {
final Message item = getItem(position); final Message item = getItem(position);
@ -411,7 +419,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
if (contact != null) { if (contact != null) {
viewHolder.contact_picture.setImageBitmap(activity.avatarService().get(contact, activity.getPixel(48))); viewHolder.contact_picture.setImageBitmap(activity.avatarService().get(contact, activity.getPixel(48)));
} else if (item.getConversation().getMode() == Conversation.MODE_MULTI) { } 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))); activity.getPixel(48)));
} }
} else if (type == SENT) { } else if (type == SENT) {