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

📄 user.cs

📁 破解的飞信源代码
💻 CS
📖 第 1 页 / 共 5 页
字号:

        private void KeepLogonTimer_Tick(object sender, EventArgs e)
        {
            if (this.Status == UserAccountStatus.Logon)
            {
                this.AsyncSipcKeepLogon();
            }
        }

        private void KeepSsiLogonTimer_Tick(object sender, EventArgs e)
        {
            if (this.Status == UserAccountStatus.Logon)
            {
                this.AsyncSsiKeepLogon();
            }
        }

        internal void LoadServicesNode(XmlNode servcieNode)
        {
            foreach (XmlNode node in servcieNode.ChildNodes)
            {
                string serviceId = string.Empty;
                string name = string.Empty;
                string description = string.Empty;
                foreach (XmlAttribute attribute in node.Attributes)
                {
                    switch (attribute.Name)
                    {
                        case "id":
                        {
                            serviceId = attribute.Value;
                            continue;
                        }
                        case "name":
                        {
                            name = attribute.Value;
                            continue;
                        }
                        case "desc":
                            break;

                        default:
                        {
                            continue;
                        }
                    }
                    description = attribute.Value;
                }
                if (((serviceId != "FriendMatching") && (Imps.Client.Core.FixedClientSetting.Instance.SupportVodafone || (serviceId != "VodafoneFederation"))) && !string.IsNullOrEmpty(serviceId))
                {
                    if (string.IsNullOrEmpty(name))
                    {
                        name = this.GetExServiceName(serviceId);
                    }
                    if (!string.IsNullOrEmpty(name))
                    {
                        if (this.SubscribedServices.ContainsKey(serviceId))
                        {
                            this.SubscribedServices.get_Item(serviceId);
                            this.ChangeExServiceStatus(serviceId, true);
                            continue;
                        }
                        this.SubscribedServices.Add(serviceId, new ImpsService(serviceId, name, description, true));
                    }
                }
            }
            this.ServiceVersion = XmlHelper.ReadXmlAttributeString(servcieNode, "version", false);
        }

        private void reqChangePassword_FinalResponseReceived(object sender, SipResponseReceivedEventArgs e)
        {
            SipResponse resp = e.Response;
            AsyncBizOperation operation = resp.Request.Context as AsyncBizOperation;
            string s = operation.ContextForBiz as string;
            if (resp.IsOK)
            {
                s = this.HashPassword(Encoding.UTF8.GetBytes(s));
                this.Password = s;
                this.CurrentAccount.Password = s;
                if (UserAccounts.LastestAccount != null)
                {
                    UserAccounts.LastestAccount.Password = s;
                }
                operation.FireSuccessedInUiThread(EventArgs.Empty);
            }
            else
            {
                ErrorHelper.HandleReceivedErrorResponse(resp);
            }
        }

        internal void SendSipMessage(SipMessageBase msg)
        {
            ISipConnection sipConnection = this.SipConnection;
            if (sipConnection != null)
            {
                sipConnection.Send(msg);
            }
            else
            {
                SipMessageHelper.RaiseSendMessageFailed(msg, null, StringTable.ClientCommLayerString.ConnectionClosed, null);
            }
        }

        private void SipConnection_ConnectFailed(object sender, FailedEventArgs e)
        {
            LogHelper.LogException(e.FailedException);
            if (this.Status != UserAccountStatus.Disconnected)
            {
                this.DoLoginFailed(new ImpsErrorEventArgs(e.Explain, 0x7d4));
            }
        }

        private void SipConnection_RequestReceived(object sender, SipRequestReceivedEventArgs e)
        {
            try
            {
                SipRequest req = e.Request;
                if (req.Message.Method == "N")
                {
                    SipResponse msg = this.CreateSipResponse(req);
                    this.SendSipMessage(msg);
                }
                if (!this.HandleReceiveRequest(e.Request))
                {
                    if (this.Status == UserAccountStatus.Logon)
                    {
                        this.InnerFireSipRequestReceived(e);
                    }
                    else
                    {
                        lock (this._syncObjPendingSipRequestReceived)
                        {
                            this.InnerPendingSipRequestReceived.Add(e);
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                ClientLogger.WriteException(exception);
            }
        }

        private void SipConnection_SendFailed(object sender, SendFailedEventArgs e)
        {
            LogHelper.LogSendSipMessageFailed(e.SipMessage, e.Explain, e.FailedException);
        }

        private void SipConnection_StateChanged(object sender, StateChangedEventArgs e)
        {
            if (this.SipConnection != null)
            {
                ConnectionState newState = e.NewState;
                UserAccountStatus status = this.Status;
                try
                {
                    switch (newState)
                    {
                        case ConnectionState.Disconnecting:
                            break;

                        case ConnectionState.Disconnected:
                            if ((status != UserAccountStatus.Loginning) || !this.IsRetryPreLoggin)
                            {
                                break;
                            }
                            this.Status = UserAccountStatus.WaitReconnect;
                            return;

                        case ConnectionState.Connected:
                            return;

                        default:
                            return;
                    }
                    if (status == UserAccountStatus.Logon)
                    {
                        this.Status = UserAccountStatus.Disconnected;
                        this.ClearSsiCredential();
                    }
                }
                catch (Exception exception)
                {
                    LogHelper.LogException(exception);
                }
                finally
                {
                    ClientLogger.WriteLogin("连接状态改变", 0, string.Format("Connection state: {0} -> {1}; User status: {2} -> {3}", new object[] { e.OldState, e.NewState, status, this.Status }), 0);
                }
            }
        }

        private void StartAsyncLogin(object state)
        {
            try
            {
                new LoginFramework(this).Login();
            }
            catch (Exception exception)
            {
                ClientLogger.WriteException("登录失败", exception);
            }
        }

        internal string ToServiceNodeXml()
        {
            StringBuilder builder = new StringBuilder();
            Dictionary<string, ImpsService>.KeyCollection.Enumerator enumerator = this.SubscribedServices.get_Keys().GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    string text = enumerator.get_Current();
                    ImpsService service = this.SubscribedServices.get_Item(text);
                    if (service.Subscribed)
                    {
                        builder.Append(string.Format("<service id=\"{0}\" name=\"{1}\" desc=\"{2}\"/>", service.ID, service.Name, service.Description));
                    }
                }
            }
            finally
            {
                enumerator.Dispose();
            }
            return builder.ToString();
        }

        internal static void TryCallReceiveMessageOnOp(AsyncBizOperation op)
        {
            if ((op != null) && (op.MultiMessageReceiver != null))
            {
                op.MultiMessageReceiver.ReceiveMessage();
            }
        }

        private bool TryDoSsiSignin()
        {
            try
            {
                HttpWebRequest req = null;
                this.DoSsiSignin(ref req);
                return true;
            }
            catch
            {
                return false;
            }
        }

        public Imps.Client.Core.AdManager AdManager
        {
            get
            {
                return this._mgrAd;
            }
        }

        public bool AsLogon
        {
            get
            {
                return IsAsLogon(this._status);
            }
        }

        public bool AutoLogin
        {
            get
            {
                return this._autoLogin;
            }
            set
            {
                this._autoLogin = value;
                if (value)
                {
                    this._loginCancelled = false;
                }
            }
        }

        internal bool BeenSubscribedPresence
        {
            get
            {
                return (this._subscribePresenceOK || this._beenSubscribed);
            }
            set
            {
                this._beenSubscribed = value;
            }
        }

        public Imps.Client.Core.BlackList BlackList
        {
            get
            {
                return this._blackList;
            }
        }

        public Imps.Client.Core.Configuration Configuration
        {
            get
            {
                return this._config;
            }
        }

        public Imps.Client.Core.ContactList ContactList
        {
            get
            {
                return this._contactList;
            }
        }

        public Imps.Client.Core.ConversationManager ConversationManager
        {
            get
            {
                if (this._convMgr == null)
                {
                    this._convMgr = new Imps.Client.Core.ConversationManager(this);
                }
                return this._convMgr;
            }
        }

        public UserAccounts.AccountData CurrentAccount
        {
            get
            {
                return this._currentAc

⌨️ 快捷键说明

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