|
|
@ -3,7 +3,6 @@
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
|
|
|
|
// TODO:
|
|
|
|
// TODO:
|
|
|
|
// * Check filesize limit before trying to send
|
|
|
|
|
|
|
|
// * Check IQ replies for type='error'
|
|
|
|
// * Check IQ replies for type='error'
|
|
|
|
// * Update Manpages
|
|
|
|
// * Update Manpages
|
|
|
|
|
|
|
|
|
|
|
@ -163,6 +162,15 @@ func httpUpload(client *xmpp.Client, jserver string, filePath string) string {
|
|
|
|
if uploadComponent == "" {
|
|
|
|
if uploadComponent == "" {
|
|
|
|
log.Fatal("No http upload component found.")
|
|
|
|
log.Fatal("No http upload component found.")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
maxFileSize, err := strconv.ParseInt(iqDiscoInfoXML.X[1].Field[1].Value, 10, 64)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
log.Fatal("Error while checking server maximum http upload file size.")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if fileSize > maxFileSize {
|
|
|
|
|
|
|
|
log.Fatal("File size " + strconv.FormatInt(fileSize/1024/1024, 10) +
|
|
|
|
|
|
|
|
" MB is larger than the maximum file size allowed (" +
|
|
|
|
|
|
|
|
strconv.FormatInt(maxFileSize/1024/1024, 10) + " MB).")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Request http upload slot
|
|
|
|
// Request http upload slot
|
|
|
|
id = getID()
|
|
|
|
id = getID()
|
|
|
|