equal
deleted
inserted
replaced
112 case nsTLS + " proceed", nsTLS + " failure": |
112 case nsTLS + " proceed", nsTLS + " failure": |
113 obj = &starttls{} |
113 obj = &starttls{} |
114 case nsSASL + " challenge", nsSASL + " failure", |
114 case nsSASL + " challenge", nsSASL + " failure", |
115 nsSASL + " success": |
115 nsSASL + " success": |
116 obj = &auth{} |
116 obj = &auth{} |
|
117 case "jabber:client iq": |
|
118 obj = &Iq{} |
117 default: |
119 default: |
118 obj = &Unrecognized{} |
120 obj = &Unrecognized{} |
119 log.Printf("Ignoring unrecognized: %s %s\n", |
121 log.Printf("Ignoring unrecognized: %s %s\n", |
120 se.Name.Space, se.Name.Local) |
122 se.Name.Space, se.Name.Local) |
121 } |
123 } |
206 |
208 |
207 if len(fe.Mechanisms.Mechanism) > 0 { |
209 if len(fe.Mechanisms.Mechanism) > 0 { |
208 cl.chooseSasl(fe) |
210 cl.chooseSasl(fe) |
209 return |
211 return |
210 } |
212 } |
|
213 |
|
214 if fe.Bind != nil { |
|
215 cl.bind(fe.Bind) |
|
216 } |
211 } |
217 } |
212 |
218 |
213 // readTransport() is running concurrently. We need to stop it, |
219 // readTransport() is running concurrently. We need to stop it, |
214 // negotiate TLS, then start it again. It calls waitForSocket() in |
220 // negotiate TLS, then start it again. It calls waitForSocket() in |
215 // its inner loop; see below. |
221 // its inner loop; see below. |
434 response := hex(kd(hex(h(a1)), nonce + ":" + |
440 response := hex(kd(hex(h(a1)), nonce + ":" + |
435 nonceCountStr + ":" + cnonceStr + ":auth:" + |
441 nonceCountStr + ":" + cnonceStr + ":auth:" + |
436 hex(h(a2)))) |
442 hex(h(a2)))) |
437 return response |
443 return response |
438 } |
444 } |
|
445 |
|
446 func (cl *Client) bind(bind *Unrecognized) { |
|
447 res := cl.Jid.Resource |
|
448 msg := &Iq{Type: "set", Id: cl.NextId(), Any: |
|
449 &Unrecognized{XMLName: xml.Name{Space: nsBind, Local: |
|
450 "bind"}}} |
|
451 if res != "" { |
|
452 msg.Any.Any = &Unrecognized{XMLName: xml.Name{Local: |
|
453 "resource"}, Chardata: res} |
|
454 } |
|
455 cl.xmlOut <- msg |
|
456 // TODO Grab the iq result from the server and update cl.Jid. |
|
457 } |