aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger
diff options
context:
space:
mode:
authorChristian Schneppe <christian.schneppe@pix-art.de>2019-10-26 18:28:35 +0200
committerChristian Schneppe <christian.schneppe@pix-art.de>2019-10-26 18:28:35 +0200
commit493ac6286f017858432b38624ea4c2f9e3ec9bba (patch)
tree824afae7d2b5a9c4ada478678672ec89967b4956 /src/main/java/de/pixart/messenger
parent57e0f4a21d127667df11192711c7077439cfbb36 (diff)
update ui after bookmark change
Diffstat (limited to 'src/main/java/de/pixart/messenger')
-rw-r--r--src/main/java/de/pixart/messenger/entities/MucOptions.java5
-rw-r--r--src/main/java/de/pixart/messenger/parser/MessageParser.java3
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java10
3 files changed, 16 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/MucOptions.java b/src/main/java/de/pixart/messenger/entities/MucOptions.java
index 36bb43fbe..e73fcfcac 100644
--- a/src/main/java/de/pixart/messenger/entities/MucOptions.java
+++ b/src/main/java/de/pixart/messenger/entities/MucOptions.java
@@ -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) {
diff --git a/src/main/java/de/pixart/messenger/parser/MessageParser.java b/src/main/java/de/pixart/messenger/parser/MessageParser.java
index 9917f2c51..7557096bc 100644
--- a/src/main/java/de/pixart/messenger/parser/MessageParser.java
+++ b/src/main/java/de/pixart/messenger/parser/MessageParser.java
@@ -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 {
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index c93a22719..d7f815ac9 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -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);