go fix. Clearly, I need to run this more often ;)

This commit is contained in:
Matt Goodall 2012-07-18 11:40:05 +01:00
parent 82015bcab4
commit 9ba9dcbe86
9 changed files with 54 additions and 55 deletions

View File

@ -18,7 +18,7 @@ func main() {
// Create stream and configure it as a client connection. // Create stream and configure it as a client connection.
jid := must(xmpp.ParseJID(*jid)).(xmpp.JID) jid := must(xmpp.ParseJID(*jid)).(xmpp.JID)
stream := must(xmpp.NewStream(jid.Domain + ":5222", &xmpp.StreamConfig{LogStanzas: true})).(*xmpp.Stream) stream := must(xmpp.NewStream(jid.Domain+":5222", &xmpp.StreamConfig{LogStanzas: true})).(*xmpp.Stream)
client := must(xmpp.NewClientXMPP(stream, jid, *password, &xmpp.ClientConfig{InsecureSkipVerify: true})).(*xmpp.XMPP) client := must(xmpp.NewClientXMPP(stream, jid, *password, &xmpp.ClientConfig{InsecureSkipVerify: true})).(*xmpp.XMPP)
log.Printf("Connection established for %s\n", client.JID) log.Printf("Connection established for %s\n", client.JID)

View File

@ -146,8 +146,8 @@ type authHandler struct {
} }
var authHandlers = []authHandler{ var authHandlers = []authHandler{
authHandler{"PLAIN", authenticatePlain}, {"PLAIN", authenticatePlain},
} }
func authenticatePlain(stream *Stream, user, password string) error { func authenticatePlain(stream *Stream, user, password string) error {
auth := saslAuth{Mechanism: "PLAIN", Text: saslEncodePlain(user, password)} auth := saslAuth{Mechanism: "PLAIN", Text: saslEncodePlain(user, password)}
@ -270,7 +270,7 @@ type tlsStartTLS struct {
Required *required `xml:"required"` Required *required `xml:"required"`
} }
type required struct {} type required struct{}
type saslFailure struct { type saslFailure struct {
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-sasl failure"` XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-sasl failure"`

View File

@ -15,4 +15,3 @@ func UUID4() string {
uuid[8] = (uuid[8] &^ 0x40) | 0x80 uuid[8] = (uuid[8] &^ 0x40) | 0x80
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:])
} }

View File

@ -100,7 +100,7 @@ func (x *XMPP) AddFilter(m Matcher) (FilterId, chan interface{}) {
// Allocate chan and id. // Allocate chan and id.
ch := make(chan interface{}) ch := make(chan interface{})
id := x.nextFilterId id := x.nextFilterId
x.nextFilterId ++ x.nextFilterId++
// Insert at head of filters list. // Insert at head of filters list.
filters := make([]filter, len(x.filters)+1) filters := make([]filter, len(x.filters)+1)