2018-01-01 17:12:33 +00:00
|
|
|
package xmpp // import "fluux.io/xmpp"
|
2016-01-06 15:51:12 +00:00
|
|
|
|
|
|
|
import "encoding/xml"
|
|
|
|
|
2018-01-13 17:50:17 +00:00
|
|
|
// ============================================================================
|
|
|
|
// Presence Packet
|
|
|
|
|
|
|
|
type Presence struct {
|
|
|
|
XMLName xml.Name `xml:"presence"`
|
2018-01-13 16:54:07 +00:00
|
|
|
PacketAttrs
|
2016-01-06 15:51:12 +00:00
|
|
|
Show string `xml:"show,attr,omitempty"` // away, chat, dnd, xa
|
|
|
|
Status string `xml:"status,attr,omitempty"`
|
|
|
|
Priority string `xml:"priority,attr,omitempty"`
|
|
|
|
//Error *clientError
|
|
|
|
}
|
2018-01-13 17:50:17 +00: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 08:08:21 +00:00
|
|
|
// TODO Add default presence type (when omitted)
|
2018-01-13 17:50:17 +00:00
|
|
|
return packet, err
|
|
|
|
}
|