diff options
Diffstat (limited to 'xmpp/gateway/gateway.go')
-rw-r--r-- | xmpp/gateway/gateway.go | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/xmpp/gateway/gateway.go b/xmpp/gateway/gateway.go index 29c8a07..5761c84 100644 --- a/xmpp/gateway/gateway.go +++ b/xmpp/gateway/gateway.go @@ -42,26 +42,26 @@ var DirtySessions = false var MessageOutgoingPermission = false // SendMessage creates and sends a message stanza -func SendMessage(to string, from string, body string, id string, component *xmpp.Component, reply *Reply, isOutgoing bool) { - sendMessageWrapper(to, from, body, id, component, reply, "", isOutgoing) +func SendMessage(to string, from string, body string, id string, component *xmpp.Component, reply *Reply, isOutgoing bool, nick string) { + sendMessageWrapper(to, from, body, id, component, reply, "", isOutgoing, nick) } // SendServiceMessage creates and sends a simple message stanza from transport func SendServiceMessage(to string, body string, component *xmpp.Component) { - sendMessageWrapper(to, "", body, "", component, nil, "", false) + sendMessageWrapper(to, "", body, "", component, nil, "", 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, "", false) + sendMessageWrapper(to, from, body, "", component, nil, "", 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, oob string, isOutgoing bool) { - sendMessageWrapper(to, from, body, id, component, reply, oob, isOutgoing) +func SendMessageWithOOB(to string, from string, body string, id string, component *xmpp.Component, reply *Reply, oob string, isOutgoing bool, nick string) { + sendMessageWrapper(to, from, body, id, component, reply, oob, isOutgoing, nick) } -func sendMessageWrapper(to string, from string, body string, id string, component *xmpp.Component, reply *Reply, oob string, isOutgoing bool) { +func sendMessageWrapper(to string, from string, body string, id string, component *xmpp.Component, reply *Reply, oob string, isOutgoing bool, nick string) { toJid, err := stanza.NewJid(to) if err != nil { log.WithFields(log.Fields{ @@ -119,6 +119,11 @@ func sendMessageWrapper(to string, from string, body string, id string, componen message.Extensions = append(message.Extensions, extensions.NewReplyFallback(reply.Start, reply.End)) } } + if nick != "" { + message.Extensions = append(message.Extensions, extensions.NickExtension{ + Text: nick, + }) + } if isOutgoing { carbonMessage := extensions.ClientMessage{ @@ -269,7 +274,7 @@ func newPresence(bareJid string, to string, args ...args.V) stanza.Presence { if SPNickname.IsSet(args) { nickname := SPNickname.Get(args) if nickname != "" { - presence.Extensions = append(presence.Extensions, extensions.PresenceNickExtension{ + presence.Extensions = append(presence.Extensions, extensions.NickExtension{ Text: nickname, }) } |