From 8d307d8134a528d8e4a8f44ad98fccfd288acc42 Mon Sep 17 00:00:00 2001 From: Wim Date: Wed, 9 May 2018 22:38:17 +0200 Subject: [PATCH] Update vendor matterbridge/go-xmpp --- .../github.com/matterbridge/go-xmpp/xmpp.go | 30 ++++++++++++++++++- vendor/manifest | 2 +- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/vendor/github.com/matterbridge/go-xmpp/xmpp.go b/vendor/github.com/matterbridge/go-xmpp/xmpp.go index d3f31367..253b7613 100644 --- a/vendor/github.com/matterbridge/go-xmpp/xmpp.go +++ b/vendor/github.com/matterbridge/go-xmpp/xmpp.go @@ -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 = `` + xmlEscape(chat.Subject) + `` } if chat.Thread != `` { thdtext = `` + xmlEscape(chat.Thread) + `` } - return fmt.Fprintf(c.conn, ""+subtext+"%s"+thdtext+"", + if chat.Ooburl != `` { + oobtext = `` + xmlEscape(chat.Ooburl) + `` + if chat.Oobdesc != `` { + oobtext += `` + xmlEscape(chat.Oobdesc) + `` + } + oobtext += `` + } + return fmt.Fprintf(c.conn, "" + subtext + "%s" + oobtext + thdtext + "", 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 = `` + xmlEscape(chat.Thread) + `` + } + if chat.Ooburl != `` { + oobtext = `` + xmlEscape(chat.Ooburl) + `` + if chat.Oobdesc != `` { + oobtext += `` + xmlEscape(chat.Oobdesc) + `` + } + oobtext += `` + } + return fmt.Fprintf(c.conn, "" + oobtext + thdtext + "", + 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) diff --git a/vendor/manifest b/vendor/manifest index 1d01e5b2..ac22b38f 100644 --- a/vendor/manifest +++ b/vendor/manifest @@ -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 },