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


C# IQ.GetAcknowledge方法代码示例

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


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

示例1: GotIQ

        /// <summary>
        /// Analyses an IQ paquet and chooses to handle it or not
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="iq"></param>
        private void GotIQ(object sender, IQ iq)
        {
            if (!iq.Handled &&
                iq.Query != null && iq.Type == IQType.get &&
                iq.Query.NamespaceURI == URI.PING)
            {
                iq.Handled = true;

                this.Write(iq.GetAcknowledge(m_stream.Document));
            }
        }
开发者ID:emilio-simoes,项目名称:JabberNet-2010,代码行数:16,代码来源:PingManager.cs

示例2: GotIQ

        /// <summary>
        /// Analyses an IQ paquet and chooses to handle it or not
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="iq"></param>
        private void GotIQ(object sender, IQ iq)
        {
            Jingle jingle = iq.Query as Jingle;

            if (jingle != null)
            {
                if (jingle.Action == ActionType.session_terminate)
                {
                    this.Stream.Write(iq.GetAcknowledge(this.Stream.Document));

                    if (this.OnReceivedSessionTerminate != null)
                        this.OnReceivedSessionTerminate(this, iq);

                    if (this.Sessions.ContainsKey(jingle.Sid))
                        this.Sessions.Remove(jingle.Sid);

                    iq.Handled = true;
                }
                else
                {
                    if (!this.AllowSessionInitiateFrom(iq.From))
                    {
                        this.SessionTerminate(iq.From, jingle.Sid, ReasonType.security_error);
                        iq.Handled = true;
                    }
                    else
                    {
                        switch (jingle.Action)
                        {
                            case ActionType.session_initiate:
                                this.Stream.Write(iq.GetAcknowledge(this.Stream.Document));

                                if (!this.Sessions.ContainsKey(jingle.Sid))
                                {
                                    JingleSession jingleSession = new JingleSession();
                                    jingleSession.SID = jingle.Sid;
                                    jingleSession.Remote = jingle;

                                    this.Sessions.Add(jingle.Sid, jingleSession);
                                }

                                if (this.OnReceivedSessionInitiate != null)
                                    this.OnReceivedSessionInitiate(this, iq);

                                if (!iq.Handled)
                                {
                                    this.SessionTerminate(iq.From, jingle.Sid, ReasonType.decline);
                                    iq.Handled = true;
                                }

                                break;

                            case ActionType.session_accept:
                                this.Stream.Write(iq.GetAcknowledge(this.Stream.Document));

                                if (!this.Sessions.ContainsKey(jingle.Sid))
                                {
                                    JingleSession jingleSession = new JingleSession();
                                    jingleSession.SID = jingle.Sid;
                                    jingleSession.Remote = jingle;

                                    this.Sessions.Add(jingle.Sid, jingleSession);
                                }

                                if (this.OnReceivedSessionAccept != null)
                                    this.OnReceivedSessionAccept(this, iq);

                                if (!iq.Handled)
                                {
                                    this.SessionTerminate(iq.From, jingle.Sid, ReasonType.cancel);
                                    iq.Handled = true;
                                }

                                break;

                            case ActionType.session_info:
                                if (this.Sessions.ContainsKey(jingle.Sid))
                                    this.Stream.Write(iq.GetAcknowledge(this.Stream.Document));
                                else
                                    this.Stream.Write(new UnknownSession(this.Stream.Document));

                                if (this.OnReceivedSessionInfo != null)
                                    this.OnReceivedSessionInfo(this, iq);

                                break;

                            case ActionType.transport_info:
                                if (this.Sessions.ContainsKey(jingle.Sid))
                                    this.Stream.Write(iq.GetAcknowledge(this.Stream.Document));
                                else
                                    this.Stream.Write(new UnknownSession(this.Stream.Document));

                                if (this.OnReceivedTransportInfo != null)
                                    this.OnReceivedTransportInfo(this, iq);

//.........这里部分代码省略.........
开发者ID:emilio-simoes,项目名称:JabberNet-2010,代码行数:101,代码来源:JingleManager.cs


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