Check IQ replies for type="result".

http_upload
Martin Dosch 4 years ago
parent 45de883aa2
commit 758cb6a3f2

@ -2,10 +2,6 @@
// Use of this source code is governed by the BSD-2-clause
// license that can be found in the LICENSE file.
// TODO:
// * Check IQ replies for type='error' and type='wait'
// * What to do for 'wait'? We are impatient!
package main
import (
@ -132,6 +128,9 @@ func httpUpload(client *xmpp.Client, jserver string, filePath string) string {
}
iqContent := <-c
close(c)
if iqContent.Type != "result" {
log.Fatal("Error while disco#items query.")
}
err = xml.Unmarshal(iqContent.Query, &iqDiscoItemsXML)
if err != nil {
log.Fatal(err)
@ -149,6 +148,9 @@ func httpUpload(client *xmpp.Client, jserver string, filePath string) string {
}
iqDiscoInfo := <-c
close(c)
if iqDiscoInfo.Type != "result" {
log.Fatal("Error while disco#info query.")
}
err = xml.Unmarshal(iqDiscoInfo.Query, &iqDiscoInfoXML)
if err != nil {
log.Fatal(err)
@ -196,6 +198,9 @@ func httpUpload(client *xmpp.Client, jserver string, filePath string) string {
}
uploadSlot := <-c
close(c)
if uploadSlot.Type != "result" {
log.Fatal("Error while requesting upload slot.")
}
err = xml.Unmarshal(uploadSlot.Query, &iqHttpUploadSlotXML)
if err != nil {
log.Fatal(err)

Loading…
Cancel
Save