stream.go
changeset 42 f6bb47ca12f2
parent 41 c8c9e6a7e6c9
child 45 abf958bcc201
equal deleted inserted replaced
41:c8c9e6a7e6c9 42:f6bb47ca12f2
   253 			if !ok {
   253 			if !ok {
   254 				log.Printf("Unhandled non-stanza: %v",
   254 				log.Printf("Unhandled non-stanza: %v",
   255 					x)
   255 					x)
   256 				continue
   256 				continue
   257 			}
   257 			}
   258 			if handlers[st.XId()] != nil {
   258 			if handlers[st.GetId()] != nil {
   259 				f := handlers[st.XId()]
   259 				f := handlers[st.GetId()]
   260 				handlers[st.XId()] = nil
   260 				handlers[st.GetId()] = nil
   261 				send = f(st)
   261 				send = f(st)
   262 			}
   262 			}
   263 			if send {
   263 			if send {
   264 				cliOut <- st
   264 				cliOut <- st
   265 			}
   265 			}
   560 	if res != "" {
   560 	if res != "" {
   561 		bindReq.Resource = &res
   561 		bindReq.Resource = &res
   562 	}
   562 	}
   563 	msg := &Iq{Type: "set", Id: <- cl.Id, Nested: &bindReq}
   563 	msg := &Iq{Type: "set", Id: <- cl.Id, Nested: &bindReq}
   564 	f := func(st Stanza) bool {
   564 	f := func(st Stanza) bool {
   565 		if st.XType() == "error" {
   565 		if st.GetType() == "error" {
   566 			log.Println("Resource binding failed")
   566 			log.Println("Resource binding failed")
   567 			return false
   567 			return false
   568 		}
   568 		}
   569 		bindRepl, ok := st.XNested().(*bindIq)
   569 		bindRepl, ok := st.GetNested().(*bindIq)
   570 		if !ok {
   570 		if !ok {
   571 			log.Printf("bad bind reply: %v", bindRepl)
   571 			log.Printf("bad bind reply: %v", bindRepl)
   572 			return false
   572 			return false
   573 		}
   573 		}
   574 		jidStr := bindRepl.Jid
   574 		jidStr := bindRepl.Jid