From b96ef1e59152a97c0adc03ef05ef9fe83a672ba1 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 28 Sep 2019 21:46:27 +0200 Subject: [PATCH] update ui after bookmark change --- .../eu/siacs/conversations/entities/MucOptions.java | 2 +- .../eu/siacs/conversations/parser/MessageParser.java | 3 +++ .../conversations/services/XmppConnectionService.java | 10 ++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/entities/MucOptions.java b/src/main/java/eu/siacs/conversations/entities/MucOptions.java index a70c67198..81463d9e9 100644 --- a/src/main/java/eu/siacs/conversations/entities/MucOptions.java +++ b/src/main/java/eu/siacs/conversations/entities/MucOptions.java @@ -417,7 +417,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) { diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java index dc00c0277..c13509f04 100644 --- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java +++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java @@ -238,7 +238,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) { @@ -247,6 +249,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 { diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index a3ba0b6d0..a2b8ef7a7 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -1621,6 +1621,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);