1
0
Fork 0
This commit is contained in:
Chteufleur 2016-05-18 19:13:27 +02:00
parent 8f21af2b45
commit 23e93d518b
6 changed files with 18 additions and 16 deletions

View File

@ -36,7 +36,7 @@ type AdHocCommand struct {
XMLName xml.Name `xml:"http://jabber.org/protocol/commands command"`
Node string `xml:"node,attr"`
Action string `xml:"action,attr"`
SessionId string `xml:"sessionid,attr"`
SessionID string `xml:"sessionid,attr"`
Status string `xml:"status,attr"`
XForm AdHocXForm `xml:"x"`
Note AdHocNote `xml:"note,omitempty"`

View File

@ -6,8 +6,8 @@ import (
)
const (
NsDiscoInfo = "http://jabber.org/protocol/disco#info"
NsDiscoItems = "http://jabber.org/protocol/disco#items"
NSDiscoInfo = "http://jabber.org/protocol/disco#info"
NSDiscoItems = "http://jabber.org/protocol/disco#items"
)
// Service Discovery (XEP-0030) protocol. "Wraps" XMPP instance to provide a

View File

@ -5,7 +5,7 @@ import (
)
const (
NsJabberClient = "jabber:iq:version"
NSJabberClient = "jabber:iq:version"
)
// XEP-0092 Software Version

View File

@ -7,10 +7,10 @@ import (
)
const (
IqTypeGet = "get"
IqTypeSet = "set"
IqTypeResult = "result"
IqTypeError = "error"
IQTypeGet = "get"
IQTypeSet = "set"
IQTypeResult = "result"
IQTypeError = "error"
)
// XMPP <iq/> stanza.

View File

@ -5,6 +5,10 @@ import (
"fmt"
)
const (
dictionary = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
)
// Generate a UUID4.
func UUID4() string {
uuid := make([]byte, 16)
@ -16,13 +20,11 @@ func UUID4() string {
return fmt.Sprintf("%x-%x-%x-%x-%x", uuid[:4], uuid[4:6], uuid[6:8], uuid[8:10], uuid[10:])
}
func SessionId() string {
var strSize = 15
var dictionary string
dictionary = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
var bytes = make([]byte, strSize)
rand.Read(bytes)
func SessionID() string {
var bytes = make([]byte, 15)
if _, err := rand.Read(bytes); err != nil {
panic(err)
}
for k, v := range bytes {
bytes[k] = dictionary[v%byte(len(dictionary))]
}

View File

@ -5,7 +5,7 @@ import (
)
const (
NsVCardTemp = "vcard-temp"
NSVCardTemp = "vcard-temp"
)
// XEP-0054 vCard