xmpp

package
v0.0.0-...-b1dd1d8 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OpenStanza          = "<open xmlns='urn:ietf:params:xml:ns:xmpp-framing' to='{{.Host}}' version='1.0'/>"
	AuthStanza          = "<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='ANONYMOUS'/>"
	BindStanza          = "<iq type='set' id='_bind_auth_2' xmlns='jabber:client'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/></iq>"
	SessStanza          = "<iq type='set' id='_session_auth_2' xmlns='jabber:client'><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/></iq>"
	JoinMucStanza       = "<presence from='{{.JID}}' to='{{.MUCJID}}' xmlns='jabber:client'><x xmlns='http://jabber.org/protocol/muc'/></presence>"
	JoinMucStanza2      = "<presence from='{{.JID}}' to='{{.MUCJID}}' xmlns='jabber:client'><show/><status/></presence>"
	SendMessageStanza   = "" /* 177-byte string literal not displayed */
	SendComposingStanza = "" /* 204-byte string literal not displayed */
	SendPausedStanza    = "" /* 198-byte string literal not displayed */
	KickUserStanza      = `` /* 194-byte string literal not displayed */
	PingResponse        = `<iq type='result' to='{{.Host}}' id='{{.Id}}' xmlns='jabber:client'/>`
)

Variables

View Source
var (
	RateLimited = errors.New("xmpp: rate limited")
)

Functions

func EscapeLocal

func EscapeLocal(s string) string

func Parse

func Parse(data string) (interface{}, error)

func PrintTree

func PrintTree(s string)

func UnescapeLocal

func UnescapeLocal(s string) string

Types

type Bind

type Bind struct {
	XMLName xml.Name
	JID     string `xml:"jid"`
}

type Conn

type Conn struct {
	JID  string
	Opts Opts
	// contains filtered or unexported fields
}

func Dial

func Dial(o Opts) (*Conn, error)

func (*Conn) Disconnect

func (c *Conn) Disconnect()

func (*Conn) JoinMUC

func (c *Conn) JoinMUC(room, conference, nick string)

func (*Conn) Kick

func (c *Conn) Kick(lobby, nick, reason string) error

func (*Conn) Recv

func (c *Conn) Recv() (interface{}, error)

func (*Conn) SendComposing

func (c *Conn) SendComposing(jid, typeof string) error

func (*Conn) SendMessage

func (c *Conn) SendMessage(jid, typeof, body string) error

func (*Conn) SendPaused

func (c *Conn) SendPaused(jid, typeof string) error

type Error

type Error struct {
	Code int    `xml:"code"`
	Text string `xml:"text"`
}

type Event

type Event struct {
	Composing *string `xml:"composing"`
	Paused    *string `xml:"paused"`
}

type IQ

type IQ struct {
	XMLName xml.Name
	Id      string `xml:"id,attr"`
	Type    string `xml:"type,attr"`
	Bind    Bind   `xml:"bind"`
	Ping    *Ping  `xml:"ping"`
}

func ParseIQ

func ParseIQ(data string) (IQ, error)

type JID

type JID struct {
	Local string
	Host  string
	Node  string
}

func ParseJID

func ParseJID(s string) (JID, error)

func (JID) String

func (j JID) String() string

type Message

type Message struct {
	Message xml.Name
	Type    string `xml:"type,attr"`
	From    string `xml:"from,attr"`
	To      string `xml:"to,attr"`
	Id      string `xml:"id,attr"`
	Body    string `xml:"body"`
	Error   Error  `xml:"error"`
	X       Event  `xml:"x"`
}

func ParseMessage

func ParseMessage(data string) (Message, error)

type NicknameInUse

type NicknameInUse struct {
	JID
}

type Opts

type Opts struct {
	Debug              bool
	URL                string
	Host               string
	Username, Password string
	Proxy              string
}

type Ping

type Ping struct{}

type Presence

type Presence struct {
	Presence xml.Name
	From     string `xml:"from,attr"`
	To       string `xml:"to,attr"`
	Type     string `xml:"type,attr"`
	Error    *Error `xml:"error"`
}

func ParsePresence

func ParsePresence(data string) (Presence, error)

type Stanza

type Stanza struct {
	Host      string
	Id        string
	JID       string
	MUCJID    string
	Recipient string
	Type      string
	Body      string
	Nick      string
	Reason    string
	MyNick    string
}

func (Stanza) Render

func (s Stanza) Render(st string) string

Jump to

Keyboard shortcuts

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