Example #1
0
        public void Publish(string node, XmlElement item)
        {
            IQ iq = new IQ(m_Account.Client.Document);

            iq.Type = IQType.set;
            PubSub pubsub = new PubSub(m_Account.Client.Document);

            pubsub.SetAttribute("xmlns", "http://jabber.org/protocol/pubsub");
            Publish publish = new Publish(m_Account.Client.Document);

            publish.SetAttribute("node", node);
            publish.AddChild(item);
            pubsub.AddChild(publish);
            iq.AddChild(pubsub);

            if (m_Account.ConnectionState == AccountConnectionState.Connected)
            {
                m_Account.Send(iq);
            }
            else
            {
                lock (m_Queue) {
                    m_Queue.Enqueue(iq);
                }
            }
        }
Example #2
0
        /// <summary>
        /// Publishes an item to the node.
        /// </summary>
        /// <param name="id">If null, the server will assign an item ID.</param>
        /// <param name="contents">The XML inside the item.  Should be in a new namespace.</param>
        public void PublishItem(string id, XmlElement contents)
        {
            PubSubIQ   iq   = createCommand(PubSubCommandType.publish);
            Publish    pub  = (Publish)iq.Command;
            PubSubItem item = new PubSubItem(m_stream.Document);

            if (id != null)
            {
                item.ID = id;
            }
            item.AddChild(contents);
            pub.AddChild(item);
            BeginIQ(iq, new IqCB(OnPublished), item);
        }
Example #3
0
        public void Publish(string node, XmlElement item)
        {
            IQ iq = new IQ(m_Account.Client.Document);
            iq.Type = IQType.set;
            PubSub pubsub = new PubSub(m_Account.Client.Document);
            pubsub.SetAttribute("xmlns", "http://jabber.org/protocol/pubsub");
            Publish publish = new Publish(m_Account.Client.Document);
            publish.SetAttribute("node", node);
            publish.AddChild(item);
            pubsub.AddChild(publish);
            iq.AddChild(pubsub);

            if (m_Account.ConnectionState == AccountConnectionState.Connected) {
                m_Account.Send(iq);
            } else {
                lock (m_Queue) {
                    m_Queue.Enqueue(iq);
                }
            }
        }