5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-09 15:40:27 +00:00

Update vendor matterbridge/go-xmpp

This commit is contained in:
Wim 2018-05-09 22:38:17 +02:00
parent 8c675b52bc
commit 8d307d8134
2 changed files with 30 additions and 2 deletions

View File

@ -573,6 +573,8 @@ type Chat struct {
Text string
Subject string
Thread string
Ooburl string
Oobdesc string
Roster Roster
Other []string
OtherElem []XMLElement
@ -654,16 +656,42 @@ func (c *Client) Recv() (stanza interface{}, err error) {
func (c *Client) Send(chat Chat) (n int, err error) {
var subtext = ``
var thdtext = ``
var oobtext = ``
if chat.Subject != `` {
subtext = `<subject>` + xmlEscape(chat.Subject) + `</subject>`
}
if chat.Thread != `` {
thdtext = `<thread>` + xmlEscape(chat.Thread) + `</thread>`
}
return fmt.Fprintf(c.conn, "<message to='%s' type='%s' xml:lang='en'>"+subtext+"<body>%s</body>"+thdtext+"</message>",
if chat.Ooburl != `` {
oobtext = `<x xmlns="jabber:x:oob"><url>` + xmlEscape(chat.Ooburl) + `</url>`
if chat.Oobdesc != `` {
oobtext += `<desc>` + xmlEscape(chat.Oobdesc) + `</desc>`
}
oobtext += `</x>`
}
return fmt.Fprintf(c.conn, "<message to='%s' type='%s' xml:lang='en'>" + subtext + "<body>%s</body>" + oobtext + thdtext + "</message>",
xmlEscape(chat.Remote), xmlEscape(chat.Type), xmlEscape(chat.Text))
}
// SendOOB sends OOB data wrapped inside an XMPP message stanza, without actual body.
func (c *Client) SendOOB(chat Chat) (n int, err error) {
var thdtext = ``
var oobtext = ``
if chat.Thread != `` {
thdtext = `<thread>` + xmlEscape(chat.Thread) + `</thread>`
}
if chat.Ooburl != `` {
oobtext = `<x xmlns="jabber:x:oob"><url>` + xmlEscape(chat.Ooburl) + `</url>`
if chat.Oobdesc != `` {
oobtext += `<desc>` + xmlEscape(chat.Oobdesc) + `</desc>`
}
oobtext += `</x>`
}
return fmt.Fprintf(c.conn, "<message to='%s' type='%s' xml:lang='en'>" + oobtext + thdtext + "</message>",
xmlEscape(chat.Remote), xmlEscape(chat.Type))
}
// SendOrg sends the original text without being wrapped in an XMPP message stanza.
func (c *Client) SendOrg(org string) (n int, err error) {
return fmt.Fprint(c.conn, org)

2
vendor/manifest vendored
View File

@ -393,7 +393,7 @@
"importpath": "github.com/matterbridge/go-xmpp",
"repository": "https://github.com/matterbridge/go-xmpp",
"vcs": "git",
"revision": "0aa93db586ce719b8793aace600ddea0fdc7e828",
"revision": "3cceb718219057817b66c4bb55673f5f417c0bff",
"branch": "work",
"notests": true
},