equal
deleted
inserted
replaced
46 // that information. This is called once from a fairly deep call stack |
46 // that information. This is called once from a fairly deep call stack |
47 // as part of XMPP negotiation. |
47 // as part of XMPP negotiation. |
48 func fetchRoster(client *Client) error { |
48 func fetchRoster(client *Client) error { |
49 rosterUpdate := rosterClients[client.Uid].rosterUpdate |
49 rosterUpdate := rosterClients[client.Uid].rosterUpdate |
50 |
50 |
51 iq := &Iq{Stanza: Stanza{From: client.Jid.String(), Type: "get", |
51 iq := &Iq{Header: Header{From: client.Jid.String(), Type: "get", |
52 Id: <-Id, Nested: []interface{}{RosterQuery{}}}} |
52 Id: <-Id, Nested: []interface{}{RosterQuery{}}}} |
53 ch := make(chan error) |
53 ch := make(chan error) |
54 f := func(v interface{}) bool { |
54 f := func(v interface{}) bool { |
55 defer close(ch) |
55 defer close(ch) |
56 iq, ok := v.(*Iq) |
56 iq, ok := v.(*Iq) |
126 if iq.Type == "set" && rq != nil { |
126 if iq.Type == "set" && rq != nil { |
127 for _, item := range rq.Item { |
127 for _, item := range rq.Item { |
128 rosterUpdate <- item |
128 rosterUpdate <- item |
129 } |
129 } |
130 // Send a reply. |
130 // Send a reply. |
131 reply := &Iq{Stanza: Stanza{To: iq.From, Id: iq.Id, |
131 reply := &Iq{Header: Header{To: iq.From, Id: iq.Id, |
132 Type: "result"}} |
132 Type: "result"}} |
133 client.Out <- reply |
133 client.Out <- reply |
134 } |
134 } |
135 } |
135 } |
136 |
136 |