xmpp.go
changeset 34 7b1f924c75e2
parent 33 571713f49494
child 36 9fe022261dcc
equal deleted inserted replaced
33:571713f49494 34:7b1f924c75e2
    24 	// Version of RFC 3920 that we implement.
    24 	// Version of RFC 3920 that we implement.
    25 	Version = "1.0"
    25 	Version = "1.0"
    26 
    26 
    27 	// BUG(cjyar) These should be public.
    27 	// BUG(cjyar) These should be public.
    28 	// Various XML namespaces.
    28 	// Various XML namespaces.
    29 	nsStreams = "urn:ietf:params:xml:ns:xmpp-streams"
    29 	NsStreams = "urn:ietf:params:xml:ns:xmpp-streams"
    30 	nsStream = "http://etherx.jabber.org/streams"
    30 	NsStream = "http://etherx.jabber.org/streams"
    31 	nsTLS = "urn:ietf:params:xml:ns:xmpp-tls"
    31 	NsTLS = "urn:ietf:params:xml:ns:xmpp-tls"
    32 	nsSASL = "urn:ietf:params:xml:ns:xmpp-sasl"
    32 	NsSASL = "urn:ietf:params:xml:ns:xmpp-sasl"
    33 	nsBind = "urn:ietf:params:xml:ns:xmpp-bind"
    33 	NsBind = "urn:ietf:params:xml:ns:xmpp-bind"
    34 	nsSession = "urn:ietf:params:xml:ns:xmpp-session"
    34 	NsSession = "urn:ietf:params:xml:ns:xmpp-session"
    35 	NsRoster = "jabber:iq:roster"
    35 	NsRoster = "jabber:iq:roster"
    36 
    36 
    37 	// DNS SRV names
    37 	// DNS SRV names
    38 	serverSrv = "xmpp-server"
    38 	serverSrv = "xmpp-server"
    39 	clientSrv = "xmpp-client"
    39 	clientSrv = "xmpp-client"
   255 // presence. The presence can be as simple as a newly-initialized
   255 // presence. The presence can be as simple as a newly-initialized
   256 // Presence struct.  See RFC 3921, Section 3.
   256 // Presence struct.  See RFC 3921, Section 3.
   257 func (cl *Client) StartSession(getRoster bool, pr *Presence) os.Error {
   257 func (cl *Client) StartSession(getRoster bool, pr *Presence) os.Error {
   258 	id := <- cl.Id
   258 	id := <- cl.Id
   259 	iq := &Iq{To: cl.Jid.Domain, Id: id, Type: "set", Any:
   259 	iq := &Iq{To: cl.Jid.Domain, Id: id, Type: "set", Any:
   260 		&Generic{XMLName: xml.Name{Space: nsSession, Local:
   260 		&Generic{XMLName: xml.Name{Space: NsSession, Local:
   261 				"session"}}}
   261 				"session"}}}
   262 	ch := make(chan os.Error)
   262 	ch := make(chan os.Error)
   263 	f := func(st Stanza) bool {
   263 	f := func(st Stanza) bool {
   264 		if st.XType() == "error" {
   264 		if st.XType() == "error" {
   265 			log.Printf("Can't start session: %v", st)
   265 			log.Printf("Can't start session: %v", st)