Send http-upload in OOB message

http_upload
Martin Dosch 4 years ago
parent 2622081bad
commit db2ccee50e

@ -339,8 +339,17 @@ func main() {
} else {
// Send the message.
for _, recipient := range recipients {
_, err = client.Send(xmpp.Chat{Remote: recipient,
Type: "groupchat", Text: message})
if *flagHttpUpload != "" {
_, err = client.SendOrg("<message to='" +
recipient + "' from ='" + client.JID() +
"' type='groupchat' xml:lang='en'>" +
"<body>" + message + "</body>" +
"<x xmlns='jabber:x:oob'><url>" +
message + "</url></x></message>")
} else {
_, err = client.Send(xmpp.Chat{Remote: recipient,
Type: "groupchat", Text: message})
}
if err != nil {
// Try to nicely close connection,
// even if there was an error sending.
@ -379,8 +388,17 @@ func main() {
}
} else {
for _, recipient := range recipients {
_, err = client.Send(xmpp.Chat{Remote: recipient, Type: "chat",
Text: message})
if *flagHttpUpload != "" {
_, err = client.SendOrg("<message to='" +
recipient + "' from ='" + client.JID() +
"' type='chat' xml:lang='en'>" +
"<body>" + message + "</body>" +
"<x xmlns='jabber:x:oob'><url>" +
message + "</url></x></message>")
} else {
_, err = client.Send(xmpp.Chat{Remote: recipient, Type: "chat",
Text: message})
}
if err != nil {
// Try to nicely close connection,
// even if there was an error sending.

@ -5,7 +5,6 @@
// TODO:
// * Check filesize limit before trying to send
// * Check IQ replies for type='error'
// * Send link OOB
// * Update Manpages
package main

Loading…
Cancel
Save