From 4df4e9cec28ecb9bf31ebf192dba91276a4c9aa4 Mon Sep 17 00:00:00 2001 From: Chteufleur Date: Sun, 13 Nov 2016 20:25:47 +0100 Subject: [PATCH] Add support for multi body in message with lang definition. --- src/xmpp/stanza.go | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/xmpp/stanza.go b/src/xmpp/stanza.go index 93431b7..b26f3f3 100644 --- a/src/xmpp/stanza.go +++ b/src/xmpp/stanza.go @@ -67,15 +67,16 @@ func (iq *Iq) Response(type_ string) *Iq { // XMPP stanza. type Message struct { - XMLName xml.Name `xml:"message"` - Id string `xml:"id,attr,omitempty"` - Type string `xml:"type,attr,omitempty"` - To string `xml:"to,attr,omitempty"` - From string `xml:"from,attr,omitempty"` - Subject string `xml:"subject,omitempty"` - Body string `xml:"body,omitempty"` - Thread string `xml:"thread,omitempty"` - Error *Error `xml:"error"` + XMLName xml.Name `xml:"message"` + Id string `xml:"id,attr,omitempty"` + Type string `xml:"type,attr,omitempty"` + To string `xml:"to,attr,omitempty"` + From string `xml:"from,attr,omitempty"` + Subject string `xml:"subject,omitempty"` + Body []MessageBody `xml:"body,omitempty"` + Thread string `xml:"thread,omitempty"` + Error *Error `xml:"error"` + Lang string `xml:"xml:lang,attr,omitempty"` Confir *Confirm `xml:"confirm"` // XEP-0070 @@ -86,6 +87,11 @@ type Message struct { Gone *Gone `xml:"gone"` // XEP-0085 } +type MessageBody struct { + Lang string `xml:"xml:lang,attr,omitempty"` + Value string `xml:",innerxml"` +} + // XMPP stanza. type Presence struct { XMLName xml.Name `xml:"presence"`