xmpp.go
changeset 23 b5de44679389
parent 22 d6b7b4cbf50d
child 26 4d0a369079ce
equal deleted inserted replaced
22:d6b7b4cbf50d 23:b5de44679389
    56 	nextId int64
    56 	nextId int64
    57 	handlers chan *stanzaHandler
    57 	handlers chan *stanzaHandler
    58 	// Incoming XMPP stanzas from the server will be published on
    58 	// Incoming XMPP stanzas from the server will be published on
    59 	// this channel. Information which is only used by this
    59 	// this channel. Information which is only used by this
    60 	// library to set up the XMPP stream will not appear here.
    60 	// library to set up the XMPP stream will not appear here.
    61 	// BUG(cjyar) Make these channels of type Stanza.
    61 	In <-chan Stanza
    62 	In <-chan interface{}
       
    63 	// Outgoing XMPP stanzas to the server should be sent to this
    62 	// Outgoing XMPP stanzas to the server should be sent to this
    64 	// channel.
    63 	// channel.
    65 	Out chan<- interface{}
    64 	Out chan<- Stanza
    66 	xmlOut chan<- interface{}
    65 	xmlOut chan<- interface{}
    67 	// BUG(cjyar) Remove this. Make a Stanza parser method
    66 	// BUG(cjyar) Remove this. Make a Stanza parser method
    68 	// available for use by interact.go and similar applications.
    67 	// available for use by interact.go and similar applications.
    69 	TextOut chan<- *string
    68 	TextOut chan<- *string
    70 }
    69 }
   162 	ch := make(chan *string)
   161 	ch := make(chan *string)
   163 	go writeText(w, ch)
   162 	go writeText(w, ch)
   164 	return ch
   163 	return ch
   165 }
   164 }
   166 
   165 
   167 func (cl *Client) startStreamReader(xmlIn <-chan interface{}, srvOut chan<- interface{}) <-chan interface{} {
   166 func (cl *Client) startStreamReader(xmlIn <-chan interface{}, srvOut chan<- interface{}) <-chan Stanza {
   168 	ch := make(chan interface{})
   167 	ch := make(chan Stanza)
   169 	go cl.readStream(xmlIn, ch)
   168 	go cl.readStream(xmlIn, ch)
   170 	return ch
   169 	return ch
   171 }
   170 }
   172 
   171 
   173 func startStreamWriter(xmlOut chan<- interface{}) chan<- interface{} {
   172 func startStreamWriter(xmlOut chan<- interface{}) chan<- Stanza {
   174 	ch := make(chan interface{})
   173 	ch := make(chan Stanza)
   175 	go writeStream(xmlOut, ch)
   174 	go writeStream(xmlOut, ch)
   176 	return ch
   175 	return ch
   177 }
   176 }
   178 
   177 
   179 func tee(r io.Reader, w io.Writer, prefix string) {
   178 func tee(r io.Reader, w io.Writer, prefix string) {