update ui after bookmark change

This commit is contained in:
Christian Schneppe 2019-10-26 18:28:35 +02:00
parent 57e0f4a21d
commit 493ac6286f
No known key found for this signature in database
GPG key ID: F30B8D686B44D87E
3 changed files with 16 additions and 2 deletions

View file

@ -1,9 +1,10 @@
package de.pixart.messenger.entities;
import android.annotation.SuppressLint;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.text.TextUtils;
import java.util.ArrayList;
import java.util.Collections;
@ -417,7 +418,7 @@ public class MucOptions {
}
}
private String getProposedNick() {
public String getProposedNick() {
final Bookmark bookmark = this.conversation.getBookmark();
final String bookmarkedNick = normalize(account.getJid(), bookmark == null ? null : bookmark.getNick());
if (bookmarkedNick != null) {

View file

@ -331,7 +331,9 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
if (item != null) {
final Bookmark bookmark = Bookmark.parseFromItem(item, account);
if (bookmark != null) {
account.putBookmark(bookmark);
mXmppConnectionService.processModifiedBookmark(bookmark);
mXmppConnectionService.updateConversationUi();
}
}
if (retract != null) {
@ -340,6 +342,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
account.removeBookmark(id);
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": deleted bookmark for " + id);
mXmppConnectionService.processDeletedBookmark(account, id);
mXmppConnectionService.updateConversationUi();
}
}
} else {

View file

@ -1862,6 +1862,16 @@ public class XmppConnectionService extends Service {
if (pep && synchronizeWithBookmarks && !bookmark.autojoin()) {
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": archiving conference (" + conversation.getJid() + ") after receiving pep");
archiveConversation(conversation, false);
} else {
final MucOptions mucOptions = conversation.getMucOptions();
if (mucOptions.getError() == MucOptions.Error.NICK_IN_USE) {
final String current = mucOptions.getActualNick();
final String proposed = mucOptions.getProposedNick();
if (current != null && !current.equals(proposed)) {
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": proposed nick changed after bookmark push " + current + "->" + proposed);
joinMuc(conversation);
}
}
}
} else if (synchronizeWithBookmarks && bookmark.autojoin()) {
conversation = findOrCreateConversation(account, bookmark.getFullJid(), true, true, false);