From 9c07ca6814b9a3360aaf4f1296c27c37b868c43c Mon Sep 17 00:00:00 2001 From: Martin Dosch Date: Mon, 25 Apr 2022 19:19:18 +0200 Subject: [PATCH] fix --- main.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/main.go b/main.go index ea57a5d..524e9cd 100644 --- a/main.go +++ b/main.go @@ -337,7 +337,10 @@ func main() { reg := regexp.MustCompile(`[\x{0000}-\x{0008}\x{000B}\x{000C}\x{000E}-\x{001F}]`) message = reg.ReplaceAllString(message, "") + var msgType string + msgType = "chat" if *flagChatroom { + msgType = "groupchat" // Join the MUCs. for _, recipient := range recipients { if *flagMUCPassword != "" { @@ -384,7 +387,7 @@ func main() { } default: _, err = client.Send(xmpp.Chat{Remote: recipient.Jid, - Type: "chat", Text: message}) + Type: msgType, Text: message}) if err != nil { log.Fatal(err) } @@ -420,12 +423,6 @@ func main() { } } default: - var msgType string - if *flagChatroom { - msgType = "groupchat" - } else { - msgType = "chat" - } for _, recipient := range recipients { switch { case *flagHttpUpload != "":