mirror of
https://dev.narayana.im/narayana/telegabber.git
synced 2026-08-05 12:17:06 +00:00
Reject reserved MUC creation
This commit is contained in:
parent
174037e63f
commit
cef56ca484
2 changed files with 36 additions and 0 deletions
|
|
@ -324,6 +324,12 @@ type QueryMucAdminItem struct {
|
||||||
Reason string `xml:"reason,omitempty"`
|
Reason string `xml:"reason,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// QueryMucOwner is from XEP-0045
|
||||||
|
type QueryMucOwner struct {
|
||||||
|
XMLName xml.Name `xml:"http://jabber.org/protocol/muc#owner query"`
|
||||||
|
ResultSet *stanza.ResultSet `xml:"set,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
// Namespace is a namespace!
|
// Namespace is a namespace!
|
||||||
func (c PresenceNickExtension) Namespace() string {
|
func (c PresenceNickExtension) Namespace() string {
|
||||||
return c.XMLName.Space
|
return c.XMLName.Space
|
||||||
|
|
@ -419,6 +425,16 @@ func (c QueryMucAdmin) GetSet() *stanza.ResultSet {
|
||||||
return c.ResultSet
|
return c.ResultSet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Namespace is a namespace!
|
||||||
|
func (c QueryMucOwner) Namespace() string {
|
||||||
|
return c.XMLName.Space
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSet getsets!
|
||||||
|
func (c QueryMucOwner) GetSet() *stanza.ResultSet {
|
||||||
|
return c.ResultSet
|
||||||
|
}
|
||||||
|
|
||||||
// NewReplyFallback initializes a fallback range
|
// NewReplyFallback initializes a fallback range
|
||||||
func NewReplyFallback(start uint64, end uint64) Fallback {
|
func NewReplyFallback(start uint64, end uint64) Fallback {
|
||||||
return Fallback{
|
return Fallback{
|
||||||
|
|
@ -546,4 +562,10 @@ func init() {
|
||||||
"http://jabber.org/protocol/muc#admin",
|
"http://jabber.org/protocol/muc#admin",
|
||||||
"query",
|
"query",
|
||||||
}, QueryMucAdmin{})
|
}, QueryMucAdmin{})
|
||||||
|
|
||||||
|
// muc owner query
|
||||||
|
stanza.TypeRegistry.MapExtension(stanza.PKTIQ, xml.Name{
|
||||||
|
"http://jabber.org/protocol/muc#owner",
|
||||||
|
"query",
|
||||||
|
}, QueryMucOwner{})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,11 @@ func HandleIq(s xmpp.Sender, p stanza.Packet) {
|
||||||
go handleGetQueryMucAdmin(s, iq, queryMucAdmin)
|
go handleGetQueryMucAdmin(s, iq, queryMucAdmin)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
_, ok = iq.Payload.(*extensions.QueryMucOwner)
|
||||||
|
if ok {
|
||||||
|
go handleGetQueryMucOwner(s, iq)
|
||||||
|
return
|
||||||
|
}
|
||||||
} else if iq.Type == stanza.IQTypeSet {
|
} else if iq.Type == stanza.IQTypeSet {
|
||||||
queryRegister, ok := iq.Payload.(*extensions.QueryRegister)
|
queryRegister, ok := iq.Payload.(*extensions.QueryRegister)
|
||||||
if ok {
|
if ok {
|
||||||
|
|
@ -1231,6 +1236,15 @@ func handleGetQueryMucAdmin(s xmpp.Sender, iq *stanza.IQ, query *extensions.Quer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func handleGetQueryMucOwner(s xmpp.Sender, iq *stanza.IQ) {
|
||||||
|
component, answer, ok := iqResultStub(s, iq)
|
||||||
|
if !ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
iqAnswerSetError(answer, 405)
|
||||||
|
gateway.ResumableSend(component, answer)
|
||||||
|
}
|
||||||
|
|
||||||
func handleSetQueryRegister(s xmpp.Sender, iq *stanza.IQ, query *extensions.QueryRegister) {
|
func handleSetQueryRegister(s xmpp.Sender, iq *stanza.IQ, query *extensions.QueryRegister) {
|
||||||
component, answer, ok := iqResultStub(s, iq)
|
component, answer, ok := iqResultStub(s, iq)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue