Fixed some logic errors and initialized some things that needed to be initialized.
authorChris Jones <christian.jones@sri.com>
Sun, 08 Sep 2013 14:40:35 -0700
changeset 134 80b764fa2f08
parent 133 c4e0b897db83
child 135 a4755a42af19
Fixed some logic errors and initialized some things that needed to be initialized.
xmpp/roster.go
xmpp/xmpp.go
--- a/xmpp/roster.go	Sun Sep 08 14:37:56 2013 -0700
+++ b/xmpp/roster.go	Sun Sep 08 14:40:35 2013 -0700
@@ -59,6 +59,9 @@
 				f()
 			}
 			iq, ok := stan.(*Iq)
+			if !ok {
+				continue
+			}
 			if iq.Type != "set" {
 				continue
 			}
--- 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}