Documentation ¶
Index ¶
- Constants
- func NewReadLogger(log *log.Logger, r io.Reader) io.Reader
- func NewWriteLogger(log *log.Logger, w io.Writer) io.Writer
- func RandomID() string
- type Address
- type DiscoFeature
- type DiscoIdentity
- type DiscoInfoQuery
- type Error
- type Header
- type Iq
- type Message
- type MessageType
- type OutOfBandData
- type Presence
- type ReceiptAck
- type RosterItem
- type RosterQuery
- type Vcard
Constants ¶
const ( // CHAT defines the chat message type CHAT = MessageType("chat") // ERROR defines the error message type ERROR = MessageType("error") // GROUPCHAT defines the group chat message type GROUPCHAT = MessageType("groupchat") // HEADLINE defines the headline message type HEADLINE = MessageType("headline") // NORMAL defines the normal message type NORMAL = MessageType("normal") )
const ( // SUBSCRIBE represents the subscribe Presence message type SUBSCRIBE = "subscribe" // SUBSCRIBED represents the subscribed Presence message type SUBSCRIBED = "subscribed" // UNSUBSCRIBE represents the unsubsribe Presence message type UNSUBSCRIBE = "unsubscribe" // UNSUBSCRIBED represents the unsubsribed Presence message type UNSUBSCRIBED = "unsubscribed" // UNAVAILABLE represents the unavailable Presence message type UNAVAILABLE = "unavailable" // PROBE represents the probe Presence message type PROBE = "probe" )
Variables ¶
This section is empty.
Functions ¶
func NewReadLogger ¶
NewReadLogger returns a reader that behaves like r except that it logs the string read.
func NewWriteLogger ¶
NewWriteLogger returns a writer that behaves like w except that it logs the string written.
Types ¶
type Address ¶
Address is an XMPP JID address
func ParseAddress ¶
ParseAddress parses the address from the given string
func (*Address) MarshalXMLAttr ¶
MarshalXMLAttr marks the Address struct as being able to be written as an XML attribute
type DiscoFeature ¶
type DiscoFeature struct { // Var is a mandatory protocol namespace offered by the entity. Var string `xml:"var,attr"` XMLName string `xml:"feature"` }
DiscoFeature represents a feature element in a response to a service discovery info query.
See the registry of features at http://xmpp.org/registrar/disco-features.html
type DiscoIdentity ¶
type DiscoIdentity struct { // Category is a mandatory description of the category of this // identity. Category often contains values like "conference", // "directory", "gateway", "server", "client", etc. // // See the category registry at http://xmpp.org/registrar/disco-categories.html Category string `xml:"category,attr"` // Type is a mandatory description of the type of this identity. // The type goes together with the Category to help requesting // entities know which services are offered. // // For example, if Category is "gateway" then Type might be "msn" // or "aim". See the type registry at http://xmpp.org/registrar/disco-categories.html Type string `xml:"type,attr"` // Name is an optional natural language name for the entity // described by this identity. Name string `xml:"name,attr,omitempty"` XMLName string `xml:"identity"` }
DiscoIdentity represents an identity element in a response to a service discovery info query.
type DiscoInfoQuery ¶
type DiscoInfoQuery struct { Identities []DiscoIdentity Features []DiscoFeature XMLName xml.Name `xml:"http://jabber.org/protocol/disco#info query"` }
DiscoInfoQuery represents a service discovery info query message. See section 3.1 in XEP-0030.
type Error ¶
type Error struct { XMLName xml.Name Code string `xml:"code,omitempty,attr"` Type string `xml:"type,omitempty,attr"` }
Error is the error sent over XMPP
type Header ¶
type Header struct { ID string `xml:"id,attr,omitempty"` From *Address `xml:"from,attr,omitempty"` To *Address `xml:"to,attr,omitempty"` }
Header contains the common fields for every XEP-0114 message
type Iq ¶
type Iq struct { Header Type string `xml:"type,attr"` Vcard *Vcard `xml:"vcard-temp vCard,omitempty"` RosterQuery *RosterQuery `xml:"jabber:iq:roster query,omitempty"` Content []byte `xml:",innerxml"` XMLName string `xml:"iq"` }
Iq represents an info/query message
func (*Iq) IsDiscoInfo ¶
IsDiscoInfo returns true if an iq stanza is a service discovery info query.
type Message ¶
type Message struct { Header Type MessageType `xml:"type,attr,omitempty"` Subject string `xml:"subject,omitempty"` Body string `xml:"body,omitempty"` Error *Error `xml:"error"` Thread string `xml:"thread,omitempty"` Content string `xml:",innerxml"` // allow arbitrary content // XEP-0184 message delivery receipts ReceiptRequest *xml.Name `xml:"urn:xmpp:receipts request,omitempty"` ReceiptAck *ReceiptAck `xml:"urn:xmpp:receipts received,omitempty"` // XEP-0172 User nicknames Nick string `xml:"http://jabber.org/protocol/nick nick,omitempty"` // XEP-0066 Out of Band Data OutOfBandData *OutOfBandData `xml:"jabber:x:oob x,omitempty"` XMLName xml.Name `xml:"message"` }
A Message is an incoming or outgoing XMPP message
type MessageType ¶
type MessageType string
MessageType defines the constants for the types of messages within XEP-0114
type OutOfBandData ¶
XEP-0066, Out of Band Data
type Presence ¶
type Presence struct { Header Show string `xml:"show,omitempty"` Status string `xml:"status,omitempty"` Priority byte `xml:"priority,omitempty"` Type string `xml:"type,attr,omitempty"` // XEP-0172 User nicknames Nick string `xml:"http://jabber.org/protocol/nick nick,omitempty"` XMLName string `xml:"presence"` }
Presence represents a message identifying whether an entity is available and the subscription requests/responses for the entity
type ReceiptAck ¶
type ReceiptAck struct {
ID string `xml:"id,attr"`
}
ReceiptAck represents an acknowledgement that the message with ID has been received.
type RosterItem ¶
type RosterQuery ¶
type RosterQuery struct { XMLName xml.Name `xml:"jabber:iq:roster query"` Items []RosterItem `xml:"item"` }