Move constants in separate file.

code-cleanup
Martin Dosch 2 years ago
parent 5fffba3ef8
commit 9b9fcedf25

@ -0,0 +1,10 @@
// Copyright 2022 Martin Dosch.
// Use of this source code is governed by the BSD-2-clause
// license that can be found in the LICENSE file.
package main
const (
VERSION = "0.4.0-devel"
nsHttpUpload = "urn:xmpp:http:upload:0"
)

@ -97,7 +97,7 @@ func httpUpload(client *xmpp.Client, jserver string, filePath string) string {
}
for _, r := range iqDiscoInfoXML.X {
for i, t := range r.Field {
if t.Var == "max-file-size" && r.Field[i-1].Value == "urn:xmpp:http:upload:0" {
if t.Var == "max-file-size" && r.Field[i-1].Value == nsHttpUpload {
maxFileSize, err = strconv.ParseInt(t.Value, 10, 64)
if err != nil {
log.Fatal("Error while checking server maximum http upload file size.")
@ -117,7 +117,7 @@ func httpUpload(client *xmpp.Client, jserver string, filePath string) string {
}
var request IQHttpUploadSlotRequest
request.Xmlns = "urn:xmpp:http:upload:0"
request.Xmlns = nsHttpUpload
request.FileName = fileNameEscaped
request.FileSize = fileSize
request.FileType = mimeType

@ -20,10 +20,6 @@ import (
"github.com/pborman/getopt/v2" // BSD-3-Clause
)
const (
VERSION = "0.4.0-devel"
)
type configuration struct {
username string
jserver string

Loading…
Cancel
Save