Add experimental hats support
This commit is contained in:
31
xmpp-hats.go
Normal file
31
xmpp-hats.go
Normal file
@@ -0,0 +1,31 @@
|
||||
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{})
|
||||
}
|
||||
Reference in New Issue
Block a user