diff options
author | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2024-05-11 02:24:15 +0300 |
---|---|---|
committer | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2024-05-11 02:24:15 +0300 |
commit | 9aec929e71c9a05a9b31d29607bf9dc2a99d070e (patch) | |
tree | 5350c51acf9843b346c57671bd359caf056d7d6d | |
parent | 4eae44b9a27da488b8f6b4c5c057ff472051b087 (diff) | |
parent | af07773b07ed3d0138ad237906bcd8e81512a11d (diff) |
Merge branch 'master' into adhoc
-rw-r--r-- | xmpp/gateway/gateway.go | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/xmpp/gateway/gateway.go b/xmpp/gateway/gateway.go index de0ec8d..1507e31 100644 --- a/xmpp/gateway/gateway.go +++ b/xmpp/gateway/gateway.go @@ -10,6 +10,7 @@ import ( "dev.narayana.im/narayana/telegabber/badger" "dev.narayana.im/narayana/telegabber/xmpp/extensions" + "github.com/google/uuid" log "github.com/sirupsen/logrus" "github.com/soheilhy/args" "gosrc.io/xmpp" @@ -61,12 +62,20 @@ func SendMessage(to string, from string, body string, id string, component *xmpp // SendServiceMessage creates and sends a simple message stanza from transport func SendServiceMessage(to string, body string, component *xmpp.Component) { - sendMessageWrapper(to, "", body, "", component, nil, nil, "", "", false, false) + var id string + if uuid, err := uuid.NewRandom(); err == nil { + id = uuid.String() + } + sendMessageWrapper(to, "", body, id, component, nil, nil, "", "", false, false) } // SendTextMessage creates and sends a simple message stanza func SendTextMessage(to string, from string, body string, component *xmpp.Component) { - sendMessageWrapper(to, from, body, "", component, nil, nil, "", "", false, false) + var id string + if uuid, err := uuid.NewRandom(); err == nil { + id = uuid.String() + } + sendMessageWrapper(to, from, body, id, component, nil, nil, "", "", false, false) } // SendMessageWithOOB creates and sends a message stanza with OOB URL |