summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/matterbridge
diff options
context:
space:
mode:
authorWim <wim@42.be>2018-05-29 23:28:13 +0200
committerWim <wim@42.be>2018-05-29 23:28:19 +0200
commitfd04e08c9c99d5bc2e819c4679ff419aea8a3b71 (patch)
tree30ac6bd77286dec9b9f7294f26ad93160182e1a6 /vendor/github.com/matterbridge
parent6576409d60bdf24fcac8299cad78043ecac261b5 (diff)
downloadmatterbridge-msglm-fd04e08c9c99d5bc2e819c4679ff419aea8a3b71.tar.gz
matterbridge-msglm-fd04e08c9c99d5bc2e819c4679ff419aea8a3b71.tar.bz2
matterbridge-msglm-fd04e08c9c99d5bc2e819c4679ff419aea8a3b71.zip
Update vendor matterbridge/go-xmpp
Diffstat (limited to 'vendor/github.com/matterbridge')
-rw-r--r--vendor/github.com/matterbridge/go-xmpp/xmpp.go20
1 files changed, 19 insertions, 1 deletions
diff --git a/vendor/github.com/matterbridge/go-xmpp/xmpp.go b/vendor/github.com/matterbridge/go-xmpp/xmpp.go
index 253b7613..39aa2d8c 100644
--- a/vendor/github.com/matterbridge/go-xmpp/xmpp.go
+++ b/vendor/github.com/matterbridge/go-xmpp/xmpp.go
@@ -575,6 +575,8 @@ type Chat struct {
Thread string
Ooburl string
Oobdesc string
+ ID string
+ ReplaceID string
Roster Roster
Other []string
OtherElem []XMLElement
@@ -626,6 +628,8 @@ func (c *Client) Recv() (stanza interface{}, err error) {
Text: v.Body,
Subject: v.Subject,
Thread: v.Thread,
+ ID: v.ID,
+ ReplaceID: v.ReplaceID.ID,
Other: v.OtherStrings(),
OtherElem: v.Other,
Stamp: stamp,
@@ -657,6 +661,8 @@ func (c *Client) Send(chat Chat) (n int, err error) {
var subtext = ``
var thdtext = ``
var oobtext = ``
+ var msgidtext = ``
+ var msgcorrecttext = ``
if chat.Subject != `` {
subtext = `<subject>` + xmlEscape(chat.Subject) + `</subject>`
}
@@ -670,7 +676,13 @@ func (c *Client) Send(chat Chat) (n int, err error) {
}
oobtext += `</x>`
}
- return fmt.Fprintf(c.conn, "<message to='%s' type='%s' xml:lang='en'>" + subtext + "<body>%s</body>" + oobtext + thdtext + "</message>",
+ if chat.ID != `` {
+ msgidtext = `id='` + xmlEscape(chat.ID) + `'`
+ }
+ if chat.ReplaceID != `` {
+ msgcorrecttext = `<replace id='` + xmlEscape(chat.ReplaceID) + `' xmlns='urn:xmpp:message-correct:0'/>`
+ }
+ return fmt.Fprintf(c.conn, "<message to='%s' type='%s' " + msgidtext + " xml:lang='en'>" + subtext + "<body>%s</body>" + msgcorrecttext + oobtext + thdtext + "</message>",
xmlEscape(chat.Remote), xmlEscape(chat.Type), xmlEscape(chat.Text))
}
@@ -787,6 +799,11 @@ type bindBind struct {
Jid string `xml:"jid"`
}
+type clientMessageCorrect struct {
+ XMLName xml.Name `xml:"urn:xmpp:message-correct:0 replace"`
+ ID string `xml:"id,attr"`
+}
+
// RFC 3921 B.1 jabber:client
type clientMessage struct {
XMLName xml.Name `xml:"jabber:client message"`
@@ -799,6 +816,7 @@ type clientMessage struct {
Subject string `xml:"subject"`
Body string `xml:"body"`
Thread string `xml:"thread"`
+ ReplaceID clientMessageCorrect
// Any hasn't matched element
Other []XMLElement `xml:",any"`