Commit 0ab592f3 authored by Grigory Fedorov's avatar Grigory Fedorov

MUC: message from other clients with same nickname are shown as own messages....

MUC: message from other clients with same nickname are shown as own messages. No notification shown. #150 #265 #272
parent fa1907bd
......@@ -210,9 +210,6 @@ public class RoomChat extends AbstractChat {
if (text == null && subject == null) {
return true;
}
if (isSelf(resource)) { // Own message
return true;
}
if (subject != null) {
if (this.subject.equals(subject)) {
return true;
......@@ -240,6 +237,11 @@ public class RoomChat extends AbstractChat {
}
}
}
if (isSelf(resource)) { // Own message from other client
notify = false;
}
updateThreadId(message.getThread());
MessageItem messageItem = newMessage(resource, text, null,
delay, true, notify, false, false, true);
......
......@@ -58,6 +58,8 @@ public class ChatMessageAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
private String account;
private String user;
private boolean isMUC;
private String mucNickname;
private List<MessageItem> messages;
/**
* Text with extra information.
......@@ -72,6 +74,9 @@ public class ChatMessageAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
this.messageClickListener = messageClickListener;
isMUC = MUCManager.getInstance().hasRoom(account, user);
if (isMUC) {
mucNickname = MUCManager.getInstance().getNickname(account, user);
}
hint = null;
appearanceStyle = SettingsManager.chatsAppearanceStyle();
}
......@@ -187,7 +192,14 @@ public class ChatMessageAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
return VIEW_TYPE_ACTION_MESSAGE;
}
return messageItem.isIncoming() ? VIEW_TYPE_INCOMING_MESSAGE : VIEW_TYPE_OUTGOING_MESSAGE;
if (messageItem.isIncoming()) {
if (isMUC && messageItem.getResource().equals(mucNickname)) {
return VIEW_TYPE_OUTGOING_MESSAGE;
}
return VIEW_TYPE_INCOMING_MESSAGE;
} else {
return VIEW_TYPE_OUTGOING_MESSAGE;
}
}
private void setUpMessage(MessageItem messageItem, Message message) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment