|
|
|
@ -396,10 +396,11 @@ func main() {
|
|
|
|
|
// Remove invalid UTF8 code points.
|
|
|
|
|
message = validUTF8(*flagOOBFile)
|
|
|
|
|
// Check if the URI is valid.
|
|
|
|
|
_, err := validURI(message)
|
|
|
|
|
uri, err := validURI(message)
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Fatal(err)
|
|
|
|
|
}
|
|
|
|
|
message = uri.String()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var msgType string
|
|
|
|
@ -545,13 +546,23 @@ func main() {
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
switch {
|
|
|
|
|
case *flagHTTPUpload != "" || *flagOOBFile != "":
|
|
|
|
|
case *flagHTTPUpload != "":
|
|
|
|
|
_, err = client.Send(xmpp.Chat{Remote: recipient.Jid,
|
|
|
|
|
Type: msgType, Ooburl: message, Text: message})
|
|
|
|
|
if err != nil {
|
|
|
|
|
fmt.Println("Couldn't send message to",
|
|
|
|
|
recipient.Jid)
|
|
|
|
|
}
|
|
|
|
|
// (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.
|
|
|
|
|
case *flagOOBFile != "":
|
|
|
|
|
_, err = client.SendOrg("<message to='" + recipient.Jid + "' type='" +
|
|
|
|
|
msgType + "'><body>" + message + "</body><x xmlns='jabber:x:oob'><url>" +
|
|
|
|
|
message + "</url></x></message>")
|
|
|
|
|
if err != nil {
|
|
|
|
|
fmt.Println("Couldn't send message to",
|
|
|
|
|
recipient.Jid)
|
|
|
|
|
}
|
|
|
|
|
case *flagOx:
|
|
|
|
|
if recipient.OxKeyRing == nil {
|
|
|
|
|
continue
|
|
|
|
|