diff options
author | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2022-05-26 14:14:38 +0300 |
---|---|---|
committer | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2022-05-26 14:14:38 +0300 |
commit | 70841a2bea61728c75f6675bcd3355e8dfdcd087 (patch) | |
tree | 2405e12fb7f306a0f64725a5631bfb5d7f509e43 /xmpp/handlers.go | |
parent | ae16fd2a0b48c3659a012accd0269323935dfd14 (diff) |
Always send XMPP messages with a resource
Diffstat (limited to 'xmpp/handlers.go')
-rw-r--r-- | xmpp/handlers.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/xmpp/handlers.go b/xmpp/handlers.go index b4440a0..d68838b 100644 --- a/xmpp/handlers.go +++ b/xmpp/handlers.go @@ -88,8 +88,9 @@ func HandleMessage(s xmpp.Sender, p stanza.Packet) { if ok { session.ProcessOutgoingMessage(toID, msg.Body, msg.From) return - } else if msg.To == gatewayJid { - if strings.HasPrefix(msg.Body, "/") || strings.HasPrefix(msg.Body, "!") { + } else { + toJid, err := stanza.NewJid(msg.To) + if err == nil && toJid.Bare() == gatewayJid && (strings.HasPrefix(msg.Body, "/") || strings.HasPrefix(msg.Body, "!")) { response := session.ProcessTransportCommand(msg.Body, resource) if response != "" { gateway.SendMessage(msg.From, "", response, component) |