diff options
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/services/XmppConnectionService.java | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index b2ae329c8..77f3bb78f 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -338,10 +338,12 @@ public class XmppConnectionService extends Service { mJingleConnectionManager.cancelInTransmission(); mQuickConversationsService.considerSyncBackground(false); fetchRosterFromServer(account); - fetchBookmarks2(account); - /*if (!account.getXmppConnection().getFeatures().bookmarksConversion()) { + final XmppConnection connection = account.getXmppConnection(); + if (connection.getFeatures().bookmarks2()) { + fetchBookmarks2(account); + } else if (!account.getXmppConnection().getFeatures().bookmarksConversion()) { fetchBookmarks(account); - }*/ + } final boolean flexible = account.getXmppConnection().getFeatures().flexibleOfflineMessageRetrieval(); final boolean catchup = getMessageArchiveService().inCatchup(account); if (flexible && catchup && account.getXmppConnection().isMamPreferenceAlways()) { @@ -1819,8 +1821,6 @@ public class XmppConnectionService extends Service { if (response.getType() == IqPacket.TYPE.RESULT) { final Element pubsub = response.findChild("pubsub", Namespace.PUBSUB); final Collection<Bookmark> bookmarks = Bookmark.parseFromPubsub(pubsub, account); - Log.d(Config.LOGTAG, "bookmarks2 " + pubsub); - Log.d(Config.LOGTAG, "bookmarks2" + bookmarks); processBookmarksInitial(account, bookmarks, true); } } @@ -1861,12 +1861,32 @@ public class XmppConnectionService extends Service { } public void createBookmark(final Account account, final Bookmark bookmark) { - final Element item = mIqGenerator.publishBookmarkItem(bookmark); - pushNodeAndEnforcePublishOptions(account, Namespace.BOOKMARK, item, bookmark.getJid().asBareJid().toEscapedString(), PublishOptions.persistentWhitelistAccessMaxItems()); + final XmppConnection connection = account.getXmppConnection(); + if (connection.getFeatures().bookmarks2()) { + final Element item = mIqGenerator.publishBookmarkItem(bookmark); + pushNodeAndEnforcePublishOptions(account, Namespace.BOOKMARK, item, bookmark.getJid().asBareJid().toEscapedString(), PublishOptions.persistentWhitelistAccessMaxItems()); + } else if (connection.getFeatures().bookmarksConversion()) { + pushBookmarksPep(account); + } else { + pushBookmarksPrivateXml(account); + } } public void deleteBookmark(final Account account, final Bookmark bookmark) { final XmppConnection connection = account.getXmppConnection(); + if (connection.getFeatures().bookmarksConversion()) { + IqPacket request = mIqGenerator.deleteItem(Namespace.BOOKMARK, bookmark.getJid().asBareJid().toEscapedString()); + sendIqPacket(account, request, new OnIqPacketReceived() { + @Override + public void onIqPacketReceived(Account account, IqPacket packet) { + Log.d(Config.LOGTAG, packet.toString()); + } + }); + } else if (connection.getFeatures().bookmarksConversion()) { + pushBookmarksPep(account); + } else { + pushBookmarksPrivateXml(account); + } } private void pushBookmarksPrivateXml(Account account) { |