|
|
|
@ -337,8 +337,7 @@ func main() {
|
|
|
|
|
reg := regexp.MustCompile(`[\x{0000}-\x{0008}\x{000B}\x{000C}\x{000E}-\x{001F}]`)
|
|
|
|
|
message = reg.ReplaceAllString(message, "")
|
|
|
|
|
|
|
|
|
|
switch {
|
|
|
|
|
case *flagChatroom:
|
|
|
|
|
if *flagChatroom {
|
|
|
|
|
// Join the MUCs.
|
|
|
|
|
for _, recipient := range recipients {
|
|
|
|
|
if *flagMUCPassword != "" {
|
|
|
|
@ -352,7 +351,8 @@ func main() {
|
|
|
|
|
log.Fatal(err)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fallthrough
|
|
|
|
|
}
|
|
|
|
|
switch {
|
|
|
|
|
case *flagRaw:
|
|
|
|
|
// Send raw XML
|
|
|
|
|
_, err = client.SendOrg(message)
|
|
|
|
@ -420,11 +420,17 @@ func main() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
var msgType string
|
|
|
|
|
if *flagChatroom {
|
|
|
|
|
msgType = "groupchat"
|
|
|
|
|
} else {
|
|
|
|
|
msgType = "chat"
|
|
|
|
|
}
|
|
|
|
|
for _, recipient := range recipients {
|
|
|
|
|
switch {
|
|
|
|
|
case *flagHttpUpload != "":
|
|
|
|
|
_, err = client.Send(xmpp.Chat{Remote: recipient.Jid,
|
|
|
|
|
Type: "chat", Ooburl: message, Text: message})
|
|
|
|
|
Type: msgType, Ooburl: message, Text: message})
|
|
|
|
|
if err != nil {
|
|
|
|
|
fmt.Println("Couldn't send message to",
|
|
|
|
|
recipient.Jid)
|
|
|
|
@ -445,7 +451,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)
|
|
|
|
|
}
|
|
|
|
|