30 lines
1.0 KiB
Go
30 lines
1.0 KiB
Go
package main
|
|
|
|
import (
|
|
"encoding/xml"
|
|
"gosrc.io/xmpp/stanza"
|
|
)
|
|
|
|
// Implementation of XEP-0424: Message Retraction as well as XEP-0425: Moderated Message Retraction
|
|
|
|
type Retraction struct {
|
|
stanza.MsgExtension
|
|
XMLName xml.Name `xml:"urn:xmpp:message-retract:1 retract"`
|
|
ID string `xml:"id,attr"` // Stanza ID is used in group chats.
|
|
Reason string `xml:"reason"`
|
|
Moderated Moderated `xml:"urn:xmpp:message-moderate:1 moderated"`
|
|
}
|
|
|
|
type Moderated struct {
|
|
XMLName xml.Name `xml:"urn:xmpp:message-moderate:1 moderated"`
|
|
By string `xml:"by,attr"`
|
|
OccupantID OccupantID
|
|
|
|
}
|
|
|
|
// To whoever thought putting the same element twice in the same message, but in different parents, and not specifying this behaviour anywhere in the XEP was a good idea, I want to kill you. Seriously, I do. If I see you walking home at night I will kill you. Brutally. Slowly. I will relish in the act. I will do it.
|
|
|
|
func init() {
|
|
stanza.TypeRegistry.MapExtension(stanza.PKTMessage, xml.Name{Space: "urn:xmpp:message-retract:1", Local: "retract"}, Retraction{})
|
|
}
|