xmpp/roster.go
changeset 181 750bc33ccdda
parent 162 7b5586a5e109
equal deleted inserted replaced
180:3010996c1928 181:750bc33ccdda
    14 }
    14 }
    15 
    15 
    16 // See RFC 3921, Section 7.1.
    16 // See RFC 3921, Section 7.1.
    17 type RosterItem struct {
    17 type RosterItem struct {
    18 	XMLName      xml.Name `xml:"jabber:iq:roster item"`
    18 	XMLName      xml.Name `xml:"jabber:iq:roster item"`
    19 	Jid          string   `xml:"jid,attr"`
    19 	Jid          JID      `xml:"jid,attr"`
    20 	Subscription string   `xml:"subscription,attr"`
    20 	Subscription string   `xml:"subscription,attr"`
    21 	Name         string   `xml:"name,attr"`
    21 	Name         string   `xml:"name,attr"`
    22 	Group        []string
    22 	Group        []string
    23 }
    23 }
    24 
    24 
    32 	rosterChan   <-chan []RosterItem
    32 	rosterChan   <-chan []RosterItem
    33 	rosterUpdate chan<- RosterItem
    33 	rosterUpdate chan<- RosterItem
    34 }
    34 }
    35 
    35 
    36 func (r *Roster) rosterMgr(upd <-chan Stanza) {
    36 func (r *Roster) rosterMgr(upd <-chan Stanza) {
    37 	roster := make(map[string]RosterItem)
    37 	roster := make(map[JID]RosterItem)
    38 	var snapshot []RosterItem
    38 	var snapshot []RosterItem
    39 	var get chan<- []RosterItem
    39 	var get chan<- []RosterItem
    40 	for {
    40 	for {
    41 		select {
    41 		select {
    42 		case get <- snapshot:
    42 		case get <- snapshot: