forked from jshiffer/go-xmpp
add first simple version of MUC (xep-0045) support
This commit is contained in:
parent
52c3f1b710
commit
75752790eb
31
xmpp_muc.go
Normal file
31
xmpp_muc.go
Normal file
@ -0,0 +1,31 @@
|
||||
// Copyright 2013 Flo Lauber <dev@qatfy.at>. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// TODO(flo):
|
||||
// - support password protected MUC rooms
|
||||
// - cleanup signatures of join/leave functions
|
||||
package xmpp
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
const (
|
||||
nsMUC = "http://jabber.org/protocol/muc"
|
||||
nsMUCUser = "http://jabber.org/protocol/muc#user"
|
||||
)
|
||||
|
||||
// xep-0045 7.2
|
||||
func (c *Client) JoinMUC(jid string) {
|
||||
fmt.Fprintf(c.tls, "<presence to='%s'>\n"+
|
||||
"<x xmlns='%s' />\n"+
|
||||
"</presence>",
|
||||
xmlEscape(jid), nsMUC)
|
||||
}
|
||||
|
||||
// xep-0045 7.14
|
||||
func (c *Client) LeaveMUC(jid string) {
|
||||
fmt.Fprintf(c.tls, "<presence from='%s' to='%s' type='unavailable' />",
|
||||
c.jid, xmlEscape(jid))
|
||||
}
|
Loading…
Reference in New Issue
Block a user