xmpp/xmpp.go
changeset 134 80b764fa2f08
parent 132 feaa24de9597
child 135 a4755a42af19
--- a/xmpp/xmpp.go	Sun Sep 08 14:37:56 2013 -0700
+++ b/xmpp/xmpp.go	Sun Sep 08 14:40:35 2013 -0700
@@ -143,6 +143,8 @@
 	cl.handlers = make(chan *stanzaHandler, 100)
 	cl.inputControl = make(chan int)
 	cl.tlsConfig = tlsconf
+	cl.sendFilterAdd = make(chan Filter)
+	cl.recvFilterAdd = make(chan Filter)
 
 	extStanza := make(map[xml.Name]reflect.Type)
 	for _, ext := range exts {
@@ -182,7 +184,12 @@
 	go filterMgr(cl.recvFilterAdd, recvRawXmpp, recvFiltXmpp)
 	sendFiltXmpp := make(chan Stanza)
 	cl.Send = sendFiltXmpp
-	go filterMgr(cl.sendFilterAdd, sendFiltXmpp, sendFiltXmpp)
+	go filterMgr(cl.sendFilterAdd, sendFiltXmpp, sendRawXmpp)
+	// Set up the initial filters.
+	for _, ext := range exts {
+		cl.AddRecvFilter(ext.RecvFilter)
+		cl.AddSendFilter(ext.SendFilter)
+	}
 
 	// Initial handshake.
 	hsOut := &stream{To: jid.Domain, Version: XMPPVersion}