xmpp: mellium.im/xmpp/receipts Index | Files

package receipts

import "mellium.im/xmpp/receipts"

Package receipts implements XEP-0184: Message Delivery Receipts.

Index

Package Files

receipts.go

Constants

const (
    // NS is the XML namespace used by message delivery receipts.
    // It is provided as a convenience.
    NS = "urn:xmpp:receipts"
)

func Handle Uses

func Handle(h *Handler) mux.Option

Handle returns an option that registers a Handler for message receipts.

type Handler Uses

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

Handler listens for incoming message receipts and matches them to outgoing messages sent with SendMessage or SendMessageElement.

func (*Handler) HandleMessage Uses

func (h *Handler) HandleMessage(msg stanza.Message, t xmlstream.TokenReadEncoder) error

HandleMessage implements mux.MessageHandler and responds to requests and responses for message delivery receipts.

func (*Handler) SendMessage Uses

func (h *Handler) SendMessage(ctx context.Context, s *xmpp.Session, r xml.TokenReader) error

SendMessage transmits the first element read from the provided token reader over the session if the element is a message stanza, otherwise it returns an error. SendMessage adds a requst for a message receipt and an ID if one does not already exist.

If the context is closed before the message delivery receipt is received, SendMessage immediately returns the context error. Any response received at a later time will no be associated with the original request, but can still be handled by the Handler. If the returned error is nil, receipt of the message was successfully acknowledged.

SendMessage is safe for concurrent use by multiple goroutines.

func (*Handler) SendMessageElement Uses

func (h *Handler) SendMessageElement(ctx context.Context, s *xmpp.Session, payload xml.TokenReader, msg stanza.Message) error

SendMessageElement is like SendMessage except that it wraps the payload in the message element derived from msg. For more information, see SendMessage.

SendMessageElement is safe for concurrent use by multiple goroutines.

Package receipts imports 10 packages (graph). Updated 2020-03-20. Refresh now. Tools for package owners.