xmpp.go
changeset 8 30a7752cf8f7
parent 6 8e425e340ca1
child 9 4fe926b03827
equal deleted inserted replaced
7:4f0f66f9a441 8:30a7752cf8f7
    71 	// TODO Send readXml a reader that we can close when we
    71 	// TODO Send readXml a reader that we can close when we
    72 	// negotiate TLS.
    72 	// negotiate TLS.
    73 	go readXml(cl.tcp, cl.in, debug)
    73 	go readXml(cl.tcp, cl.in, debug)
    74 	go writeXml(cl.tcp, cl.out, debug)
    74 	go writeXml(cl.tcp, cl.out, debug)
    75 
    75 
       
    76 	// Initial handshake.
       
    77 	hsOut := &Stream{To: jid.Domain, Version: Version}
       
    78 	cl.Out <- hsOut
       
    79 
    76 	return cl, nil
    80 	return cl, nil
    77 }
    81 }
    78 
    82 
    79 func (c *Client) Close() os.Error {
    83 func (c *Client) Close() os.Error {
    80 	close(c.in)
    84 	close(c.in)
   123 			}
   127 			}
   124 			ch <- st
   128 			ch <- st
   125 			continue
   129 			continue
   126 		case "stream error":
   130 		case "stream error":
   127 			obj = &StreamError{}
   131 			obj = &StreamError{}
       
   132 		case nsStream + " features":
       
   133 			obj = &Features{}
   128 		default:
   134 		default:
   129 			obj = &Unrecognized{}
   135 			obj = &Unrecognized{}
       
   136 			log.Printf("Ignoring unrecognized: %s %s\n",
       
   137 				se.Name.Space, se.Name.Local)
   130 		}
   138 		}
   131 
   139 
   132 		// Read the complete XML stanza.
   140 		// Read the complete XML stanza.
   133 		err = p.Unmarshal(obj, &se)
   141 		err = p.Unmarshal(obj, &se)
   134 		if err != nil {
   142 		if err != nil {