From 4fdbee9ac5c8a298d7f33ebbf635dc3aa9e82623 Mon Sep 17 00:00:00 2001 From: Richard Phillips Date: Fri, 4 May 2018 12:20:46 +0100 Subject: [PATCH] Add 'id' to outgoing message using cnonce --- xmpp.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/xmpp.go b/xmpp.go index d10623f..8a00282 100644 --- a/xmpp.go +++ b/xmpp.go @@ -660,8 +660,11 @@ func (c *Client) Send(chat Chat) (n int, err error) { if chat.Thread != `` { thdtext = `` + xmlEscape(chat.Thread) + `` } - return fmt.Fprintf(c.conn, ""+subtext+"%s"+thdtext+"", - xmlEscape(chat.Remote), xmlEscape(chat.Type), xmlEscape(chat.Text)) + + stanza := "" + subtext + "%s" + thdtext + "" + + return fmt.Fprintf(c.conn, stanza, + xmlEscape(chat.Remote), xmlEscape(chat.Type), cnonce(), xmlEscape(chat.Text)) } // SendOrg sends the original text without being wrapped in an XMPP message stanza. @@ -756,7 +759,7 @@ type saslFailure struct { type bindBind struct { XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-bind bind"` Resource string - Jid string `xml:"jid"` + Jid string `xml:"jid"` } // RFC 3921 B.1 jabber:client @@ -836,7 +839,8 @@ type clientPresence struct { Error *clientError } -type clientIQ struct { // info/query +type clientIQ struct { + // info/query XMLName xml.Name `xml:"jabber:client iq"` From string `xml:"from,attr"` ID string `xml:"id,attr"`