32 lines
708 B
Go
32 lines
708 B
Go
|
|
package main
|
||
|
|
|
||
|
|
import (
|
||
|
|
"encoding/xml"
|
||
|
|
"gosrc.io/xmpp/stanza"
|
||
|
|
)
|
||
|
|
|
||
|
|
// Implementation of XEP-0317: Hats
|
||
|
|
// https://xmpp.org/extensions/xep-0317.html
|
||
|
|
|
||
|
|
type Hats struct {
|
||
|
|
XMLName xml.Name `xml:"urn:xmpp:hats:0 hats"`
|
||
|
|
Hats []Hat `xml:"hat"`
|
||
|
|
}
|
||
|
|
|
||
|
|
type Hat struct {
|
||
|
|
Title string `xml:"title,attr"`
|
||
|
|
URI string `xml:"uri,attr"`
|
||
|
|
Hue string `xml:"hue,attr"`
|
||
|
|
Lang string `xml:"xml:lang,attr"`
|
||
|
|
Badge Badge `xml:"badge"`
|
||
|
|
}
|
||
|
|
|
||
|
|
type Badge struct {
|
||
|
|
XMLName xml.Name `xml:"urn:example:badges badge"`
|
||
|
|
Level int `xml:"level,attr"`
|
||
|
|
}
|
||
|
|
|
||
|
|
func init() {
|
||
|
|
stanza.TypeRegistry.MapExtension(stanza.PKTPresence, xml.Name{Space: "urn:xmpp:hats:0", Local: "hats"}, Hats{})
|
||
|
|
}
|