sum7
/
yaja
Archived
1
0
Fork 0

[WIP] Library XEP-0045 Multi-User Chat (Base for History + Password)

This commit is contained in:
Martin/Geno 2018-09-06 13:30:42 +02:00
parent d8c6f942bf
commit 0ad62245e8
No known key found for this signature in database
GPG Key ID: 9D7D3C6BFF600C6A
5 changed files with 51 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import (
"encoding/xml"
"dev.sum7.eu/genofire/yaja/xmpp/base"
"dev.sum7.eu/genofire/yaja/xmpp/x/muc"
)
// PresenceClient implements RFC 6120 - A.5 Client Namespace (a part)
@ -21,6 +22,8 @@ type PresenceClient struct {
Error *ErrorClient
MUC *xmuc.Base // XEP-0045: Multi-User Chat (see x/muc/base.go)
Delay *Delay `xml:"delay"` // which XEP ?
// which XEP ?

21
xmpp/x/muc/base.go Normal file
View File

@ -0,0 +1,21 @@
package xmuc
import (
"encoding/xml"
"time"
)
// Base implements XEP-0045: Multi-User Chat - 19.1
type Base struct {
XMLName xml.Name `xml:"http://jabber.org/protocol/muc x"`
History *History `xml:"history,omitempty"`
Password string `xml:"password,omitempty"`
}
// History implements XEP-0045: Multi-User Chat - 19.1
type History struct {
MaxChars *int `xml:"maxchars,attr,omitempty"`
MaxStanzas *int `xml:"maxstanzas,attr,omitempty"`
Seconds *int `xml:"seconds,attr,omitempty"`
Since *time.Time `xml:"since,attr,omitempty"`
}

15
xmpp/x/muc/namespaces.go Normal file
View File

@ -0,0 +1,15 @@
package xmuc
const (
// NSMUC implements XEP-0045: Multi-User Chat - 19.1 muc
NSMUC = "http://jabber.org/protocol/muc"
// NSMUCUser implements XEP-0045: Multi-User Chat - 19.2 muc#user
NSMUCUser = "http://jabber.org/protocol/muc#user"
// NSMUCAdmin implements XEP-0045: Multi-User Chat - 19.3 muc#admin
NSMUCAdmin = "http://jabber.org/protocol/muc#admin"
// NSMUCOwner implements XEP-0045: Multi-User Chat - 19.4 muc#owner
NSMUCOwner = "http://jabber.org/protocol/muc#user"
)

7
xmpp/x/muc/test.go Normal file
View File

@ -0,0 +1,7 @@
package xmuc
// just to validate, there is no functions in here
func init() {
a := 1
a++
}

5
xmpp/x/muc/test_test.go Normal file
View File

@ -0,0 +1,5 @@
package xmuc
import "testing"
func Test(t *testing.T) {}