Use single quotes for stanzas created by beevik/etree.

Squashed commit of the following:

commit 8e33952869831f620fa289f1bc997128a40eaee3
Author: Martin Dosch <martin@mdosch.de>
Date:   Tue May 9 21:22:40 2023 +0200

    Clean go.mod

commit 11bb88fca2d4bb76557e912f46f726e675e0b0cb
Merge: 8d45413 b01ed4b
Author: Martin Dosch <martin@mdosch.de>
Date:   Tue May 9 21:21:48 2023 +0200

    Merge branch 'master' into singlequotes

commit 8d45413f05
Author: Martin Dosch <martin@mdosch.de>
Date:   Tue May 2 09:39:54 2023 +0200

    Add more singlequotes. :)

commit c496e2596a
Author: Martin Dosch <martin@mdosch.de>
Date:   Tue May 2 09:35:12 2023 +0200

    Use single quotes.

commit e4556759d8
Author: Martin Dosch <martin@mdosch.de>
Date:   Tue May 2 07:25:09 2023 +0200

    Use single quotes for XML attributes.
errwrp
Martin Dosch 1 year ago
parent b01ed4b5a8
commit e381942708
No known key found for this signature in database
GPG Key ID: 52A57CFCE13D657D

@ -8,6 +8,7 @@
- Print `--help` output to stdout instead of stderr.
- Print sent stanzas when `--debug` is used (via go-xmpp commit 9129a110df1b).
- Allow JIDs without localpart.
- Use single quotes for attributes in stanzas created by github.com/beevik/etree.
- Fix SRV lookup when the domain has a CNAME (via xmppsrv v0.2.5).
## [v0.5.6] 2022-11-11

@ -74,6 +74,7 @@ func httpUpload(client *xmpp.Client, iqc chan xmpp.IQ,
for _, r := range iqDiscoItemsXMLItems {
jid := r.SelectAttr("jid")
iqDiscoInfoReqXML := etree.NewDocument()
iqDiscoInfoReqXML.WriteSettings.AttrSingleQuote = true
iqDiscoInfoReqXMLQuery := iqDiscoInfoReqXML.CreateElement("query")
iqDiscoInfoReqXMLQuery.CreateAttr("xmlns", nsDiscoInfo)
iqdi, err := iqDiscoInfoReqXML.WriteToString()
@ -153,6 +154,7 @@ func httpUpload(client *xmpp.Client, iqc chan xmpp.IQ,
}
request := etree.NewDocument()
request.WriteSettings.AttrSingleQuote = true
requestReq := request.CreateElement("request")
requestReq.CreateAttr("xmlns", nsHTTPUpload)
requestReq.CreateAttr("filename", fileNameEscaped)

@ -21,6 +21,7 @@ import (
func oxDeleteNodes(jid string, client *xmpp.Client,
iqc chan xmpp.IQ) error {
nodeListRequest := etree.NewDocument()
nodeListRequest.WriteSettings.AttrSingleQuote = true
query := nodeListRequest.CreateElement("query")
query.CreateAttr("xmlns", nsDiscoItems)
nlr, err := nodeListRequest.WriteToString()
@ -53,6 +54,7 @@ func oxDeleteNodes(jid string, client *xmpp.Client,
continue
}
deleteNodeRequest := etree.NewDocument()
deleteNodeRequest.WriteSettings.AttrSingleQuote = true
pubsub := deleteNodeRequest.CreateElement("pubsub")
pubsub.CreateAttr("xmlns", nsPubsubOwner)
delete := pubsub.CreateElement("delete")
@ -231,6 +233,7 @@ func oxPublishPubKey(jid string, client *xmpp.Client, iqc chan xmpp.IQ,
}
pubKeyBase64 := base64.StdEncoding.EncodeToString(keySerialized)
root := etree.NewDocument()
root.WriteSettings.AttrSingleQuote = true
pubsub := root.CreateElement("pubsub")
pubsub.CreateAttr("xmlns", nsPubsub)
publish := pubsub.CreateElement("publish")
@ -278,6 +281,7 @@ func oxPublishPubKey(jid string, client *xmpp.Client, iqc chan xmpp.IQ,
return errors.New("couldn't successfully verify public key upload")
}
root = etree.NewDocument()
root.WriteSettings.AttrSingleQuote = true
pubsub = root.CreateElement("pubsub")
pubsub.CreateAttr("xmlns", nsPubsub)
publish = pubsub.CreateElement("publish")
@ -481,6 +485,7 @@ func oxGenPrivKey(jid string, client *xmpp.Client, iqc chan xmpp.IQ,
func oxRecvPublicKeys(client *xmpp.Client, iqc chan xmpp.IQ, recipient string,
fingerprint string) (*crypto.KeyRing, error) {
opkr := etree.NewDocument()
opkr.WriteSettings.AttrSingleQuote = true
opkrPs := opkr.CreateElement("pubsub")
opkrPs.CreateAttr("xmlns", nsPubsub)
opkrPsItems := opkrPs.CreateElement("items")
@ -555,6 +560,7 @@ func oxGetPublicKeyRing(client *xmpp.Client, iqc chan xmpp.IQ,
}
oxPubKeyListReq := etree.NewDocument()
oxPubKeyListReq.WriteSettings.AttrSingleQuote = true
oxPubKeyListReqPs := oxPubKeyListReq.CreateElement("pubsub")
oxPubKeyListReqPs.CreateAttr("xmlns", nsPubsub)
oxPubKeyListReqPsItems := oxPubKeyListReqPs.CreateElement("items")
@ -708,6 +714,7 @@ func oxEncrypt(client *xmpp.Client, iqc chan xmpp.IQ, oxPrivKey *crypto.Key,
}
}
oxCryptMessage := etree.NewDocument()
oxCryptMessage.WriteSettings.AttrSingleQuote = true
oxCryptMessageSc := oxCryptMessage.CreateElement("signcrypt")
oxCryptMessageSc.CreateAttr("xmlns", nsOx)
oxCryptMessageScTo := oxCryptMessageSc.CreateElement("to")
@ -730,6 +737,7 @@ func oxEncrypt(client *xmpp.Client, iqc chan xmpp.IQ, oxPrivKey *crypto.Key,
return "error", err
}
om := etree.NewDocument()
om.WriteSettings.AttrSingleQuote = true
omMessage := om.CreateElement("message")
omMessage.CreateAttr("to", recipient)
omMessage.CreateAttr("id", getID())

@ -63,6 +63,7 @@ func rcvStanzas(client *xmpp.Client, iqc chan xmpp.IQ, msgc chan xmpp.Chat) {
switch xmlns.Value {
case nsDiscoInfo:
root := etree.NewDocument()
root.WriteSettings.AttrSingleQuote = true
reply := root.CreateElement("iq")
reply.CreateAttr("type", "result")
reply.CreateAttr("from", client.JID())
@ -85,6 +86,7 @@ func rcvStanzas(client *xmpp.Client, iqc chan xmpp.IQ, msgc chan xmpp.Chat) {
}
default:
root := etree.NewDocument()
root.WriteSettings.AttrSingleQuote = true
reply := root.CreateElement("iq")
reply.CreateAttr("type", "error")
reply.CreateAttr("from", client.JID())
@ -104,6 +106,7 @@ func rcvStanzas(client *xmpp.Client, iqc chan xmpp.IQ, msgc chan xmpp.Chat) {
}
case "set":
root := etree.NewDocument()
root.WriteSettings.AttrSingleQuote = true
reply := root.CreateElement("iq")
reply.CreateAttr("type", "error")
reply.CreateAttr("from", client.JID())

Loading…
Cancel
Save