aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/pixart/messenger/services/XmppConnectionService.java')
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index 5028fea28..c1d5655f5 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -3073,7 +3073,13 @@ public class XmppConnectionService extends Service {
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());
+ final Account account = conversation.getAccount();
+ final String defaultNick = MucOptions.defaultNick(account);
+ if (TextUtils.isEmpty(bookmarkedNick) && full.getResource().equals(defaultNick)) {
+ Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": do not overwrite empty bookmark nick with default nick for " + conversation.getJid().asBareJid());
+ return;
+ }
+ Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": persist nick '" + full.getResource() + "' into bookmark for " + conversation.getJid().asBareJid());
bookmark.setNick(full.getResource());
pushBookmarks(bookmark.getAccount());
}
@@ -4779,10 +4785,11 @@ public class XmppConnectionService extends Service {
}
public void saveConversationAsBookmark(Conversation conversation, String name) {
- Account account = conversation.getAccount();
- Bookmark bookmark = new Bookmark(account, conversation.getJid().asBareJid());
- if (!conversation.getJid().isBareJid()) {
- bookmark.setNick(conversation.getJid().getResource());
+ final Account account = conversation.getAccount();
+ final Bookmark bookmark = new Bookmark(account, conversation.getJid().asBareJid());
+ final String nick = conversation.getJid().getResource();
+ if (nick != null && !nick.isEmpty() && !nick.equals(MucOptions.defaultNick(account))) {
+ bookmark.setNick(nick);
}
if (!TextUtils.isEmpty(name)) {
bookmark.setBookmarkName(name);