# HG changeset patch # User Chris Jones # Date 1325473243 25200 # Node ID 22e575eff35a017699729b38ffeedbe7bc4cc4ac # Parent 4a4530b8f62235647f8e720e2075ffc75682f587 Implemented roster item delete, and added another BUG comment. diff -r 4a4530b8f622 -r 22e575eff35a roster.go --- a/roster.go Sun Jan 01 19:32:51 2012 -0700 +++ b/roster.go Sun Jan 01 20:00:43 2012 -0700 @@ -101,11 +101,19 @@ }(in, out) } +// BUG(cjyar) This isn't actually thread safe, though it's unlikely it +// will fail in practice. Either the roster should be protected with a +// mutex, or we should make the roster available on a channel instead +// of via a method call. func (cl *Client) maybeUpdateRoster(st Stanza) { rq, ok := st.GetNested().(*RosterQuery) if st.GetName() == "iq" && st.GetType() == "set" && ok { for _, item := range(rq.Item) { - cl.roster[item.Jid] = &item + if item.Subscription == "remove" { + cl.roster[item.Jid] = nil + } else { + cl.roster[item.Jid] = &item + } } } }