XMPP::Bookmarks
Bookmarks is a high-level client for XEP-0048 - Bookmark Conformance and XEP-0402 - PEP Native Bookmarks.
A user's saved chat rooms (and URLs) are published to the well-known PEP node "storage:bookmarks" so all of the user's resources (and authorized contacts) share them. The PEP approach is the modern replacement for storing bookmarks in private XML storage (XEP-0049).
bookmarks = XMPP::Bookmarks.new(client) mine = XMPP::Stanza::Bookmarks.new room = XMPP::Stanza::BookmarkConference.new room.name = "Design"; room.jid = "design@conference.example.org" room.autojoin = true mine.conferences << room bookmarks.publish(mine)
Incoming notifications are read from messages like any other extension:
client.on("message") do |s, p| if bookmarks = XMPP::Bookmarks.from_message(p.as(XMPP::Stanza::Message)) # bookmarks.conferences ... end end
See: https://xmpp.org/extensions/xep-0048.html and https://xmpp.org/extensions/xep-0402.html
Constants
The PEP node used for bookmarks (XEP-0402).
Constructors
Class methods
from_message extracts the bookmarks from a PEP notification message, or nil when the message does not carry a bookmarks notification.
Instance methods
publish publishes the bookmarks to the client's own PEP node.