diff options
author | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2023-08-26 15:59:14 +0300 |
---|---|---|
committer | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2023-08-26 15:59:14 +0300 |
commit | 8ba7596ab5b9cd731fb507f60da51c6acf1ef27f (patch) | |
tree | 91e17a6bdd70300f2d784e60a1f88d47d3ec18ad /xmpp/extensions | |
parent | 3c917c16983c1afdd4a21d8021461585a1e785c9 (diff) | |
parent | 64515e2c666067953e3a9680b4f0db84f3838498 (diff) |
Merge branch 'master' into dev
Diffstat (limited to 'xmpp/extensions')
-rw-r--r-- | xmpp/extensions/extensions.go | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/xmpp/extensions/extensions.go b/xmpp/extensions/extensions.go index 2d547af..192b630 100644 --- a/xmpp/extensions/extensions.go +++ b/xmpp/extensions/extensions.go @@ -154,12 +154,19 @@ type CarbonSent struct { } // ComponentPrivilege is from XEP-0356 -type ComponentPrivilege struct { +type ComponentPrivilege1 struct { XMLName xml.Name `xml:"urn:xmpp:privilege:1 privilege"` Perms []ComponentPerm `xml:"perm"` Forwarded stanza.Forwarded `xml:"urn:xmpp:forward:0 forwarded"` } +// ComponentPrivilege is from XEP-0356 +type ComponentPrivilege2 struct { + XMLName xml.Name `xml:"urn:xmpp:privilege:2 privilege"` + Perms []ComponentPerm `xml:"perm"` + Forwarded stanza.Forwarded `xml:"urn:xmpp:forward:0 forwarded"` +} + // ComponentPerm is from XEP-0356 type ComponentPerm struct { XMLName xml.Name `xml:"perm"` @@ -227,7 +234,12 @@ func (c CarbonSent) Namespace() string { } // Namespace is a namespace! -func (c ComponentPrivilege) Namespace() string { +func (c ComponentPrivilege1) Namespace() string { + return c.XMLName.Space +} + +// Namespace is a namespace! +func (c ComponentPrivilege2) Namespace() string { return c.XMLName.Space } @@ -297,11 +309,17 @@ func init() { "sent", }, CarbonSent{}) - // component privilege + // component privilege v1 stanza.TypeRegistry.MapExtension(stanza.PKTMessage, xml.Name{ "urn:xmpp:privilege:1", "privilege", - }, ComponentPrivilege{}) + }, ComponentPrivilege1{}) + + // component privilege v2 + stanza.TypeRegistry.MapExtension(stanza.PKTMessage, xml.Name{ + "urn:xmpp:privilege:2", + "privilege", + }, ComponentPrivilege2{}) // message edit stanza.TypeRegistry.MapExtension(stanza.PKTMessage, xml.Name{ |