xmpp.go
changeset 12 122ab6208c3c
parent 11 48be1ae93fd4
child 13 c9527bbe99a6
--- a/xmpp.go	Tue Dec 27 15:36:07 2011 -0700
+++ b/xmpp.go	Tue Dec 27 20:42:44 2011 -0700
@@ -24,6 +24,7 @@
 	nsStream = "http://etherx.jabber.org/streams"
 	nsTLS = "urn:ietf:params:xml:ns:xmpp-tls"
 	nsSASL = "urn:ietf:params:xml:ns:xmpp-sasl"
+	nsBind = "urn:ietf:params:xml:ns:xmpp-bind"
 
 	// DNS SRV names
 	serverSrv = "xmpp-server"
@@ -39,6 +40,9 @@
 	socket net.Conn
 	socketSync sync.WaitGroup
 	saslExpected string
+	authDone bool
+	idMutex sync.Mutex
+	nextId int64
 	In <-chan interface{}
 	Out chan<- interface{}
 	xmlOut chan<- interface{}
@@ -200,3 +204,11 @@
 		}
 	}
 }
+
+func (cl *Client) NextId() string {
+	cl.idMutex.Lock()
+	defer cl.idMutex.Unlock()
+	id := cl.nextId
+	cl.nextId++
+	return fmt.Sprintf("id_%d", id)
+}