# HG changeset patch # User Chris Jones # Date 1377986815 -3600 # Node ID 712aa5780660f763f345a48dadc592e7dfaa0aeb # Parent fb9bb98a8d700b85bc18b3ca964a397638548122 Documentation cleanup. diff -r fb9bb98a8d70 -r 712aa5780660 TODO.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TODO.txt Sat Aug 31 23:06:55 2013 +0100 @@ -0,0 +1,36 @@ +Extension.StanzaHandlers should use reflection, not constructor +functions. + +Rather than use Client.AddFilter(), and Extension.Start(), we should +have a function in Extension that, if non-nil, accepts a stanza and +returns a slice of stanzas. + +Review all these *Client receiver methods. They should probably either +all be receivers, or none. + +Get rid of Client.Uid. + +Maybe put auth-related stuff into its own structure inside Client, +instead of at Client's top level. + +Rename stanzaHandler to something like idCallback. Same for the +HandleStanza function. + +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 +variable. + +Asynchronously updating Client.Features is not thread safe. + +NewClient shouldn't be asynchronous. + +Add a Reconnect() function. + +Put roster and bind into separate packages, if possible. + +Eliminate as many uses of Generic as possible. diff -r fb9bb98a8d70 -r 712aa5780660 stream.go --- a/stream.go Fri Aug 30 17:24:39 2013 -0600 +++ b/stream.go Sat Aug 31 23:06:55 2013 +0100 @@ -32,9 +32,6 @@ f func(Stanza) bool } -// BUG(cjyar) Review all these *Client receiver methods. They should -// probably either all be receivers, or none. - func (cl *Client) readTransport(w io.WriteCloser) { defer w.Close() p := make([]byte, 1024) diff -r fb9bb98a8d70 -r 712aa5780660 structs.go --- a/structs.go Fri Aug 30 17:24:39 2013 -0600 +++ b/structs.go Sat Aug 31 23:06:55 2013 +0100 @@ -11,7 +11,7 @@ "encoding/xml" "flag" "fmt" - // BUG(cjyar): We should use stringprep + // BUG(cjyar): Doesn't use stringprep. Could try the implementation at // "code.google.com/p/go-idn/src/stringprep" "regexp" "strings" diff -r fb9bb98a8d70 -r 712aa5780660 xmpp.go --- a/xmpp.go Fri Aug 30 17:24:39 2013 -0600 +++ b/xmpp.go Sat Aug 31 23:06:55 2013 +0100 @@ -3,7 +3,11 @@ // license that can be found in the LICENSE file. // This package implements a simple XMPP client according to RFCs 3920 -// and 3921, plus the various XEPs at http://xmpp.org/protocols/. +// and 3921, plus the various XEPs at http://xmpp.org/protocols/. The +// implementation is structured as a stack of layers, with TCP at the +// bottom and the application at the top. The application receives and +// sends structures representing XMPP stanzas. Additional stanza +// parsers can be inserted into the stack of layers as extensions. package xmpp import ( @@ -38,6 +42,9 @@ // Extensions can add stanza filters and/or new XML element types. type Extension struct { + // Maps from an XML namespace to a function which constructs a + // structure to hold the contents of stanzas in that + // namespace. StanzaHandlers map[string]func(*xml.Name) interface{} Start func(*Client) } @@ -61,9 +68,9 @@ authDone bool handlers chan *stanzaHandler inputControl chan int - // Incoming XMPP stanzas from the server will be published on - // this channel. Information which is only used by this - // library to set up the XMPP stream will not appear here. + // 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 // Outgoing XMPP stanzas to the server should be sent to this // channel.