class
XMPP::Bookmarks
- XMPP::Bookmarks
- Reference
- Object
Overview
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 = "[email protected]" 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
Defined in:
xmpp/bookmarks.crConstant Summary
-
PEP_NODE =
"storage:bookmarks" -
The PEP node used for bookmarks (XEP-0402).
Constructors
Class Method Summary
-
.from_message(message : Stanza::Message) : Stanza::Bookmarks | Nil
from_message extracts the bookmarks from a PEP notification message, or nil when the message does not carry a bookmarks notification.
Instance Method Summary
-
#publish(bookmarks : Stanza::Bookmarks)
publish publishes the bookmarks to the client's own PEP node.
-
#subscribe(jid : String)
subscribe subscribes the client to another user's bookmarks node.
-
#unsubscribe(jid : String)
unsubscribe removes the client's subscription to a user's bookmarks node.
Constructor Detail
Class Method Detail
from_message extracts the bookmarks from a PEP notification message, or nil when the message does not carry a bookmarks notification.
Instance Method Detail
publish publishes the bookmarks to the client's own PEP node.
unsubscribe removes the client's subscription to a user's bookmarks node.