bookmarks

package
v0.0.0-...-2de8dec Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 12, 2023 License: BSD-2-Clause Imports: 10 Imported by: 1

Documentation

Overview

Package bookmarks implements private XML based bookmarks.

This package implements an old versin of the bookmarks spec that contains serious race conditions that may result in the loss of some bookmarks. As such it should only be used for adding backwards compatibility with legacy clients and servers that do not use the same storage backend for bookmarks using different specs. If you are implementing a client from scratch, or have the option of updating, you should use the mellium.im/xmpp/bookmarks package instead.

Index

Constants

View Source
const NS = `storage:bookmarks`

NS is the namespace used by this package.

Variables

This section is empty.

Functions

func Delete

func Delete(ctx context.Context, s *xmpp.Session, j jid.JID) error

Delete removes the provided bookmark if it exists. If the bookmark does not exist, no error is returned.

func Set

Set adds or updates a bookmark. Due to the nature of the legacy boomkarks spec, Set must first fetch the bookmarks then re-upload the entire list, making it very inefficient. There is also greater potential for race conditions if multiple cilents try to upload different bookmark lists at once.

Types

type Iter

type Iter struct {
	// contains filtered or unexported fields
}

Iter is an iterator over bookmarks.

func Fetch

func Fetch(ctx context.Context, s *xmpp.Session) *Iter

Fetch returns an iterator over the list of bookmarks. The session may block until the iterator is closed.

func FetchIQ

func FetchIQ(ctx context.Context, iq stanza.IQ, s *xmpp.Session) *Iter

FetchIQ is like Fetch but it allows you to customize the IQ. Changing the type of the provided IQ has no effect.

func (*Iter) Bookmark

func (i *Iter) Bookmark() bookmarks.Channel

Bookmark returns the last bookmark parsed by the iterator.

func (*Iter) Close

func (i *Iter) Close() error

Close indicates that we are finished with the given iterator and processing the stream may continue. Calling it multiple times has no effect.

func (*Iter) Err

func (i *Iter) Err() error

Err returns the last error encountered by the iterator (if any).

func (*Iter) Next

func (i *Iter) Next() bool

Next returns true if there are more items to decode.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL