⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dialog.cs

📁 破解的飞信源代码
💻 CS
📖 第 1 页 / 共 5 页
字号:
                    }
                    uri = req.Message.SourceHeader.Value;
                }
                Imps.Client.Core.Contact contact = base.Owner.ContactList.FindOrCreateContact(uri, this.BizOperation);
                switch (doc.DocumentElement.Name)
                {
                    case "is-composing":
                        this.DoReceiveStateInfo(doc, contact);
                        return;

                    case "upgrade-session":
                        this.DoReceiveReferInfo(doc, contact);
                        return;

                    case "action":
                        this.DoReceiveActionInfo(doc, contact);
                        return;

                    case "share-content":
                        break;

                    default:
                        return;
                }
                this.DoReceiveShareContentInfo(doc, contact);
            }
            catch (Exception exception)
            {
                ClientLogger.WriteException(exception);
            }
            finally
            {
                this.AsyncSendResponse(req);
            }
        }

        internal void DoReceiveInite(SipRequest req)
        {
            this.IsBeInvite = true;
            SipInviteResponse msg = new SipInviteResponse(req);
            msg.Message.AddHeader(new SipcFromHeader(this.To));
            foreach (SipcHeader header in req.Message.GetHeaders("K"))
            {
                if (header.Value == "text/html-fragment")
                {
                    if (!this.IsMulitiConversation)
                    {
                        this.ContentType = MessageContentType.HtmlFragment;
                    }
                    msg.Message.AddHeader(new SipcSupportedHeader("text/html-fragment"));
                }
                else if (header.Value == "text/plain")
                {
                    msg.Message.AddHeader(new SipcSupportedHeader("text/plain"));
                }
                else if (header.Value == "multiparty")
                {
                    this.AllowMultiparty = true;
                    msg.Message.AddHeader(new SipcSupportedHeader("multiparty"));
                }
                else if (header.Value == "nudge")
                {
                    this.OtherSupportNudge = true;
                    msg.Message.AddHeader(new SipcSupportedHeader("nudge"));
                }
            }
            msg.Message.Body = this.GetInviteSDP();
            msg.AckReceived += new EventHandler<SipAckReceivedEventArgs>(this, (IntPtr) this.<DoReceiveInite>b__13);
            msg.WaitAckTimeout += delegate {
                this.Status = DialogStatus.None;
            };
            msg.SendMessageFailed += new EventHandler<FailedEventArgs>(this, (IntPtr) this.<DoReceiveInite>b__15);
            base.SendSipMessage(msg);
        }

        internal virtual void DoReceiveMessage(SipRequest req)
        {
            if ((this.Status == DialogStatus.Invited) && (req.Message.CallId.CallId == this.CallId))
            {
                if (req.Message.CSeq.Number > this._lastReceiveCesq)
                {
                    this._lastReceiveCesq = req.Message.CSeq.Number;
                }
                else
                {
                    ClientLogger.WriteGeneral("会话中收到消息的Cesq小于之前的Cesq", req.Message.ToString(), 20);
                }
            }
            if (base.Owner.Status == UserAccountStatus.Logon)
            {
                this.AsyncSendResponse(req);
                Imps.Client.Core.Contact messageContact = this.GetMessageContact(req);
                if ((messageContact != null) && this.CanReceiveContactMessage(messageContact))
                {
                    Message msg = this.GetReceiveMsg(req, messageContact);
                    this.DoFindConversationWindow(messageContact, msg);
                    this.RaiseMessageReceived(new MessageEventArgs(msg));
                    this.DoAutoReplay(req);
                    this.DoSaveMessage(msg);
                    this.DoAddChatFriend(messageContact);
                    this.UpdateRecentBuddies();
                    this.DoCCToSms(req, messageContact);
                }
            }
        }

        internal void DoReceiveMessageRequest(SipRequest req)
        {
            lock (this.recvSyncRoot)
            {
                if (!this.IsClosed)
                {
                    this._receiveRequestEvent.WaitOne(0x1388, true);
                    switch (req.Message.Method)
                    {
                        case "B":
                            this.DoReceiveBye(req);
                            break;

                        case "C":
                            this.DoReceiveCancel(req);
                            break;

                        case "M":
                            this.DoReceiveMessage(req);
                            break;

                        case "N":
                            this.DoReceiveNotify(req);
                            break;

                        case "BN":
                            this.DoReceiveBeNotify(req);
                            break;

                        case "IN":
                            this.DoReceiveInfo(req);
                            break;

                        case "O":
                            this.DoReceiveOptions(req);
                            break;
                    }
                }
            }
        }

        private void DoReceiveNotify(SipRequest req)
        {
            this.AsyncSendResponse(req);
            this.DoReceiveBeNotify(req);
        }

        private void DoReceiveOptions(SipRequest req)
        {
            foreach (SipcHeader header in req.Message.GetHeaders("K"))
            {
                switch (header.Value)
                {
                    case "ShareContent":
                        this.DoReceiveShareContentOption(req);
                        return;

                    case "SaveHistory":
                    case "DisableSaveHistory":
                        this.DoReceiveSaveHistoryResponse(req);
                        return;
                }
            }
            bool flag = false;
            bool flag2 = false;
            foreach (SipcHeader header2 in req.Message.GetHeaders("K"))
            {
                switch (header2.Value)
                {
                    case "text/html-fragment":
                        flag = true;
                        break;

                    case "text/plain":
                        flag2 = true;
                        break;
                }
            }
            if (!flag && !flag2)
            {
                foreach (SipcHeader header3 in req.Message.GetHeaders("RQ"))
                {
                    string text3;
                    if (((text3 = header3.Value) != null) && ((text3 == "SaveHistory") || (text3 == "DisableSaveHistory")))
                    {
                        this.DoReceiveSaveHistoryOption(req);
                        return;
                    }
                }
                SipResponse msg = base.Owner.CreateSipResponse(req, 420, "Bad Extension");
                base.SendSipMessage(msg);
            }
            else
            {
                SipResponse response = base.CreateSipResponse(req);
                if (flag)
                {
                    this.ContentType = MessageContentType.HtmlFragment;
                    response.Message.AddHeader(new SipcSupportedHeader("text/html-fragment"));
                }
                else
                {
                    this.ContentType = MessageContentType.TextPlain;
                }
                if (flag2)
                {
                    response.Message.AddHeader(new SipcSupportedHeader("text/plain"));
                }
                base.SendSipMessage(response);
            }
        }

        private void DoReceiveReferInfo(XmlDocument doc, Imps.Client.Core.Contact contact)
        {
            if (!this.IsMulitiConversation)
            {
                XmlNodeList childNodes = doc.DocumentElement.ChildNodes[0].ChildNodes;
                if (childNodes.Count > 0)
                {
                    List<Imps.Client.Core.Contact> contacts = new List<Imps.Client.Core.Contact>();
                    for (int i = 0; i < childNodes.Count; i++)
                    {
                        Imps.Client.Core.Contact contact2 = base.Owner.ContactList.FindOrCreateContact(childNodes[i].Attributes[0].Value, this.BizOperation);
                        contacts.Add(contact2);
                    }
                    this.AsyncInviteParticipants(contacts);
                }
            }
        }

        private void DoReceiveSaveHistoryOption(SipRequest req)
        {
            Imps.Client.Core.Contact messageContact = this.GetMessageContact(req);
            if (messageContact != null)
            {
                if (req.Message.RequireHeader.Value == "DisableSaveHistory")
                {
                    SipResponse msg = base.CreateSipResponse(req);
                    msg.Message.Headers.Add(new SipcSupportedHeader("DisableSaveHistory"));
                    this.EnableSaveHistory = false;
                    base.SendSipMessage(msg);
                }
                else if (req.Message.RequireHeader.Value == "SaveHistory")
                {
                    if (!this.IsMulitiConversation)
                    {
                        this.AsyncSendResponse(0xca, "Accepted", req);
                    }
                    this.RaiseEnableSaveHistoryByContact(new EnableSaveMessageEventArgs(messageContact));
                }
            }
        }

        private void DoReceiveSaveHistoryResponse(SipRequest req)
        {
            Imps.Client.Core.Contact messageContact = this.GetMessageContact(req);
            if (messageContact != null)
            {
                this.HasSetEnableSaveMessage = false;
                if (req.Message.SupportedHeader.Value == "DisableSaveHistory")
                {
                    this.EnableSaveHistory = false;
                    string content = string.Format(StringTable.Conversation.MsgContactStopSaveMessage, messageContact.DisplayName);
                    Message msg = new EnableSaveHistoryMessage(this, content);
                    this.RaiseMessageReceived(new MessageEventArgs(msg));
                }
                else if (req.Message.SupportedHeader.Value == "SaveHistory")
                {
                    this.EnableSaveHistory = true;
                }
            }
        }

        private void DoReceiveShareContent(XmlDocument doc, Imps.Client.Core.Contact contact)
        {
            if (contact.IsBlocked)
            {
                return;
            }
            XmlNode documentElement = doc.DocumentElement;
            ShareContentTransmitType transmittype = (ShareContentTransmitType) Enum.Parse(typeof(ShareContentTransmitType), documentElement.ChildNodes[0].Attributes["type"].Value, true);
            string text = string.Empty;
            string id = string.Empty;
            string text3 = string.Empty;
            bool flag = false;
            XmlAttribute attribute = documentElement.ChildNodes[0].Attributes["session-id"];
            if (attribute != null)
            {
                text = attribute.Value;
            }
            int size = int.Parse(documentElement.ChildNodes[1].Attributes["size"].Value);
            string remoteUri = documentElement.ChildNodes[1].Attributes["url"].Value;
            string path = documentElement.ChildNodes[1].Attributes["name"].Value;
            if (documentElement.ChildNodes[1].Attributes["id"] != null)
            {
                id = documentElement.ChildNodes[1].Attributes["id"].Value;
            }
            if (documentElement.ChildNodes[1].Attributes["md5"] != null)
            {
                text3 = documentElement.ChildNodes[1].Attributes["md5"].Value;
            }
            if (documentElement.ChildNodes[1].Attributes["p2ptorelay"] != null)
            {
                flag = documentElement.ChildNodes[1].Attributes["p2ptorelay"].Value == "1";
            }
            string innerText = string.Empty;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -