From 06104797341533bd96ab2030d110bd843cea5098 Mon Sep 17 00:00:00 2001 From: Bohdan Horbeshko Date: Tue, 8 Feb 2022 12:43:51 -0500 Subject: Attach resource to presences to prevent unwanted behaviour of some clients --- xmpp/gateway/gateway.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'xmpp') 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 } -- cgit v1.2.3