go-xmpp/presence.go

31 lines
775 B
Go
Raw Normal View History

2018-01-01 09:12:33 -08:00
package xmpp // import "fluux.io/xmpp"
import "encoding/xml"
2018-01-13 09:50:17 -08:00
// ============================================================================
// Presence Packet
type Presence struct {
XMLName xml.Name `xml:"presence"`
2018-01-13 08:54:07 -08:00
PacketAttrs
Show string `xml:"show,attr,omitempty"` // away, chat, dnd, xa
Status string `xml:"status,attr,omitempty"`
Priority string `xml:"priority,attr,omitempty"`
Error Err `xml:"error,omitempty"`
}
2018-01-13 09:50:17 -08:00
func (Presence) Name() string {
return "presence"
}
type presenceDecoder struct{}
var presence presenceDecoder
func (presenceDecoder) decode(p *xml.Decoder, se xml.StartElement) (Presence, error) {
var packet Presence
err := p.DecodeElement(&packet, &se)
2018-01-23 00:08:21 -08:00
// TODO Add default presence type (when omitted)
2018-01-13 09:50:17 -08:00
return packet, err
}