From b3b53b6145c4b8e31d134942507c3ce0226182a4 Mon Sep 17 00:00:00 2001 From: Bohdan Horbeshko Date: Sun, 15 Jan 2023 20:35:13 -0500 Subject: OOB --- xmpp/gateway/gateway.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'xmpp/gateway/gateway.go') diff --git a/xmpp/gateway/gateway.go b/xmpp/gateway/gateway.go index d4620e6..f4ec690 100644 --- a/xmpp/gateway/gateway.go +++ b/xmpp/gateway/gateway.go @@ -28,6 +28,15 @@ var DirtySessions = false // SendMessage creates and sends a message stanza func SendMessage(to string, from string, body string, component *xmpp.Component) { + sendMessageWrapper(to, from, body, component, "") +} + +// SendMessageWithOOB creates and sends a message stanza with OOB URL +func SendMessageWithOOB(to string, from string, body string, component *xmpp.Component, oob string) { + sendMessageWrapper(to, from, body, component, oob) +} + +func sendMessageWrapper(to string, from string, body string, component *xmpp.Component, oob string) { componentJid := Jid.Full() var logFrom string @@ -54,6 +63,12 @@ func SendMessage(to string, from string, body string, component *xmpp.Component) Body: body, } + if oob != "" { + message.Extensions = append(message.Extensions, stanza.OOB{ + URL: oob, + }) + } + sendMessage(&message, component) } -- cgit v1.2.3