当前位置: 首页>>代码示例>>C#>>正文


C# IQ.AddChild方法代码示例

本文整理汇总了C#中IQ.AddChild方法的典型用法代码示例。如果您正苦于以下问题:C# IQ.AddChild方法的具体用法?C# IQ.AddChild怎么用?C# IQ.AddChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IQ的用法示例。


在下文中一共展示了IQ.AddChild方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: JabberClient_OnSASLEnd

        private void JabberClient_OnSASLEnd(Object sender, protocol.stream.Features feat)
        {
            lock (StateLock)
            {
                State = BindState.Instance;
            }
            if (feat["bind", URI.BIND] != null)
            {
                IQ iq = new IQ(Document) {Type = IQType.Set};

                protocol.stream.Bind bind = new protocol.stream.Bind(Document);
                if (!string.IsNullOrEmpty(Resource))
                    bind.Resource = Resource;

                iq.AddChild(bind);
                Tracker.BeginIQ(iq, GotResource, feat);
            }
            else if (feat["session", URI.SESSION] != null)
            {
                IQ iq = new IQ(Document) {Type = IQType.Set};
                iq.AddChild(new protocol.stream.Session(Document));
                Tracker.BeginIQ(iq, GotSession, feat);
            }
            else
                IsAuthenticated = true;
        }
开发者ID:csfmeridian,项目名称:jabber-net,代码行数:26,代码来源:JabberClient.cs

示例2: JabberClient_OnSASLEnd

        private void JabberClient_OnSASLEnd(Object sender, jabber.protocol.stream.Features feat)
        {
            lock (StateLock)
            {
                State = BindState.Instance;
            }
            if (feat["bind", URI.BIND] != null)
            {
                IQ iq = new IQ(this.Document);
                iq.Type = IQType.set;

                jabber.protocol.stream.Bind bind = new jabber.protocol.stream.Bind(this.Document);
                if ((Resource != null) && (Resource != ""))
                    bind.Resource = Resource;

                iq.AddChild(bind);
                this.Tracker.BeginIQ(iq, new IqCB(GotResource), feat);
            }
            else if (feat["session", URI.SESSION] != null)
            {
                IQ iq = new IQ(this.Document);
                iq.Type = IQType.set;
                iq.AddChild(new jabber.protocol.stream.Session(this.Document));
                this.Tracker.BeginIQ(iq, new IqCB(GotSession), feat);
            }
            else
                IsAuthenticated = true;
        }
开发者ID:nael-lilik,项目名称:jabber-net,代码行数:28,代码来源:JabberClient.cs

示例3: GotResource

        private void GotResource(object sender, IQ iq, object state)
        {
            protocol.stream.Features feat = state as protocol.stream.Features;

            if (iq == null)
            {
                FireOnError(new AuthenticationFailedException("Timeout authenticating"));
                return;
            }
            if (iq.Type != IQType.Result)
            {
                Error err = iq.Error;
                if (err == null)
                    FireOnError(new AuthenticationFailedException("Unknown error binding resource"));
                else
                    FireOnError(new AuthenticationFailedException("Error binding resource: " + err.OuterXml));
                return;
            }

            XmlElement bind = iq["bind", URI.BIND];
            if (bind == null)
            {
                FireOnError(new AuthenticationFailedException("No binding returned.  Server implementation error."));
                return;
            }
            XmlElement jid = bind["jid"];
            if (jid == null)
            {
                FireOnError(new AuthenticationFailedException("No jid returned from binding.  Server implementation error."));
                return;
            }
            this[Options.JID] = new JID(jid.InnerText);

            if (feat["session", URI.SESSION] != null)
            {
                IQ iqs = new IQ(Document) {Type = IQType.Set};
                iqs.AddChild(new protocol.stream.Session(Document));
                Tracker.BeginIQ(iqs, GotSession, feat);
            }
            else
                IsAuthenticated = true;
        }
开发者ID:csfmeridian,项目名称:jabber-net,代码行数:42,代码来源:JabberClient.cs

示例4: Publish

        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);
                }
            }
        }
开发者ID:jrudolph,项目名称:synapse,代码行数:20,代码来源:PersonalEventing.cs


注:本文中的IQ.AddChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。