Random IDs for service messages
This commit is contained in:
parent
a74e2bcb7d
commit
af07773b07
2
Makefile
2
Makefile
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
COMMIT := $(shell git rev-parse --short HEAD)
|
COMMIT := $(shell git rev-parse --short HEAD)
|
||||||
TD_COMMIT := "5bbfc1cf5dab94f82e02f3430ded7241d4653551"
|
TD_COMMIT := "5bbfc1cf5dab94f82e02f3430ded7241d4653551"
|
||||||
VERSION := "v1.9.4"
|
VERSION := "v1.9.5"
|
||||||
MAKEOPTS := "-j4"
|
MAKEOPTS := "-j4"
|
||||||
|
|
||||||
all:
|
all:
|
||||||
|
|
|
@ -16,7 +16,7 @@ import (
|
||||||
goxmpp "gosrc.io/xmpp"
|
goxmpp "gosrc.io/xmpp"
|
||||||
)
|
)
|
||||||
|
|
||||||
var version string = "1.9.4"
|
var version string = "1.9.5"
|
||||||
var commit string
|
var commit string
|
||||||
|
|
||||||
var sm *goxmpp.StreamManager
|
var sm *goxmpp.StreamManager
|
||||||
|
|
|
@ -10,6 +10,7 @@ import (
|
||||||
"dev.narayana.im/narayana/telegabber/badger"
|
"dev.narayana.im/narayana/telegabber/badger"
|
||||||
"dev.narayana.im/narayana/telegabber/xmpp/extensions"
|
"dev.narayana.im/narayana/telegabber/xmpp/extensions"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/soheilhy/args"
|
"github.com/soheilhy/args"
|
||||||
"gosrc.io/xmpp"
|
"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
|
// SendServiceMessage creates and sends a simple message stanza from transport
|
||||||
func SendServiceMessage(to string, body string, component *xmpp.Component) {
|
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
|
// SendTextMessage creates and sends a simple message stanza
|
||||||
func SendTextMessage(to string, from string, body string, component *xmpp.Component) {
|
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
|
// SendMessageWithOOB creates and sends a message stanza with OOB URL
|
||||||
|
|
Loading…
Reference in a new issue