diff --git a/src/main/java/eu/siacs/conversations/entities/Bookmark.java b/src/main/java/eu/siacs/conversations/entities/Bookmark.java index 7ded4f842..24107ec8f 100644 --- a/src/main/java/eu/siacs/conversations/entities/Bookmark.java +++ b/src/main/java/eu/siacs/conversations/entities/Bookmark.java @@ -25,6 +25,7 @@ public class Bookmark extends Element implements ListItem { private final Account account; private WeakReference conversation; private Jid jid; + protected Element extensions = new Element("extensions", Namespace.BOOKMARKS2); public Bookmark(final Account account, final Jid jid) { super("conference"); @@ -101,9 +102,18 @@ public class Bookmark extends Element implements ListItem { bookmark.setBookmarkName(conference.getAttribute("name")); bookmark.setAutojoin(conference.getAttributeAsBoolean("autojoin")); bookmark.setNick(conference.findChildContent("nick")); + bookmark.setPassword(conference.findChildContent("password")); + final Element extensions = conference.findChild("extensions", Namespace.BOOKMARKS2); + if (extensions != null) { + bookmark.extensions = extensions; + } return bookmark; } + public Element getExtensions() { + return extensions; + } + public void setAutojoin(boolean autojoin) { if (autojoin) { this.setAttribute("autojoin", "true"); diff --git a/src/main/java/eu/siacs/conversations/generator/IqGenerator.java b/src/main/java/eu/siacs/conversations/generator/IqGenerator.java index 52a19eaa4..501c6d0c7 100644 --- a/src/main/java/eu/siacs/conversations/generator/IqGenerator.java +++ b/src/main/java/eu/siacs/conversations/generator/IqGenerator.java @@ -247,6 +247,7 @@ public class IqGenerator extends AbstractGenerator { public Element publishBookmarkItem(final Bookmark bookmark) { final String name = bookmark.getBookmarkName(); final String nick = bookmark.getNick(); + final String password = bookmark.getPassword(); final boolean autojoin = bookmark.autojoin(); final Element conference = new Element("conference", Namespace.BOOKMARKS2); if (name != null) { @@ -255,7 +256,11 @@ public class IqGenerator extends AbstractGenerator { if (nick != null) { conference.addChild("nick").setContent(nick); } + if (password != null) { + conference.addChild("password").setContent(password); + } conference.setAttribute("autojoin",String.valueOf(autojoin)); + conference.addChild(bookmark.getExtensions()); return conference; } diff --git a/src/main/java/eu/siacs/conversations/xml/Namespace.java b/src/main/java/eu/siacs/conversations/xml/Namespace.java index 201b11894..c6730fe6c 100644 --- a/src/main/java/eu/siacs/conversations/xml/Namespace.java +++ b/src/main/java/eu/siacs/conversations/xml/Namespace.java @@ -59,7 +59,7 @@ public final class Namespace { public static final String PUSH = "urn:xmpp:push:0"; public static final String COMMANDS = "http://jabber.org/protocol/commands"; public static final String MUC_USER = "http://jabber.org/protocol/muc#user"; - public static final String BOOKMARKS2 = "urn:xmpp:bookmarks:0"; + public static final String BOOKMARKS2 = "urn:xmpp:bookmarks:1"; public static final String BOOKMARKS2_COMPAT = BOOKMARKS2 + "#compat"; public static final String INVITE = "urn:xmpp:invite"; public static final String PARS = "urn:xmpp:pars:0"; diff --git a/src/main/java/eu/siacs/conversations/xmpp/pep/PublishOptions.java b/src/main/java/eu/siacs/conversations/xmpp/pep/PublishOptions.java index 62f65ee1f..24b429fd7 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/pep/PublishOptions.java +++ b/src/main/java/eu/siacs/conversations/xmpp/pep/PublishOptions.java @@ -30,7 +30,7 @@ public class PublishOptions { options.putString("pubsub#persist_items", "true"); options.putString("pubsub#access_model", "whitelist"); options.putString("pubsub#send_last_published_item", "never"); - options.putString("pubsub#max_items", "128"); //YOLO! + options.putString("pubsub#max_items", "max"); options.putString("pubsub#notify_delete", "true"); options.putString("pubsub#notify_retract", "true"); //one could also set notify=true on the retract