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 != "":