aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-11-23 14:04:55 +0100
committerChristian Schneppe <christian@pix-art.de>2018-11-23 14:04:55 +0100
commitdfb0139a6ca303f23e737d513d50e6789e122573 (patch)
tree46d99895f58171ecb97f0708d11e18556a517f41 /src/main/java/de/pixart/messenger/services/XmppConnectionService.java
parent21b4f2476c8879e7711571a5f1b9bfd0c56fda51 (diff)
fixed race condition that prevented bookmark nick to be used
Diffstat (limited to '')
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index b8986bf77..d3c7279c2 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -1606,7 +1606,7 @@ public class XmppConnectionService extends Service {
if (conversation != null) {
bookmark.setConversation(conversation);
} else if (bookmark.autojoin() && bookmark.getJid() != null && autojoin) {
- conversation = findOrCreateConversation(account, bookmark.getJid(), true, true, false);
+ conversation = findOrCreateConversation(account, bookmark.getFullJid(), true, true, false);
bookmark.setConversation(conversation);
}
}
@@ -2702,15 +2702,17 @@ public class XmppConnectionService extends Service {
public void persistSelfNick(MucOptions.User self) {
final Conversation conversation = self.getConversation();
+ final boolean tookProposedNickFromBookmark = conversation.getMucOptions().isTookProposedNickFromBookmark();
Jid full = self.getFullJid();
if (!full.equals(conversation.getJid())) {
Log.d(Config.LOGTAG, "nick changed. updating");
conversation.setContactJid(full);
databaseBackend.updateConversation(conversation);
}
-
- Bookmark bookmark = conversation.getBookmark();
- if (bookmark != null && !full.getResource().equals(bookmark.getNick())) {
+ final Bookmark bookmark = conversation.getBookmark();
+ final String bookmarkedNick = bookmark == null ? null : bookmark.getNick();
+ if (bookmark != null && (tookProposedNickFromBookmark || TextUtils.isEmpty(bookmarkedNick)) && !full.getResource().equals(bookmarkedNick)) {
+ Log.d(Config.LOGTAG, conversation.getAccount().getJid().asBareJid() + ": persist nick '" + full.getResource() + "' into bookmark for " + conversation.getJid().asBareJid());
bookmark.setNick(full.getResource());
pushBookmarks(bookmark.getAccount());
}