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.getConversation().getMode() == Conversation.MODE_MULTI) {
if (message.getCounterpart() != null) {
if (!message.getCounterpart().getResourcepart().isEmpty()) {
highlightInConference(message.getCounterpart().getResourcepart());
} else {
highlightInConference(message
.getContact().getDisplayName());
highlightInConference(message.getCounterpart().toString());
}
}
} else {
Contact contact = message.getConversation()

View file

@ -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) {