Nickname can be specified when joining MUC

Client.JoinMUC now accept second argument as nickname.
This commit is contained in:
Stanislav Seletskiy 2014-11-26 18:34:13 +06:00
parent 15ac96c029
commit 477ccf01f6

View File

@ -17,11 +17,14 @@ const (
)
// xep-0045 7.2
func (c *Client) JoinMUC(jid string) {
fmt.Fprintf(c.conn, "<presence to='%s'>\n"+
func (c *Client) JoinMUC(jid, nick string) {
if nick == "" {
nick = c.jid
}
fmt.Fprintf(c.conn, "<presence to='%s/%s'>\n"+
"<x xmlns='%s' />\n"+
"</presence>",
xmlEscape(jid), nsMUC)
xmlEscape(jid), xmlEscape(nick), nsMUC)
}
// xep-0045 7.14