--- a/xmpp/roster.go Sun Feb 09 09:50:38 2014 -0700
+++ b/xmpp/roster.go Sun Feb 09 09:52:28 2014 -0700
@@ -16,7 +16,7 @@
// See RFC 3921, Section 7.1.
type RosterItem struct {
XMLName xml.Name `xml:"jabber:iq:roster item"`
- Jid string `xml:"jid,attr"`
+ Jid JID `xml:"jid,attr"`
Subscription string `xml:"subscription,attr"`
Name string `xml:"name,attr"`
Group []string
@@ -34,7 +34,7 @@
}
func (r *Roster) rosterMgr(upd <-chan Stanza) {
- roster := make(map[string]RosterItem)
+ roster := make(map[JID]RosterItem)
var snapshot []RosterItem
var get chan<- []RosterItem
for {
@@ -79,6 +79,7 @@
go r.rosterMgr(rosterUpdate)
recv := func(in <-chan Stanza, out chan<- Stanza) {
defer close(out)
+ defer close(rosterUpdate)
for stan := range in {
rosterUpdate <- stan
out <- stan
@@ -103,9 +104,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)