Beispiel #1
0
        private PubSubIQ createCommand(PubSubCommandType type)
        {
            PubSubIQ iq = new PubSubIQ(m_stream.Document, type, m_node);

            iq.To   = m_jid;
            iq.Type = IQType.set;

            return(iq);
        }
Beispiel #2
0
        /// <summary>
        /// Create a pubsub IQ, with a pubusub query element and the given subelement.
        /// </summary>
        /// <param name="doc">Document to create in</param>
        /// <param name="command">The pubsub command</param>
        /// <param name="node">Add this as a node attrbute of the command</param>
        public PubSubIQ(XmlDocument doc, PubSubCommandType command, string node)
            : base(doc)
        {
            PubSubCommand cmd = null;

            switch (command)
            {
            case PubSubCommandType.affiliations:
                cmd = new Affiliations(doc);
                break;

            case PubSubCommandType.create:
                cmd = new Create(doc);
                break;

            case PubSubCommandType.items:
                cmd = new Items(doc);
                break;

            case PubSubCommandType.publish:
                cmd = new Publish(doc);
                break;

            case PubSubCommandType.retract:
                cmd = new Retract(doc);
                break;

            case PubSubCommandType.subscribe:
                cmd = new Subscribe(doc);
                break;

            case PubSubCommandType.subscriptions:
                cmd = new Subscriptions(doc);
                break;

            case PubSubCommandType.unsubscribe:
                cmd = new Unsubscribe(doc);
                break;

            default:
                throw new ArgumentException("Command not understood: " + command.ToString(), "command");
            }

            if (node != null)
            {
                cmd.Node = node;
            }
            this.Instruction.AppendChild(cmd);
        }
Beispiel #3
0
        private PubSubIQ createCommand(PubSubCommandType type)
        {
            PubSubIQ iq = new PubSubIQ(m_stream.Document, type, m_node);
            iq.To = m_jid;
            iq.Type = IQType.set;

            return iq;
        }