diff --git a/src/xmpp/ad-hoc.go b/src/xmpp/ad-hoc.go index bf05109..028bee1 100644 --- a/src/xmpp/ad-hoc.go +++ b/src/xmpp/ad-hoc.go @@ -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"` diff --git a/src/xmpp/disco.go b/src/xmpp/disco.go index cf1bdcf..28f681b 100644 --- a/src/xmpp/disco.go +++ b/src/xmpp/disco.go @@ -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 diff --git a/src/xmpp/softwareVersion.go b/src/xmpp/softwareVersion.go index 4e22cbf..a2fc7d5 100644 --- a/src/xmpp/softwareVersion.go +++ b/src/xmpp/softwareVersion.go @@ -5,7 +5,7 @@ import ( ) const ( - NsJabberClient = "jabber:iq:version" + NSJabberClient = "jabber:iq:version" ) // XEP-0092 Software Version diff --git a/src/xmpp/stanza.go b/src/xmpp/stanza.go index 37f3270..8411b07 100644 --- a/src/xmpp/stanza.go +++ b/src/xmpp/stanza.go @@ -7,10 +7,10 @@ import ( ) const ( - IqTypeGet = "get" - IqTypeSet = "set" - IqTypeResult = "result" - IqTypeError = "error" + IQTypeGet = "get" + IQTypeSet = "set" + IQTypeResult = "result" + IQTypeError = "error" ) // XMPP stanza. diff --git a/src/xmpp/uuid.go b/src/xmpp/uuid.go index 2d8779d..a18e661 100644 --- a/src/xmpp/uuid.go +++ b/src/xmpp/uuid.go @@ -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))] } diff --git a/src/xmpp/vcard.go b/src/xmpp/vcard.go index 06ba65b..0fe9175 100644 --- a/src/xmpp/vcard.go +++ b/src/xmpp/vcard.go @@ -5,7 +5,7 @@ import ( ) const ( - NsVCardTemp = "vcard-temp" + NSVCardTemp = "vcard-temp" ) // XEP-0054 vCard