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 { ...@@ -210,9 +210,6 @@ public class RoomChat extends AbstractChat {
if (text == null && subject == null) { if (text == null && subject == null) {
return true; return true;
} }
if (isSelf(resource)) { // Own message
return true;
}
if (subject != null) { if (subject != null) {
if (this.subject.equals(subject)) { if (this.subject.equals(subject)) {
return true; return true;
...@@ -240,6 +237,11 @@ public class RoomChat extends AbstractChat { ...@@ -240,6 +237,11 @@ public class RoomChat extends AbstractChat {
} }
} }
} }
if (isSelf(resource)) { // Own message from other client
notify = false;
}
updateThreadId(message.getThread()); updateThreadId(message.getThread());
MessageItem messageItem = newMessage(resource, text, null, MessageItem messageItem = newMessage(resource, text, null,
delay, true, notify, false, false, true); delay, true, notify, false, false, true);
......
...@@ -58,6 +58,8 @@ public class ChatMessageAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo ...@@ -58,6 +58,8 @@ public class ChatMessageAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
private String account; private String account;
private String user; private String user;
private boolean isMUC; private boolean isMUC;
private String mucNickname;
private List<MessageItem> messages; private List<MessageItem> messages;
/** /**
* Text with extra information. * Text with extra information.
...@@ -72,6 +74,9 @@ public class ChatMessageAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo ...@@ -72,6 +74,9 @@ public class ChatMessageAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
this.messageClickListener = messageClickListener; this.messageClickListener = messageClickListener;
isMUC = MUCManager.getInstance().hasRoom(account, user); isMUC = MUCManager.getInstance().hasRoom(account, user);
if (isMUC) {
mucNickname = MUCManager.getInstance().getNickname(account, user);
}
hint = null; hint = null;
appearanceStyle = SettingsManager.chatsAppearanceStyle(); appearanceStyle = SettingsManager.chatsAppearanceStyle();
} }
...@@ -187,7 +192,14 @@ public class ChatMessageAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo ...@@ -187,7 +192,14 @@ public class ChatMessageAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
return VIEW_TYPE_ACTION_MESSAGE; 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) { 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