patch: fix Go builds
Some checks failed
Development / golangci-lint (push) Has been cancelled
Development / test-build-upload (1.22.x, ubuntu-latest) (push) Has been cancelled

This commit is contained in:
2025-11-03 13:19:01 -08:00
parent bab3681ac2
commit 186d28858b
3 changed files with 27 additions and 3 deletions

View File

@@ -1204,6 +1204,8 @@ type Chat struct {
Lang string
ID string
ReplaceID string
ReplyID string
StanzaID string
Roster Roster
Other []string
OtherElem []XMLElement
@@ -1286,6 +1288,8 @@ func (c *Client) Recv() (stanza interface{}, err error) {
Thread: v.Thread,
ID: v.ID,
ReplaceID: v.ReplaceID.ID,
ReplyID: v.ReplyID.ID,
StanzaID: v.StanzaID.ID,
Other: v.OtherStrings(),
OtherElem: v.Other,
Stamp: stamp,
@@ -1488,7 +1492,7 @@ func (c *Client) Recv() (stanza interface{}, err error) {
// Send sends the message wrapped inside an XMPP message stanza body.
func (c *Client) Send(chat Chat) (n int, err error) {
var subtext, thdtext, oobtext, msgidtext, msgcorrecttext string
var subtext, thdtext, oobtext, msgidtext, msgcorrecttext, replytext string
if chat.Subject != `` {
subtext = `<subject>` + xmlEscape(chat.Subject) + `</subject>`
}
@@ -1512,9 +1516,13 @@ func (c *Client) Send(chat Chat) (n int, err error) {
msgcorrecttext = `<replace id='` + xmlEscape(chat.ReplaceID) + `' xmlns='urn:xmpp:message-correct:0'/>`
}
if chat.ReplyID != `` {
replytext = `<reply to='`+ xmlEscape(chat.Remote) + `' id='` + xmlEscape(chat.ReplyID) + `' xmlns='urn:xmpp:reply:0'/>`
}
chat.Text = validUTF8(chat.Text)
stanza := fmt.Sprintf("<message to='%s' type='%s' "+msgidtext+" xml:lang='en'>"+subtext+"<body>%s</body>"+msgcorrecttext+oobtext+thdtext+"</message>",
stanza := fmt.Sprintf("<message to='%s' type='%s' "+msgidtext+" xml:lang='en'>"+subtext+"<body>%s</body>"+msgcorrecttext+replytext+oobtext+thdtext+"</message>",
xmlEscape(chat.Remote), xmlEscape(chat.Type), xmlEscape(chat.Text))
if c.LimitMaxBytes != 0 && len(stanza) > c.LimitMaxBytes {
@@ -1768,6 +1776,18 @@ type clientMessageCorrect struct {
ID string `xml:"id,attr"`
}
type stanzaID struct {
XMLName xml.Name `xml:"urn:xmpp:sid:0 stanza-id"`
ID string `xml:"id,attr"`
By string `xml:"by,attr"`
}
type clientReply struct {
XMLName xml.Name `xml:"urn:xmpp:reply:0 reply"`
ID string `xml:"id,attr"`
To string `xml:"to,attr"`
}
// RFC 3921 B.1 jabber:client
type clientMessage struct {
XMLName xml.Name `xml:"jabber:client message"`
@@ -1782,6 +1802,8 @@ type clientMessage struct {
Body string `xml:"body"`
Thread string `xml:"thread"`
ReplaceID clientMessageCorrect
StanzaID stanzaID
ReplyID clientReply
// Pubsub
Event clientPubsubEvent `xml:"event"`

3
vendor/modules.txt vendored
View File

@@ -216,7 +216,7 @@ github.com/magiconair/properties
github.com/matterbridge/Rocket.Chat.Go.SDK/models
github.com/matterbridge/Rocket.Chat.Go.SDK/realtime
github.com/matterbridge/Rocket.Chat.Go.SDK/rest
# github.com/matterbridge/go-xmpp v0.0.0-20240523230155-7154bfeb76e8
# github.com/matterbridge/go-xmpp v0.0.0-20240523230155-7154bfeb76e8 => /home/irc-discord/uwaru-go-xmpp
## explicit; go 1.21.5
github.com/matterbridge/go-xmpp
# github.com/matterbridge/gomatrix v0.0.0-20220411225302-271e5088ea27
@@ -799,3 +799,4 @@ modernc.org/token
rsc.io/qr
rsc.io/qr/coding
rsc.io/qr/gf256
# github.com/matterbridge/go-xmpp => /home/irc-discord/uwaru-go-xmpp