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"` XMLName xml.Name `xml:"http://jabber.org/protocol/commands command"`
Node string `xml:"node,attr"` Node string `xml:"node,attr"`
Action string `xml:"action,attr"` Action string `xml:"action,attr"`
SessionId string `xml:"sessionid,attr"` SessionID string `xml:"sessionid,attr"`
Status string `xml:"status,attr"` Status string `xml:"status,attr"`
XForm AdHocXForm `xml:"x"` XForm AdHocXForm `xml:"x"`
Note AdHocNote `xml:"note,omitempty"` Note AdHocNote `xml:"note,omitempty"`

View File

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

View File

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

View File

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

View File

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

View File

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