# HG changeset patch # User Chris Jones # Date 1380512234 21600 # Node ID 2d948fcbb5d7b453b21f650807d299d50861e0bc # Parent eadf15a06ff59f033a5b26371b2137c5711fb211 Renamed Extension.StanzaHandlers to StanzaTypes, and updated the doc comment. diff -r eadf15a06ff5 -r 2d948fcbb5d7 TODO.txt --- a/TODO.txt Sun Sep 29 21:33:03 2013 -0600 +++ b/TODO.txt Sun Sep 29 21:37:14 2013 -0600 @@ -5,8 +5,6 @@ Eliminate as many uses of Generic as possible. -Rename extension.StanzaHandlers to something like StanzaTypes. - Think about how to gracefully shutdown. Probably have a Close() function. diff -r eadf15a06ff5 -r 2d948fcbb5d7 xmpp/roster.go --- a/xmpp/roster.go Sun Sep 29 21:33:03 2013 -0600 +++ b/xmpp/roster.go Sun Sep 29 21:37:14 2013 -0600 @@ -103,9 +103,9 @@ func newRosterExt() *Roster { r := Roster{} - r.StanzaHandlers = make(map[xml.Name]reflect.Type) + r.StanzaTypes = make(map[xml.Name]reflect.Type) rName := xml.Name{Space: NsRoster, Local: "query"} - r.StanzaHandlers[rName] = reflect.TypeOf(RosterQuery{}) + r.StanzaTypes[rName] = reflect.TypeOf(RosterQuery{}) r.RecvFilter, r.SendFilter = r.makeFilters() r.get = make(chan []RosterItem) r.toServer = make(chan Stanza) diff -r eadf15a06ff5 -r 2d948fcbb5d7 xmpp/structs.go --- a/xmpp/structs.go Sun Sep 29 21:33:03 2013 -0600 +++ b/xmpp/structs.go Sun Sep 29 21:37:14 2013 -0600 @@ -269,7 +269,7 @@ var bindExt Extension = Extension{} func init() { - bindExt.StanzaHandlers = make(map[xml.Name]reflect.Type) + bindExt.StanzaTypes = make(map[xml.Name]reflect.Type) bName := xml.Name{Space: NsBind, Local: "bind"} - bindExt.StanzaHandlers[bName] = reflect.TypeOf(bindIq{}) + bindExt.StanzaTypes[bName] = reflect.TypeOf(bindIq{}) } diff -r eadf15a06ff5 -r 2d948fcbb5d7 xmpp/xmpp.go --- a/xmpp/xmpp.go Sun Sep 29 21:33:03 2013 -0600 +++ b/xmpp/xmpp.go Sun Sep 29 21:37:14 2013 -0600 @@ -76,10 +76,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[xml.Name]reflect.Type + // Maps from an XML name to a structure which holds stanza + // contents with that name. + StanzaTypes map[xml.Name]reflect.Type // If non-nil, will be called once to start the filter // running. RecvFilter intercepts incoming messages on their // way from the remote server to the application; SendFilter @@ -140,7 +139,7 @@ extStanza := make(map[xml.Name]reflect.Type) for _, ext := range exts { - for k, v := range ext.StanzaHandlers { + for k, v := range ext.StanzaTypes { if _, ok := extStanza[k]; ok { return nil, fmt.Errorf("duplicate handler %s", k)