use Chat.type in <message/>'s type attr in Send()

Otherwise client.Send(..) cannot be used for MUC 'groupchat' messages.
This might break code, if you're not setting `Chat`'s type slot and rely
on `client.Send` set it to 'chat' by default
This commit is contained in:
Flo Lauber 2013-01-18 19:49:47 -05:00
parent 1e9dc674d1
commit 52c3f1b710

View File

@ -248,13 +248,12 @@ func (c *Client) Recv() (event interface{}, err error) {
// Send sends message text.
func (c *Client) Send(chat Chat) {
fmt.Fprintf(c.tls, "<message to='%s' type='chat' xml:lang='en'>"+
fmt.Fprintf(c.tls, "<message to='%s' type='%s' xml:lang='en'>"+
"<body>%s</body></message>",
xmlEscape(chat.Remote), xmlEscape(chat.Text))
xmlEscape(chat.Remote), xmlEscape(chat.Type), xmlEscape(chat.Text))
}
// RFC 3920 C.1 Streams name space
type streamFeatures struct {
XMLName xml.Name `xml:"http://etherx.jabber.org/streams features"`
StartTLS tlsStartTLS