xmpp

package
v0.0.0-...-61777e6 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2018 License: MIT Imports: 8 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 */
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Bind

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

type Client

type Client struct {
	JID  string
	Opts Opts
	Sock ws.Conn
}

func (*Client) Disconnect

func (c *Client) Disconnect()

func (*Client) JoinMUC

func (c *Client) JoinMUC(jid, nick string)

func (*Client) Kick

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

func (*Client) Recv

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

func (*Client) SendComposing

func (c *Client) SendComposing(jid, typeof string)

func (*Client) SendMessage

func (c *Client) SendMessage(jid, typeof, body string)

func (*Client) SendPaused

func (c *Client) SendPaused(jid, typeof string)

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"`
}

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"`
}

type Opts

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

func (Opts) Connect

func (o Opts) Connect() (*Client, error)

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"`
}

type Stanza

type Stanza struct {
	Host      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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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