diff --git a/go.mod b/go.mod index 39539ae5..838450bc 100644 --- a/go.mod +++ b/go.mod @@ -149,5 +149,6 @@ require ( ) //replace github.com/matrix-org/gomatrix => github.com/matterbridge/gomatrix v0.0.0-20220205235239-607eb9ee6419 +replace github.com/matterbridge/go-xmpp => "/home/irc-discord/uwaru-go-xmpp" go 1.22.0 diff --git a/vendor/github.com/matterbridge/go-xmpp/xmpp.go b/vendor/github.com/matterbridge/go-xmpp/xmpp.go index 6f9e87a6..4386245b 100644 --- a/vendor/github.com/matterbridge/go-xmpp/xmpp.go +++ b/vendor/github.com/matterbridge/go-xmpp/xmpp.go @@ -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 = `` + xmlEscape(chat.Subject) + `` } @@ -1512,9 +1516,13 @@ func (c *Client) Send(chat Chat) (n int, err error) { msgcorrecttext = `` } + if chat.ReplyID != `` { + replytext = `` + } + chat.Text = validUTF8(chat.Text) - stanza := fmt.Sprintf(""+subtext+"%s"+msgcorrecttext+oobtext+thdtext+"", + stanza := fmt.Sprintf(""+subtext+"%s"+msgcorrecttext+replytext+oobtext+thdtext+"", 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"` diff --git a/vendor/modules.txt b/vendor/modules.txt index 93aad2ac..84692d28 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -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