stream.go
changeset 31 1dc47df5c99f
parent 30 a77fc342e013
child 32 4e68d8f89dc3
equal deleted inserted replaced
30:a77fc342e013 31:1dc47df5c99f
   115 				break
   115 				break
   116 			}
   116 			}
   117 			ch <- st
   117 			ch <- st
   118 			continue
   118 			continue
   119 		case "stream error", nsStream + " error":
   119 		case "stream error", nsStream + " error":
   120 			obj = &StreamError{}
   120 			obj = &streamError{}
   121 		case nsStream + " features":
   121 		case nsStream + " features":
   122 			obj = &Features{}
   122 			obj = &Features{}
   123 		case nsTLS + " proceed", nsTLS + " failure":
   123 		case nsTLS + " proceed", nsTLS + " failure":
   124 			obj = &starttls{}
   124 			obj = &starttls{}
   125 		case nsSASL + " challenge", nsSASL + " failure",
   125 		case nsSASL + " challenge", nsSASL + " failure",
   184 			}
   184 			}
   185 			send := false
   185 			send := false
   186 			switch obj := x.(type) {
   186 			switch obj := x.(type) {
   187 			case *stream:
   187 			case *stream:
   188 				handleStream(obj)
   188 				handleStream(obj)
       
   189 			case *streamError:
       
   190 				cl.handleStreamError(obj)
   189 			case *Features:
   191 			case *Features:
   190 				cl.handleFeatures(obj)
   192 				cl.handleFeatures(obj)
   191 			case *starttls:
   193 			case *starttls:
   192 				cl.handleTls(obj)
   194 				cl.handleTls(obj)
   193 			case *auth:
   195 			case *auth:
   241 		}
   243 		}
   242 	}
   244 	}
   243 }
   245 }
   244 
   246 
   245 func handleStream(ss *stream) {
   247 func handleStream(ss *stream) {
       
   248 }
       
   249 
       
   250 func (cl *Client) handleStreamError(se *streamError) {
       
   251 	log.Printf("Received stream error: %v", se)
       
   252 	cl.Close()
   246 }
   253 }
   247 
   254 
   248 func (cl *Client) handleFeatures(fe *Features) {
   255 func (cl *Client) handleFeatures(fe *Features) {
   249 	if fe.Starttls != nil {
   256 	if fe.Starttls != nil {
   250 		start := &starttls{XMLName: xml.Name{Space: nsTLS,
   257 		start := &starttls{XMLName: xml.Name{Space: nsTLS,