Summary description for Error.
Inheritance: Element
コード例 #1
0
ファイル: FileTransfer.cs プロジェクト: cupid0426/MyProject
 private void SiIqResult(object sender, IQ iq, object data)
 {
     // Parse the result of the form
     if (iq.Type == IqType.result)
     {
         // <iq xmlns="jabber:client" id="aab4a" to="[email protected]/Psi" type="result"><si
         // xmlns="http://jabber.org/protocol/si" id="s5b_405645b6f2b7c681"><feature
         // xmlns="http://jabber.org/protocol/feature-neg"><x xmlns="jabber:x:data" type="submit"><field
         // var="stream-
         // method"><value>http://jabber.org/protocol/bytestreams</value></field></x></feature></si></iq>
         SI si = iq.SelectSingleElement(typeof(SI)) as SI;
         if (si != null)
         {
             FeatureNeg fNeg = si.FeatureNeg;
             if (SelectedByteStream(fNeg))
             {
                 SendStreamHosts();
             }
         }
     }
     else if (iq.Type == IqType.error)
     {
         agsXMPP.protocol.client.Error err = iq.Error;
         if (err != null)
         {
             switch ((int)err.Code)
             {
             case 403:
                 Console.WriteLine("The file was rejected by the remote user", "Error");
                 break;
             }
         }
     }
 }
コード例 #2
0
        private void SiIqResult(object sender, IQ iq, object data)
        {
            // Parse the result of the form
            if (iq.Type == IqType.result)
            {
                // <iq xmlns="jabber:client" id="aab4a" to="[email protected]/Psi" type="result"><si
                // xmlns="http://jabber.org/protocol/si" id="s5b_405645b6f2b7c681"><feature
                // xmlns="http://jabber.org/protocol/feature-neg"><x xmlns="jabber:x:data" type="submit"><field
                // var="stream-
                // method"><value>http://jabber.org/protocol/bytestreams</value></field></x></feature></si></iq>
                //if (iq.Query != null && iq.Query.Namespace == "http://jabber.org/protocol/disco#items")
                //{
                //    Proxy = true;
                //}

                SI si = iq.SelectSingleElement(typeof(SI)) as SI;
                if (si != null)
                {
                    FeatureNeg fNeg = si.FeatureNeg;

                    if (SelectedByteStream(fNeg))
                    {
                        //添加申请传输代理服务器
                        if (!Proxy)
                        {
                            IQ iq1 = new IQ();
                            iq1.Id = iq.Id;
                            //iq1.Namespace = "jabber:client";
                            iq1.Type = IqType.get;
                            //iq1.From = m_XmppCon.MyJID;
                            //iq1.To = m_To;
                            iq1.InnerXml = "<query xmlns=\"http://jabber.org/protocol/disco#items\" sid=\"" + m_Sid + "\" />";
                            //iq1.AddChild(new agsXMPP.Xml.Dom.Node(""));
                            //iq1.Query.Namespace = "http://jabber.org/protocol/disco#items";
                            // m_XmppCon.Send(iq1);
                            m_XmppCon.IqGrabber.SendIq2(iq1, new IqCB(SiIqResult1), null);
                        }
                    }
                }

                //if (Proxy)
                //{
                //    SendStreamHosts();
                //}
            }
            else if (iq.Type == IqType.error)
            {
                agsXMPP.protocol.client.Error err = iq.Error;
                if (err != null)
                {
                    switch ((int)err.Code)
                    {
                    case 403:
                        MessageBox.Show("The file was rejected by the remote user", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        break;
                    }
                }
            }
        }