xmpp/filter.go
changeset 133 c4e0b897db83
parent 126 367e76b3028e
child 136 f35f853a52b6
equal deleted inserted replaced
132:feaa24de9597 133:c4e0b897db83
    32 		}
    32 		}
    33 	}
    33 	}
    34 	close(botFiltIn)
    34 	close(botFiltIn)
    35 }
    35 }
    36 
    36 
    37 // Starts the filter chain. Filters will all interpose themselves
       
    38 // between srvIn and cliOut.
       
    39 func (cl *Client) startFilters(srvIn, cliIn <-chan Stanza) (<-chan Stanza, <-chan Stanza) {
       
    40 	cliOut := make(chan Stanza)
       
    41 	srvOut := make(chan Stanza)
       
    42 	go filterMgr(cl.sendFilterAdd, srvIn, cliOut)
       
    43 	go filterMgr(cl.recvFilterAdd, cliIn, srvOut)
       
    44 	return cliOut, srvOut
       
    45 }
       
    46 
       
    47 // AddRecvFilter adds a new filter to the top of the stack through which
    37 // AddRecvFilter adds a new filter to the top of the stack through which
    48 // incoming stanzas travel on their way up to the client.
    38 // incoming stanzas travel on their way up to the client.
    49 func (cl *Client) AddRecvFilter(filt Filter) {
    39 func (cl *Client) AddRecvFilter(filt Filter) {
    50 	if filt == nil {
    40 	if filt == nil {
    51 		return
    41 		return