aboutsummaryrefslogtreecommitdiff
path: root/xmpp/handlers.go
diff options
context:
space:
mode:
authorBohdan Horbeshko <bodqhrohro@gmail.com>2023-08-03 00:08:06 +0300
committerBohdan Horbeshko <bodqhrohro@gmail.com>2023-08-03 00:08:06 +0300
commitc03ccfdfb713d4fcb089600d9fd91f03e469daca (patch)
treed759d1fe9b227f3f2887411d579c51561996c0e9 /xmpp/handlers.go
parent608f67551297a14e2e23603413bbce66f6ad5cd9 (diff)
Support urn:xmpp:privilege:2v1.7.4
Diffstat (limited to 'xmpp/handlers.go')
-rw-r--r--xmpp/handlers.go21
1 files changed, 16 insertions, 5 deletions
diff --git a/xmpp/handlers.go b/xmpp/handlers.go
index 4e3354e..6679a72 100644
--- a/xmpp/handlers.go
+++ b/xmpp/handlers.go
@@ -209,14 +209,25 @@ func HandleMessage(s xmpp.Sender, p stanza.Packet) {
}
if msg.Body == "" {
- var privilege extensions.ComponentPrivilege
- if ok := msg.Get(&privilege); ok {
- log.Debugf("privilege: %#v", privilege)
+ var privilege1 extensions.ComponentPrivilege1
+ if ok := msg.Get(&privilege1); ok {
+ log.Debugf("privilege1: %#v", privilege1)
}
- for _, perm := range privilege.Perms {
+ for _, perm := range privilege1.Perms {
if perm.Access == "message" && perm.Type == "outgoing" {
- gateway.MessageOutgoingPermission = true
+ gateway.MessageOutgoingPermissionVersion = 1
+ }
+ }
+
+ var privilege2 extensions.ComponentPrivilege2
+ if ok := msg.Get(&privilege2); ok {
+ log.Debugf("privilege2: %#v", privilege2)
+ }
+
+ for _, perm := range privilege2.Perms {
+ if perm.Access == "message" && perm.Type == "outgoing" {
+ gateway.MessageOutgoingPermissionVersion = 2
}
}
}