|
|
@ -136,6 +136,7 @@ func main() {
|
|
|
|
flagHeadline := getopt.BoolLong("headline", 0, "Send message as type headline.")
|
|
|
|
flagHeadline := getopt.BoolLong("headline", 0, "Send message as type headline.")
|
|
|
|
flagSCRAMPinning := getopt.StringLong("scram-mech-pinning", 0, "", "Enforce the use of a certain SCRAM authentication mechanism.")
|
|
|
|
flagSCRAMPinning := getopt.StringLong("scram-mech-pinning", 0, "", "Enforce the use of a certain SCRAM authentication mechanism.")
|
|
|
|
flagSSDPOff := getopt.BoolLong("ssdp-off", 0, "Disable XEP-0474: SASL SCRAM Downgrade Protection.")
|
|
|
|
flagSSDPOff := getopt.BoolLong("ssdp-off", 0, "Disable XEP-0474: SASL SCRAM Downgrade Protection.")
|
|
|
|
|
|
|
|
flagSubject := getopt.StringLong("subject", 's', "", "Set message subject.")
|
|
|
|
|
|
|
|
|
|
|
|
// Parse command line flags.
|
|
|
|
// Parse command line flags.
|
|
|
|
getopt.Parse()
|
|
|
|
getopt.Parse()
|
|
|
@ -581,7 +582,7 @@ func main() {
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
}
|
|
|
|
oxMessage, err := oxEncrypt(client, oxPrivKey,
|
|
|
|
oxMessage, err := oxEncrypt(client, oxPrivKey,
|
|
|
|
recipient.Jid, recipient.OxKeyRing, message)
|
|
|
|
recipient.Jid, recipient.OxKeyRing, message, *flagSubject)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println("Ox: couldn't encrypt to",
|
|
|
|
fmt.Println("Ox: couldn't encrypt to",
|
|
|
|
recipient.Jid)
|
|
|
|
recipient.Jid)
|
|
|
@ -596,6 +597,7 @@ func main() {
|
|
|
|
_, err = client.Send(xmpp.Chat{
|
|
|
|
_, err = client.Send(xmpp.Chat{
|
|
|
|
Remote: recipient.Jid,
|
|
|
|
Remote: recipient.Jid,
|
|
|
|
Type: msgType, Text: message,
|
|
|
|
Type: msgType, Text: message,
|
|
|
|
|
|
|
|
Subject: *flagSubject,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
cancel()
|
|
|
|
cancel()
|
|
|
@ -692,6 +694,7 @@ func main() {
|
|
|
|
_, err = client.Send(xmpp.Chat{
|
|
|
|
_, err = client.Send(xmpp.Chat{
|
|
|
|
Remote: recipient.Jid,
|
|
|
|
Remote: recipient.Jid,
|
|
|
|
Type: msgType, Ooburl: message, Text: message,
|
|
|
|
Type: msgType, Ooburl: message, Text: message,
|
|
|
|
|
|
|
|
Subject: *flagSubject,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println("Couldn't send message to",
|
|
|
|
fmt.Println("Couldn't send message to",
|
|
|
@ -700,9 +703,15 @@ func main() {
|
|
|
|
// (Hopefully) temporary workaround due to go-xmpp choking on URL encoding.
|
|
|
|
// (Hopefully) temporary workaround due to go-xmpp choking on URL encoding.
|
|
|
|
// Once this is fixed in the lib the http-upload case above can be reused.
|
|
|
|
// Once this is fixed in the lib the http-upload case above can be reused.
|
|
|
|
case *flagOOBFile != "":
|
|
|
|
case *flagOOBFile != "":
|
|
|
|
_, err = client.SendOrg("<message to='" + recipient.Jid + "' type='" +
|
|
|
|
var msg string
|
|
|
|
msgType + "'><body>" + message + "</body><x xmlns='jabber:x:oob'><url>" +
|
|
|
|
if *flagSubject != "" {
|
|
|
|
message + "</url></x></message>")
|
|
|
|
msg = fmt.Sprintf("<message to='%s' type='%s'><subject>%s</subject><body>%s</body><x xmlns='jabber:x:oob'><url>%s</url></x></message>",
|
|
|
|
|
|
|
|
recipient.Jid, msgType, *flagSubject, message, message)
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
msg = fmt.Sprintf("<message to='%s' type='%s'><body>%s</body><x xmlns='jabber:x:oob'><url>%s</url></x></message>",
|
|
|
|
|
|
|
|
recipient.Jid, msgType, message, message)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
_, err = client.SendOrg(msg)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println("Couldn't send message to",
|
|
|
|
fmt.Println("Couldn't send message to",
|
|
|
|
recipient.Jid)
|
|
|
|
recipient.Jid)
|
|
|
@ -712,7 +721,7 @@ func main() {
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
}
|
|
|
|
oxMessage, err := oxEncrypt(client, oxPrivKey,
|
|
|
|
oxMessage, err := oxEncrypt(client, oxPrivKey,
|
|
|
|
recipient.Jid, recipient.OxKeyRing, message)
|
|
|
|
recipient.Jid, recipient.OxKeyRing, message, *flagSubject)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println("Ox: couldn't encrypt to", recipient.Jid)
|
|
|
|
fmt.Println("Ox: couldn't encrypt to", recipient.Jid)
|
|
|
|
continue
|
|
|
|
continue
|
|
|
@ -726,6 +735,7 @@ func main() {
|
|
|
|
_, err = client.Send(xmpp.Chat{
|
|
|
|
_, err = client.Send(xmpp.Chat{
|
|
|
|
Remote: recipient.Jid,
|
|
|
|
Remote: recipient.Jid,
|
|
|
|
Type: msgType, Text: message,
|
|
|
|
Type: msgType, Text: message,
|
|
|
|
|
|
|
|
Subject: *flagSubject,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
cancel()
|
|
|
|
cancel()
|
|
|
|