aboutsummaryrefslogtreecommitdiff
path: root/xmpp/extensions/extensions.go
diff options
context:
space:
mode:
authorBohdan Horbeshko <bodqhrohro@gmail.com>2023-09-19 11:23:39 +0300
committerBohdan Horbeshko <bodqhrohro@gmail.com>2023-09-19 11:23:39 +0300
commite77caf2c42c079062ade31f928a40b7654ac9bfd (patch)
tree81893edc63a503e277778370f5aa5509ef86eed4 /xmpp/extensions/extensions.go
parentc1887e5a1ed80fd06795a1017c821375562ff70b (diff)
Send recent history on MUC join
Diffstat (limited to 'xmpp/extensions/extensions.go')
-rw-r--r--xmpp/extensions/extensions.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/xmpp/extensions/extensions.go b/xmpp/extensions/extensions.go
index 3a2f998..679b428 100644
--- a/xmpp/extensions/extensions.go
+++ b/xmpp/extensions/extensions.go
@@ -234,6 +234,20 @@ type PresenceXMucUserStatus struct {
Code uint16 `xml:"code,attr"`
}
+// MessageDelay is from XEP-0203
+type MessageDelay struct {
+ XMLName xml.Name `xml:"urn:xmpp:delay delay"`
+ From string `xml:"from,attr"`
+ Stamp string `xml:"stamp,attr"`
+}
+
+// MessageDelayLegacy is from XEP-0203
+type MessageDelayLegacy struct {
+ XMLName xml.Name `xml:"jabber:x:delay x"`
+ From string `xml:"from,attr"`
+ Stamp string `xml:"stamp,attr"`
+}
+
// Namespace is a namespace!
func (c PresenceNickExtension) Namespace() string {
return c.XMLName.Space
@@ -304,6 +318,16 @@ func (c PresenceXMucUserExtension) Namespace() string {
return c.XMLName.Space
}
+// Namespace is a namespace!
+func (c MessageDelay) Namespace() string {
+ return c.XMLName.Space
+}
+
+// Namespace is a namespace!
+func (c MessageDelayLegacy) Namespace() string {
+ return c.XMLName.Space
+}
+
// Name is a packet name
func (ClientMessage) Name() string {
return "message"
@@ -394,4 +418,16 @@ func init() {
"http://jabber.org/protocol/muc#user",
"x",
}, PresenceXMucUserExtension{})
+
+ // message delay
+ stanza.TypeRegistry.MapExtension(stanza.PKTMessage, xml.Name{
+ "urn:xmpp:delay",
+ "delay",
+ }, MessageDelay{})
+
+ // legacy message delay
+ stanza.TypeRegistry.MapExtension(stanza.PKTMessage, xml.Name{
+ "jabber:x:delay",
+ "x",
+ }, MessageDelayLegacy{})
}