update ui after bookmark change

This commit is contained in:
Daniel Gultsch 2019-09-28 21:46:27 +02:00
parent f530e395ca
commit b96ef1e591
3 changed files with 14 additions and 1 deletions

View File

@ -417,7 +417,7 @@ public class MucOptions {
} }
} }
private String getProposedNick() { public String getProposedNick() {
final Bookmark bookmark = this.conversation.getBookmark(); final Bookmark bookmark = this.conversation.getBookmark();
final String bookmarkedNick = normalize(account.getJid(), bookmark == null ? null : bookmark.getNick()); final String bookmarkedNick = normalize(account.getJid(), bookmark == null ? null : bookmark.getNick());
if (bookmarkedNick != null) { if (bookmarkedNick != null) {

View File

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

View File

@ -1621,6 +1621,16 @@ public class XmppConnectionService extends Service {
if (pep && synchronizeWithBookmarks && !bookmark.autojoin()) { if (pep && synchronizeWithBookmarks && !bookmark.autojoin()) {
Log.d(Config.LOGTAG,account.getJid().asBareJid()+": archiving conference ("+conversation.getJid()+") after receiving pep"); Log.d(Config.LOGTAG,account.getJid().asBareJid()+": archiving conference ("+conversation.getJid()+") after receiving pep");
archiveConversation(conversation, false); 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()) { } else if (synchronizeWithBookmarks && bookmark.autojoin()) {
conversation = findOrCreateConversation(account, bookmark.getFullJid(), true, true, false); conversation = findOrCreateConversation(account, bookmark.getFullJid(), true, true, false);