stream.go
changeset 14 fd6781a41e6f
parent 13 c9527bbe99a6
child 15 aa2cf77f0ed3
equal deleted inserted replaced
13:c9527bbe99a6 14:fd6781a41e6f
   198 				send = true
   198 				send = true
   199 			}
   199 			}
   200 			if st, ok := x.(Stanza) ; ok &&
   200 			if st, ok := x.(Stanza) ; ok &&
   201 				handlers[st.XId()] != nil {
   201 				handlers[st.XId()] != nil {
   202 				f := handlers[st.XId()]
   202 				f := handlers[st.XId()]
       
   203 				handlers[st.XId()] = nil
   203 				send = f(st)
   204 				send = f(st)
   204 			}
   205 			}
   205 			if send {
   206 			if send {
   206 				cliOut <- x
   207 				cliOut <- x
   207 			}
   208 			}
   473 	if res != "" {
   474 	if res != "" {
   474 		msg.Any.Any = &Unrecognized{XMLName: xml.Name{Local:
   475 		msg.Any.Any = &Unrecognized{XMLName: xml.Name{Local:
   475 				"resource"}, Chardata: res}
   476 				"resource"}, Chardata: res}
   476 	}
   477 	}
   477 	cl.xmlOut <- msg
   478 	cl.xmlOut <- msg
   478 	// TODO Grab the iq result from the server and update cl.Jid.
       
   479 }
   479 }
   480 
   480 
   481 func (cl *Client) HandleStanza(id string, f func(Stanza) bool) {
   481 func (cl *Client) HandleStanza(id string, f func(Stanza) bool) {
   482 	h := &stanzaHandler{id: id, f: f}
   482 	h := &stanzaHandler{id: id, f: f}
   483 	cl.handlers <- h
   483 	cl.handlers <- h