예제 #1
0
        /// <summary>
        /// Get the details for the given conference bookmark.
        /// </summary>
        /// <param name="jid"></param>
        /// <returns></returns>
        public BookmarkConference this[JID jid]
        {
            get { return(m_conferences[jid]); }
            set
            {
                BookmarkConference prev = null;
                if (value == null)
                {
                    if (m_conferences.TryGetValue(jid, out prev))
                    {
                        m_conferences.Remove(jid);
                        prev.SetAttribute("remove", "true");
                    }
                    else
                    {
                        // no-op.  Setting null on a non-existing JID.
                        return;
                    }
                }
                else
                {
                    m_conferences[jid] = prev = value;
                }

                BookmarksIQ biq = new BookmarksIQ(m_stream.Document);
                biq.Type = IQType.set;
                Bookmarks bm = biq.Bookmarks;
                foreach (BookmarkConference conf in m_conferences.Values)
                {
                    bm.AddChild((XmlElement)conf.CloneNode(true, m_stream.Document));
                }
                m_stream.Tracker.BeginIQ(biq, BookmarksSet, prev);
            }
        }