|
|
|
@ -43,26 +43,26 @@ var DirtySessions = false
|
|
|
|
|
var MessageOutgoingPermissionVersion = 0
|
|
|
|
|
|
|
|
|
|
// SendMessage creates and sends a message stanza
|
|
|
|
|
func SendMessage(to string, from string, body string, id string, component *xmpp.Component, reply *Reply, timestamp int64, isCarbon, isGroupchat bool) {
|
|
|
|
|
sendMessageWrapper(to, from, body, id, component, reply, timestamp, "", isCarbon, isGroupchat)
|
|
|
|
|
func SendMessage(to string, from string, body string, id string, component *xmpp.Component, reply *Reply, timestamp int64, isCarbon, isGroupchat bool, originalFrom string) {
|
|
|
|
|
sendMessageWrapper(to, from, body, id, component, reply, timestamp, "", isCarbon, isGroupchat, originalFrom)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SendServiceMessage creates and sends a simple message stanza from transport
|
|
|
|
|
func SendServiceMessage(to string, body string, component *xmpp.Component) {
|
|
|
|
|
sendMessageWrapper(to, "", body, "", component, nil, 0, "", false, false)
|
|
|
|
|
sendMessageWrapper(to, "", body, "", component, nil, 0, "", 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, 0, "", false, false)
|
|
|
|
|
sendMessageWrapper(to, from, body, "", component, nil, 0, "", false, false, "")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SendMessageWithOOB creates and sends a message stanza with OOB URL
|
|
|
|
|
func SendMessageWithOOB(to string, from string, body string, id string, component *xmpp.Component, reply *Reply, timestamp int64, oob string, isCarbon bool, isGroupchat bool) {
|
|
|
|
|
sendMessageWrapper(to, from, body, id, component, reply, timestamp, oob, isCarbon, isGroupchat)
|
|
|
|
|
func SendMessageWithOOB(to string, from string, body string, id string, component *xmpp.Component, reply *Reply, timestamp int64, oob string, isCarbon bool, isGroupchat bool, originalFrom string) {
|
|
|
|
|
sendMessageWrapper(to, from, body, id, component, reply, timestamp, oob, isCarbon, isGroupchat, originalFrom)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func sendMessageWrapper(to string, from string, body string, id string, component *xmpp.Component, reply *Reply, timestamp int64, oob string, isCarbon bool, isGroupchat bool) {
|
|
|
|
|
func sendMessageWrapper(to string, from string, body string, id string, component *xmpp.Component, reply *Reply, timestamp int64, oob string, isCarbon bool, isGroupchat bool, originalFrom string) {
|
|
|
|
|
toJid, err := stanza.NewJid(to)
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.WithFields(log.Fields{
|
|
|
|
@ -149,6 +149,16 @@ func sendMessageWrapper(to string, from string, body string, id string, componen
|
|
|
|
|
Stamp: time.Unix(timestamp, 0).UTC().Format("20060102T15:04:05"),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
if originalFrom != "" {
|
|
|
|
|
message.Extensions = append(message.Extensions, extensions.MessageAddresses{
|
|
|
|
|
Addresses: []extensions.MessageAddress{
|
|
|
|
|
extensions.MessageAddress{
|
|
|
|
|
Type: "ofrom",
|
|
|
|
|
Jid: originalFrom,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if isCarbon {
|
|
|
|
|
carbonMessage := extensions.ClientMessage{
|
|
|
|
|