|
|
@ -121,6 +121,8 @@ func httpUpload(client *xmpp.Client, jserver string, filePath string) string {
|
|
|
|
|
|
|
|
|
|
|
|
// Get file name
|
|
|
|
// Get file name
|
|
|
|
fileName := filepath.Base(filePath)
|
|
|
|
fileName := filepath.Base(filePath)
|
|
|
|
|
|
|
|
var fileNameEscaped bytes.Buffer
|
|
|
|
|
|
|
|
xml.Escape(&fileNameEscaped, []byte(fileName))
|
|
|
|
|
|
|
|
|
|
|
|
// Query server for disco#items
|
|
|
|
// Query server for disco#items
|
|
|
|
id := getID()
|
|
|
|
id := getID()
|
|
|
@ -196,7 +198,7 @@ func httpUpload(client *xmpp.Client, jserver string, filePath string) string {
|
|
|
|
go getIQ(client, id, c)
|
|
|
|
go getIQ(client, id, c)
|
|
|
|
_, err = client.RawInformation(client.JID(), uploadComponent, id, "get",
|
|
|
|
_, err = client.RawInformation(client.JID(), uploadComponent, id, "get",
|
|
|
|
"<request xmlns='urn:xmpp:http:upload:0' filename='"+
|
|
|
|
"<request xmlns='urn:xmpp:http:upload:0' filename='"+
|
|
|
|
fileName+"' size='"+strconv.FormatInt(fileSize, 10)+
|
|
|
|
fileNameEscaped.String()+"' size='"+strconv.FormatInt(fileSize, 10)+
|
|
|
|
"' content-type='"+mimeType+"' />")
|
|
|
|
"' content-type='"+mimeType+"' />")
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
log.Fatal(err)
|
|
|
|