forked from jshiffer/go-xmpp
Add ability to join password protected chat rooms
This commit is contained in:
parent
846b8175da
commit
7568e71728
13
xmpp_muc.go
13
xmpp_muc.go
@ -27,6 +27,19 @@ func (c *Client) JoinMUC(jid, nick string) {
|
|||||||
xmlEscape(jid), xmlEscape(nick), nsMUC)
|
xmlEscape(jid), xmlEscape(nick), nsMUC)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// xep-0045 7.2.6
|
||||||
|
func (c *Client) JoinProtectedMUC(jid, nick string, password string) {
|
||||||
|
if nick == "" {
|
||||||
|
nick = c.jid
|
||||||
|
}
|
||||||
|
fmt.Fprintf(c.conn, "<presence to='%s/%s'>\n"+
|
||||||
|
"<x xmlns='%s'>\n"+
|
||||||
|
"<password>%s</password>\n"+
|
||||||
|
"</x>\n"+
|
||||||
|
"</presence>",
|
||||||
|
xmlEscape(jid), xmlEscape(nick), nsMUC, xmlEscape(password))
|
||||||
|
}
|
||||||
|
|
||||||
// xep-0045 7.14
|
// xep-0045 7.14
|
||||||
func (c *Client) LeaveMUC(jid string) {
|
func (c *Client) LeaveMUC(jid string) {
|
||||||
fmt.Fprintf(c.conn, "<presence from='%s' to='%s' type='unavailable' />",
|
fmt.Fprintf(c.conn, "<presence from='%s' to='%s' type='unavailable' />",
|
||||||
|
Loading…
Reference in New Issue
Block a user