2026-01-29 21:35:36 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"encoding/xml"
|
|
|
|
|
"gosrc.io/xmpp/stanza"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Implementation of XEP-0359: Unique and Stable Stanza IDs
|
|
|
|
|
|
|
|
|
|
type StanzaID struct {
|
|
|
|
|
stanza.MsgExtension
|
|
|
|
|
XMLName xml.Name `xml:"urn:xmpp:sid:0 stanza-id"`
|
|
|
|
|
By string `xml:"by,attr"`
|
|
|
|
|
ID string `xml:"id,attr"`
|
|
|
|
|
}
|
|
|
|
|
|
2026-08-20 11:01:25 +01:00
|
|
|
type OriginID struct {
|
|
|
|
|
stanza.MsgExtension
|
|
|
|
|
XMLName xml.Name `xml:"urn:xmpp:sid:0 origin-id"`
|
|
|
|
|
ID string `xml:"id,attr"`
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-29 21:35:36 +00:00
|
|
|
func init() {
|
|
|
|
|
stanza.TypeRegistry.MapExtension(stanza.PKTMessage, xml.Name{Space: "urn:xmpp:sid:0", Local: "stanza-id"}, StanzaID{})
|
2026-08-20 11:01:25 +01:00
|
|
|
stanza.TypeRegistry.MapExtension(stanza.PKTMessage, xml.Name{Space: "urn:xmpp:sid:0", Local: "origin-id"}, OriginID{})
|
2026-01-29 21:35:36 +00:00
|
|
|
}
|