xmpp.go
changeset 46 4a4530b8f622
parent 45 abf958bcc201
child 48 6b402eb552f5
equal deleted inserted replaced
45:abf958bcc201 46:4a4530b8f622
   144 	clOut := cl.startStreamWriter(cl.xmlOut)
   144 	clOut := cl.startStreamWriter(cl.xmlOut)
   145 
   145 
   146 	// Start the manager for the filters that can modify what the
   146 	// Start the manager for the filters that can modify what the
   147 	// app sees.
   147 	// app sees.
   148 	clIn := cl.startFilter(stIn)
   148 	clIn := cl.startFilter(stIn)
       
   149 	cl.startRosterFilter()
   149 
   150 
   150 	// Initial handshake.
   151 	// Initial handshake.
   151 	hsOut := &stream{To: jid.Domain, Version: Version}
   152 	hsOut := &stream{To: jid.Domain, Version: Version}
   152 	cl.xmlOut <- hsOut
   153 	cl.xmlOut <- hsOut
   153 
   154 
   198 func (cl *Client) startFilter(srvIn <-chan Stanza) <-chan Stanza {
   199 func (cl *Client) startFilter(srvIn <-chan Stanza) <-chan Stanza {
   199 	cliOut := make(chan Stanza)
   200 	cliOut := make(chan Stanza)
   200 	filterOut := make(chan (<-chan Stanza))
   201 	filterOut := make(chan (<-chan Stanza))
   201 	filterIn := make(chan (<-chan Stanza))
   202 	filterIn := make(chan (<-chan Stanza))
   202 	go filter(srvIn, cliOut, filterOut, filterIn)
   203 	go filter(srvIn, cliOut, filterOut, filterIn)
       
   204 	cl.filterOut = filterOut
       
   205 	cl.filterIn = filterIn
   203 	return cliOut
   206 	return cliOut
   204 }
   207 }
   205 
   208 
   206 func tee(r io.Reader, w io.Writer, prefix string) {
   209 func tee(r io.Reader, w io.Writer, prefix string) {
   207 	defer tryClose(r, w)
   210 	defer tryClose(r, w)