299 // session, retrieve the roster, and broadcast an initial |
299 // session, retrieve the roster, and broadcast an initial |
300 // presence. The presence can be as simple as a newly-initialized |
300 // presence. The presence can be as simple as a newly-initialized |
301 // Presence struct. See RFC 3921, Section 3. |
301 // Presence struct. See RFC 3921, Section 3. |
302 func (cl *Client) StartSession(getRoster bool, pr *Presence) os.Error { |
302 func (cl *Client) StartSession(getRoster bool, pr *Presence) os.Error { |
303 id := <- Id |
303 id := <- Id |
304 iq := &Iq{To: cl.Jid.Domain, Id: id, Type: "set", Any: |
304 iq := &Iq{To: cl.Jid.Domain, Id: id, Type: "set", Nested: |
305 &Generic{XMLName: xml.Name{Space: NsSession, Local: |
305 []interface{}{ Generic{XMLName: xml.Name{Space: |
306 "session"}}} |
306 NsSession, Local: "session"}}}} |
307 ch := make(chan os.Error) |
307 ch := make(chan os.Error) |
308 f := func(st Stanza) bool { |
308 f := func(st Stanza) bool { |
309 if st.GetType() == "error" { |
309 if st.GetType() == "error" { |
310 log.Printf("Can't start session: %v", st) |
310 log.Printf("Can't start session: %v", st) |
311 ch <- st.GetError() |
311 ch <- st.GetError() |