aboutsummaryrefslogtreecommitdiff
path: root/xmpp
diff options
context:
space:
mode:
authorBohdan Horbeshko <bodqhrohro@gmail.com>2022-02-08 20:43:51 +0300
committerBohdan Horbeshko <bodqhrohro@gmail.com>2022-02-08 20:43:51 +0300
commit06104797341533bd96ab2030d110bd843cea5098 (patch)
tree4187611cd939158e6fd210d35156f41158205577 /xmpp
parent76364388ad2d7baa0718dff50902eacd4c090edf (diff)
Attach resource to presences to prevent unwanted behaviour of some clients
Diffstat (limited to 'xmpp')
-rw-r--r--xmpp/gateway/gateway.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/xmpp/gateway/gateway.go b/xmpp/gateway/gateway.go
index 779c6fe..4edaec4 100644
--- a/xmpp/gateway/gateway.go
+++ b/xmpp/gateway/gateway.go
@@ -88,6 +88,9 @@ var SPNickname = args.NewString()
// SPPhoto is a XEP-0153 hash of avatar in vCard
var SPPhoto = args.NewString()
+// SPResource is an optional resource
+var SPResource = args.NewString()
+
// SPImmed skips queueing
var SPImmed = args.NewBool(args.Default(true))
@@ -95,6 +98,12 @@ func newPresence(bareJid string, to string, args ...args.V) stanza.Presence {
var presenceFrom string
if SPFrom.IsSet(args) {
presenceFrom = SPFrom.Get(args) + "@" + bareJid
+ if SPResource.IsSet(args) {
+ resource := SPResource.Get(args)
+ if resource != "" {
+ presenceFrom += "/" + resource
+ }
+ }
} else {
presenceFrom = bareJid
}