aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/services
diff options
context:
space:
mode:
authorChristian S <christian@pix-art.de>2015-12-28 08:21:23 +0100
committerChristian S <christian@pix-art.de>2015-12-28 08:21:23 +0100
commitf7afd7b26587e73aad789f1a8a5d91d7e7bdeb77 (patch)
tree12536b349199fa7cf54f44afd4c07e82c6dcf2c4 /src/main/java/eu/siacs/conversations/services
parent0ae86b22cbe44c7ae126f19d2628665ecb50a2ae (diff)
parent7bb67ee6605fbf3785782cf70d30fac4192d049b (diff)
copy commits
Diffstat (limited to 'src/main/java/eu/siacs/conversations/services')
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index 649ddacd8..28d6e3550 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -50,6 +50,7 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
+import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
@@ -992,13 +993,16 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
public void onIqPacketReceived(final Account account, final IqPacket packet) {
if (packet.getType() == IqPacket.TYPE.RESULT) {
final Element query = packet.query();
- final List<Bookmark> bookmarks = new CopyOnWriteArrayList<>();
+ final HashMap<Jid, Bookmark> bookmarks = new HashMap<>();
final Element storage = query.findChild("storage", "storage:bookmarks");
if (storage != null) {
for (final Element item : storage.getChildren()) {
if (item.getName().equals("conference")) {
final Bookmark bookmark = Bookmark.parse(item, account);
- bookmarks.add(bookmark);
+ Bookmark old = bookmarks.put(bookmark.getJid(), bookmark);
+ if (old != null && old.getBookmarkName() != null && bookmark.getBookmarkName() == null) {
+ bookmark.setBookmarkName(old.getBookmarkName());
+ }
Conversation conversation = find(bookmark);
if (conversation != null) {
conversation.setBookmark(bookmark);
@@ -1011,7 +1015,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
}
}
}
- account.setBookmarks(bookmarks);
+ account.setBookmarks(new ArrayList<>(bookmarks.values()));
} else {
Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": could not fetch bookmarks");
}