This commit is contained in:
Mickael Remond
2019-07-27 16:50:10 -07:00
parent e553028754
commit 6a5f2750f1
7 changed files with 516 additions and 13 deletions
+7 -5
View File
@@ -7,25 +7,27 @@ import (
"gosrc.io/xmpp/stanza"
)
func send(c xmpp.Sender, receiver []string, msgText string) {
func send(c xmpp.Sender, recipient []string, msgText string) {
msg := stanza.Message{
Attrs: stanza.Attrs{Type: stanza.MessageTypeChat},
Body: msgText,
}
if receiverMUC {
if isMUCRecipient {
msg.Type = stanza.MessageTypeGroupchat
}
for _, to := range receiver {
for _, to := range recipient {
msg.To = to
if err := c.Send(msg); err != nil {
log.WithFields(map[string]interface{}{
"muc": receiverMUC,
"muc": isMUCRecipient,
"to": to,
"text": msgText,
}).Errorf("error on send message: %s", err)
} else {
log.WithFields(map[string]interface{}{
"muc": receiverMUC,
"muc": isMUCRecipient,
"to": to,
"text": msgText,
}).Info("send message")