# HG changeset patch # User Chris Jones # Date 1378575022 25200 # Node ID a8f9a0c07fc8e49f910558962d919d95103f876f # Parent 367e76b3028e51626971e9fb542981874086ec8a Renamed client.In and client.Out to Recv and Send, respectively. diff -r 367e76b3028e -r a8f9a0c07fc8 TODO.txt --- a/TODO.txt Sat Sep 07 10:04:44 2013 -0700 +++ b/TODO.txt Sat Sep 07 10:30:22 2013 -0700 @@ -12,8 +12,6 @@ Replace inputControl with something like an enum. -Rename In and Out channels to Recv and Send. - Add a way to broadcast status information as negotiation happens or disconnects occur. Possibly a new type of object that can be sent on Recv along with stanzas. Or use sync.Cond to protect a state diff -r 367e76b3028e -r a8f9a0c07fc8 xmpp/stream.go --- a/xmpp/stream.go Sat Sep 07 10:04:44 2013 -0700 +++ b/xmpp/stream.go Sat Sep 07 10:30:22 2013 -0700 @@ -305,7 +305,7 @@ func (cl *Client) handleStreamError(se *streamError) { Info.Logf("Received stream error: %v", se) - close(cl.Out) + close(cl.Send) } func (cl *Client) handleFeatures(fe *Features) { @@ -313,7 +313,7 @@ if fe.Starttls != nil { start := &starttls{XMLName: xml.Name{Space: NsTLS, Local: "starttls"}} - cl.xmlOut <- start + cl.sendXml <- start return } @@ -355,7 +355,7 @@ // Now re-send the initial handshake message to start the new // session. hsOut := &stream{To: cl.Jid.Domain, Version: XMPPVersion} - cl.xmlOut <- hsOut + cl.sendXml <- hsOut } // Synchronize with handleTls(). Called from readTransport() when @@ -385,7 +385,7 @@ if digestMd5 { auth := &auth{XMLName: xml.Name{Space: NsSASL, Local: "auth"}, Mechanism: "DIGEST-MD5"} - cl.xmlOut <- auth + cl.sendXml <- auth } } @@ -411,7 +411,7 @@ Info.Log("Sasl authentication succeeded") cl.Features = nil ss := &stream{To: cl.Jid.Domain, Version: XMPPVersion} - cl.xmlOut <- ss + cl.sendXml <- ss } } @@ -485,17 +485,17 @@ clStr := packSasl(clMap) b64 := base64.StdEncoding clObj := &auth{XMLName: xml.Name{Space: NsSASL, Local: "response"}, Chardata: b64.EncodeToString([]byte(clStr))} - cl.xmlOut <- clObj + cl.sendXml <- clObj } func (cl *Client) saslDigest2(srvMap map[string]string) { if cl.saslExpected == srvMap["rspauth"] { clObj := &auth{XMLName: xml.Name{Space: NsSASL, Local: "response"}} - cl.xmlOut <- clObj + cl.sendXml <- clObj } else { clObj := &auth{XMLName: xml.Name{Space: NsSASL, Local: "failure"}, Any: &Generic{XMLName: xml.Name{Space: NsSASL, Local: "abort"}}} - cl.xmlOut <- clObj + cl.sendXml <- clObj } } @@ -594,7 +594,7 @@ return false } cl.HandleStanza(msg.Id, f) - cl.xmlOut <- msg + cl.sendXml <- msg } // Register a callback to handle the next XMPP stanza (iq, message, or diff -r 367e76b3028e -r a8f9a0c07fc8 xmpp/xmpp.go --- a/xmpp/xmpp.go Sat Sep 07 10:04:44 2013 -0700 +++ b/xmpp/xmpp.go Sat Sep 07 10:30:22 2013 -0700 @@ -78,11 +78,11 @@ // Incoming XMPP stanzas from the remote will be published on // this channel. Information which is used by this library to // set up the XMPP stream will not appear here. - In <-chan Stanza + Recv <-chan Stanza // Outgoing XMPP stanzas to the server should be sent to this // channel. - Out chan<- Stanza - xmlOut chan<- interface{} + Send chan<- Stanza + sendXml chan<- interface{} // The client's roster is also known as the buddy list. It's // the set of contacts which are known to this JID, or which // this JID is known to. @@ -158,7 +158,7 @@ recvXml := make(chan interface{}) go readXml(recvReader, recvXml, extStanza) sendXml := make(chan interface{}) - cl.xmlOut = sendXml + cl.sendXml = sendXml go writeXml(sendWriter, sendXml) // Start the reader and writer that convert between XML and @@ -171,15 +171,15 @@ // Start the manager for the filters that can modify what the // app sees. recvFiltXmpp := make(chan Stanza) - cl.In = recvFiltXmpp + cl.Recv = recvFiltXmpp go filterMgr(cl.recvFilterAdd, recvRawXmpp, recvFiltXmpp) sendFiltXmpp := make(chan Stanza) - cl.Out = sendFiltXmpp + cl.Send = sendFiltXmpp go filterMgr(cl.sendFilterAdd, sendFiltXmpp, sendFiltXmpp) // Initial handshake. hsOut := &stream{To: jid.Domain, Version: XMPPVersion} - cl.xmlOut <- hsOut + cl.sendXml <- hsOut return cl, nil } @@ -248,14 +248,14 @@ return false } cl.HandleStanza(id, f) - cl.Out <- iq + cl.Send <- iq // Now wait until the callback is called. if err := <-ch; err != nil { return err } if pr != nil { - cl.Out <- pr + cl.Send <- pr } return nil }