1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
Description: Fix http-upload
Origin: <upstream>, <https://salsa.debian.org/mdosch/go-sendxmpp/-/commit/8d5b98e2800612cc4bd3a0974d4074c12c2fc547>
Applied-Upstream: <https://salsa.debian.org/mdosch/go-sendxmpp/-/commit/8d5b98e2800612cc4bd3a0974d4074c12c2fc547>
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/httpupload.go
+++ b/httpupload.go
@@ -44,12 +44,23 @@ func httpUpload(client *xmpp.Client, iqc chan xmpp.IQ, disc chan xmpp.DiscoItems
if identity.Type == "file" &&
identity.Category == "store" {
uploadComponent = r.Jid
- break
+ for _, x := range discoResult.X {
+ for i, field := range x.Field {
+ if field.Var == "max-file-size" {
+ if i > 0 {
+ if x.Field[i-1].Value[0] == nsHTTPUpload {
+ maxFileSize, err = strconv.ParseInt(field.Value[0], 10, 64)
+ if err != nil {
+ return urls, fmt.Errorf("http-upload: error while checking server maximum http upload file size")
+ }
+ break
+ }
+ }
+ }
+ }
+ }
}
}
- if uploadComponent != "" {
- break
- }
}
if uploadComponent == "" {
return urls, fmt.Errorf("http-upload: no http upload component found")
--- a/stanzahandling.go
+++ b/stanzahandling.go
@@ -37,9 +37,7 @@ func getDiscoInfo(client *xmpp.Client, drc chan xmpp.DiscoResult, target string)
func getDr(jid string, c chan xmpp.DiscoResult, drc chan xmpp.DiscoResult) {
for {
- println("getDr")
dr := <-drc
- println("got dr")
c <- dr
return
}
@@ -64,10 +62,8 @@ func getDiscoItems(client *xmpp.Client, disc chan xmpp.DiscoItems, target string
func getDis(jid string, c chan xmpp.DiscoItems, disc chan xmpp.DiscoItems) {
for {
- println("getDis")
dis := <-disc
if dis.Jid == jid {
- println("got dis")
c <- dis
return
}
|