2018-01-01 09:12:33 -08:00
|
|
|
package xmpp // import "fluux.io/xmpp"
|
2016-01-06 07:51:12 -08:00
|
|
|
|
2018-01-13 09:50:17 -08:00
|
|
|
import (
|
|
|
|
"encoding/xml"
|
|
|
|
)
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
// StreamFeatures Packet
|
2016-01-06 07:51:12 -08:00
|
|
|
|
|
|
|
type streamFeatures struct {
|
|
|
|
XMLName xml.Name `xml:"http://etherx.jabber.org/streams features"`
|
|
|
|
StartTLS tlsStartTLS
|
|
|
|
Caps Caps
|
|
|
|
Mechanisms saslMechanisms
|
2018-01-16 13:33:21 -08:00
|
|
|
Bind BindBind
|
2016-01-06 07:51:12 -08:00
|
|
|
Session sessionSession
|
|
|
|
Any []xml.Name `xml:",any"`
|
|
|
|
}
|
|
|
|
|
2018-01-13 09:50:17 -08:00
|
|
|
// ============================================================================
|
|
|
|
// StreamError Packet
|
|
|
|
|
2018-01-11 14:00:59 -08:00
|
|
|
type StreamError struct {
|
|
|
|
XMLName xml.Name `xml:"http://etherx.jabber.org/streams error"`
|
|
|
|
Error xml.Name `xml:",any"`
|
|
|
|
}
|
|
|
|
|
2018-01-13 09:50:17 -08:00
|
|
|
func (StreamError) Name() string {
|
|
|
|
return "stream:error"
|
|
|
|
}
|
|
|
|
|
|
|
|
type streamErrorDecoder struct{}
|
|
|
|
|
|
|
|
var streamError streamErrorDecoder
|
|
|
|
|
|
|
|
func (streamErrorDecoder) decode(p *xml.Decoder, se xml.StartElement) (StreamError, error) {
|
|
|
|
var packet StreamError
|
|
|
|
err := p.DecodeElement(&packet, &se)
|
|
|
|
return packet, err
|
|
|
|
}
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
// Caps subElement
|
|
|
|
|
2016-01-06 07:51:12 -08:00
|
|
|
type Caps struct {
|
|
|
|
XMLName xml.Name `xml:"http://jabber.org/protocol/caps c"`
|
|
|
|
Hash string `xml:"hash,attr"`
|
|
|
|
Node string `xml:"node,attr"`
|
|
|
|
Ver string `xml:"ver,attr"`
|
|
|
|
Ext string `xml:"ext,attr,omitempty"`
|
|
|
|
}
|