do not highlight users when not participating. fixes #2865

This commit is contained in:
Daniel Gultsch 2018-03-12 16:00:02 +01:00
parent 8dc17a96ba
commit 22d98bd162
2 changed files with 16 additions and 11 deletions

View File

@ -1663,6 +1663,7 @@ public class XmppConnectionService extends Service {
return conversation;
}
conversation = databaseBackend.findConversation(account, jid);
Log.d(Config.LOGTAG,"loaded from db: "+conversation.getNextMessage());
final boolean loadMessagesFromDb;
if (conversation != null) {
conversation.setStatus(Conversation.STATUS_AVAILABLE);
@ -1732,6 +1733,7 @@ public class XmppConnectionService extends Service {
public void archiveConversation(Conversation conversation) {
getNotificationService().clear(conversation);
conversation.setStatus(Conversation.STATUS_ARCHIVED);
conversation.setNextMessage(null);
synchronized (this.conversations) {
getMessageArchiveService().kill(conversation);
if (conversation.getMode() == Conversation.MODE_MULTI) {
@ -3028,12 +3030,7 @@ public class XmppConnectionService extends Service {
}
public void updateConversation(final Conversation conversation) {
mDatabaseWriterExecutor.execute(new Runnable() {
@Override
public void run() {
databaseBackend.updateConversation(conversation);
}
});
mDatabaseWriterExecutor.execute(() -> databaseBackend.updateConversation(conversation));
}
private void reconnectAccount(final Account account, final boolean force, final boolean interactive) {

View File

@ -876,10 +876,15 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
if (message.getConversation().getMode() == Conversation.MODE_MULTI) {
Jid user = message.getCounterpart();
if (user != null && !user.isBareJid()) {
if (!message.getConversation().getMucOptions().isUserInRoom(user)) {
Toast.makeText(getActivity(), activity.getString(R.string.user_has_left_conference, user.getResource()), Toast.LENGTH_SHORT).show();
final MucOptions mucOptions = message.getConversation().getMucOptions();
if (mucOptions.participating() || message.getConversation().getNextCounterpart() != null) {
if (!mucOptions.isUserInRoom(user)) {
Toast.makeText(getActivity(), activity.getString(R.string.user_has_left_conference, user.getResource()), Toast.LENGTH_SHORT).show();
}
highlightInConference(user.getResource());
} else {
Toast.makeText(getActivity(),R.string.you_are_not_participating, Toast.LENGTH_SHORT).show();
}
highlightInConference(user.getResource());
}
return;
} else {
@ -1732,7 +1737,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
}
if (this.conversation != null) {
final String msg = this.binding.textinput.getText().toString();
if (this.conversation.setNextMessage(msg)) {
if (this.conversation.getStatus() != Conversation.STATUS_ARCHIVED && this.conversation.setNextMessage(msg)) {
this.activity.xmppConnectionService.updateConversation(this.conversation);
}
updateChatState(this.conversation, msg);
@ -1867,7 +1872,10 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
//do nothing
}
} else {
highlightInConference(nick);
final MucOptions mucOptions = conversation.getMucOptions();
if (mucOptions.participating() || conversation.getNextCounterpart() != null) {
highlightInConference(nick);
}
}
} else {
appendText(text);