xmpp.go
changeset 116 5c6d6d51d3ba
parent 113 bee6cc131798
child 118 fb9bb98a8d70
equal deleted inserted replaced
115:7c45fc3f524a 116:5c6d6d51d3ba
   186 	go cl.writeTransport(outr)
   186 	go cl.writeTransport(outr)
   187 	return inr, outw
   187 	return inr, outw
   188 }
   188 }
   189 
   189 
   190 func startXmlReader(r io.Reader,
   190 func startXmlReader(r io.Reader,
   191 extStanza map[string]func(*xml.Name) interface{}) <-chan interface{} {
   191 	extStanza map[string]func(*xml.Name) interface{}) <-chan interface{} {
   192 	ch := make(chan interface{})
   192 	ch := make(chan interface{})
   193 	go readXml(r, ch, extStanza)
   193 	go readXml(r, ch, extStanza)
   194 	return ch
   194 	return ch
   195 }
   195 }
   196 
   196 
   267 // presence. The presence can be as simple as a newly-initialized
   267 // presence. The presence can be as simple as a newly-initialized
   268 // Presence struct.  See RFC 3921, Section 3.
   268 // Presence struct.  See RFC 3921, Section 3.
   269 func (cl *Client) StartSession(getRoster bool, pr *Presence) error {
   269 func (cl *Client) StartSession(getRoster bool, pr *Presence) error {
   270 	id := <-Id
   270 	id := <-Id
   271 	iq := &Iq{Header: Header{To: cl.Jid.Domain, Id: id, Type: "set",
   271 	iq := &Iq{Header: Header{To: cl.Jid.Domain, Id: id, Type: "set",
   272 		Nested: []interface{}{Generic{XMLName:
   272 		Nested: []interface{}{Generic{XMLName: xml.Name{Space: NsSession, Local: "session"}}}}}
   273 			xml.Name{Space: NsSession, Local: "session"}}}}}
       
   274 	ch := make(chan error)
   273 	ch := make(chan error)
   275 	f := func(st Stanza) bool {
   274 	f := func(st Stanza) bool {
   276 		iq, ok := st.(*Iq)
   275 		iq, ok := st.(*Iq)
   277 		if !ok {
   276 		if !ok {
   278 			Warn.Log("iq reply not iq; can't start session")
   277 			Warn.Log("iq reply not iq; can't start session")