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

📄 contactlist.cs

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

        public bool AsyncGetContactsInfo(ContactCollection contacts, AsyncBizOperation op, string mobileDeviceAttrs, bool getInfoWithCurrentVersion, params string[] contactInfoItems)
        {
            if ((contacts == null) || (contacts.Count == 0))
            {
                if (op != null)
                {
                    op.FireSuccessedInUiThread(EventArgs.Empty);
                }
                return true;
            }
            if (op == null)
            {
                op = new AsyncBizOperation();
            }
            ContactCollection noRepeatContacts = new ContactCollection();
            lock (contacts.SyncRoot)
            {
                using (IEnumerator<Imps.Client.Core.Contact> enumerator = contacts.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        Imps.Client.Core.Contact item = enumerator.get_Current();
                        if (item.EnableGetContactInfo && (noRepeatContacts[item.Uri] == null))
                        {
                            noRepeatContacts.Add(item);
                        }
                    }
                }
            }
            string contactAttrs = string.Empty;
            if ((contactInfoItems != null) && (contactInfoItems.Length != 0))
            {
                foreach (string text in contactInfoItems)
                {
                    if (contactAttrs.Length > 0)
                    {
                        contactAttrs = contactAttrs + ";";
                    }
                    contactAttrs = contactAttrs + text;
                }
            }
            if (string.IsNullOrEmpty(contactAttrs))
            {
                contactAttrs = "all";
            }
            op.ContextForBiz = contactAttrs;
            SipRequestEx req = base.Owner.CreateSipRequestEx("S", op);
            req.Message.AddHeader(new SipcEventHeader("GetContactsInfo"));
            req.Context = op;
            StringWriter tw = new StringWriter();
            XmlHelper.CreateXmlWriterForSipRequest(tw, null, delegate (XmlWriter writer, object context) {
                writer.WriteStartElement("contacts");
                writer.WriteAttributeString("attributes", contactAttrs);
                writer.WriteAttributeString("extended-attributes", "score-level");
                if (!string.IsNullOrEmpty(mobileDeviceAttrs))
                {
                    writer.WriteAttributeString("mobile-device-attrs", mobileDeviceAttrs);
                }
                using (IEnumerator<Imps.Client.Core.Contact> enumerator = noRepeatContacts.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        Imps.Client.Core.Contact contact = enumerator.get_Current();
                        writer.WriteStartElement("contact");
                        writer.WriteAttributeString("uri", contact.Uri.Raw);
                        if (getInfoWithCurrentVersion && !string.IsNullOrEmpty(contact.PersonalInfo.Version))
                        {
                            writer.WriteAttributeString("version", contact.PersonalInfo.Version);
                        }
                        writer.WriteEndElement();
                    }
                }
                writer.WriteEndElement();
            });
            req.Message.Body = tw.ToString();
            tw.Dispose();
            ErrorHelper.HandleSendRequestErrorAndTimeout(req);
            req.FinalResponseReceived += new EventHandler<SipResponseReceivedEventArgs>(this, (IntPtr) this.finalResponseReceived_AsyncGetContactsInfo);
            base.Owner.SendSipMessage(req);
            return true;
        }

        internal bool AsyncGetContactsInfoBatchAll(AsyncBizOperation op)
        {
            return this.AsyncGetContactsInfoBatchAll(this.Contacts, op, new string[] { "provisioning", "impresa", "mobile-no", "nickname", "name", "gender", "portrait-crc", "ivr-enabled" });
        }

        internal bool AsyncGetContactsInfoBatchAll(ContactCollection srcContacts, AsyncBizOperation op, params string[] properties)
        {
            EventHandler<ImpsErrorEventArgs> handler = null;
            EventHandler handler2 = null;
            try
            {
                if (srcContacts.Count == 0)
                {
                    if (op != null)
                    {
                        op.FireSuccessedInUiThread(EventArgs.Empty);
                    }
                    return true;
                }
                ContactCollection contacts = new ContactCollection();
                lock (srcContacts.SyncRoot)
                {
                    using (IEnumerator<Imps.Client.Core.Contact> enumerator = srcContacts.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            Imps.Client.Core.Contact item = enumerator.get_Current();
                            if (!item.BeenGetContactInfo)
                            {
                                contacts.Add(item);
                                item.BeenGetContactInfo = true;
                                if (contacts.Count >= 20)
                                {
                                    goto Label_00AE;
                                }
                            }
                        }
                    }
                }
            Label_00AE:
                if (contacts.Count == 0)
                {
                    if (op != null)
                    {
                        op.FireSuccessedInUiThread(EventArgs.Empty);
                    }
                    return true;
                }
                AsyncBizOperation operation = new AsyncBizOperation();
                if (handler == null)
                {
                    <>c__DisplayClass2c classc;
                    handler = new EventHandler<ImpsErrorEventArgs>(classc, (IntPtr) this.<AsyncGetContactsInfoBatchAll>b__28);
                }
                operation.ImpsError += handler;
                if (handler2 == null)
                {
                    handler2 = delegate {
                        if (this.Owner.Status == UserAccountStatus.Logon)
                        {
                            this.AsyncGetContactsInfoBatchAll(op);
                        }
                    };
                }
                operation.Successed += handler2;
                this.AsyncGetContactsInfo(contacts, operation, null, true, properties);
                return true;
            }
            catch (Exception exception)
            {
                ClientLogger.WriteException(exception);
                return false;
            }
        }

        public void AsyncGetUri(long sid, AsyncBizOperation op)
        {
            op.ContextForBiz = sid.ToString();
            ThreadPool.QueueUserWorkItem(new WaitCallback(this.GetUriInThread), op);
        }

        public void AsyncGetUserSetContactsInfo(ContactCollection contacts, bool getWithVersion, AsyncBizOperation op)
        {
            if (contacts.Count != 0)
            {
                ContactCollection noRepeatContacts = new ContactCollection();
                using (IEnumerator<Imps.Client.Core.Contact> enumerator = contacts.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        Imps.Client.Core.Contact item = enumerator.get_Current();
                        if ((item.Type != ContactType.Vodafone) && (noRepeatContacts.FindContact(item.Uri.Raw) == null))
                        {
                            noRepeatContacts.Add(item);
                        }
                    }
                }
                SipRequest req = base.Owner.CreateSipRequest("S");
                req.Message.AddHeader(new SipcEventHeader("GetLocalContactsInfo"));
                req.Context = op;
                StringWriter tw = new StringWriter();
                XmlHelper.CreateXmlWriterForSipRequest(tw, null, delegate (XmlWriter writer, object context) {
                    writer.WriteStartElement("contacts");
                    writer.WriteAttributeString("attributes", "all");
                    using (IEnumerator<Imps.Client.Core.Contact> enumerator = noRepeatContacts.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            Imps.Client.Core.Contact contact = enumerator.get_Current();
                            writer.WriteStartElement("contact");
                            writer.WriteAttributeString("uri", contact.Uri.Raw);
                            if ((getWithVersion && !string.IsNullOrEmpty(contact.PersonalInfo.UserSetVersion)) && (contact.PersonalInfo.UserSetVersion != "0"))
                            {
                                writer.WriteAttributeString("version", contact.PersonalInfo.UserSetVersion);
                            }
                            writer.WriteEndElement();
                        }
                    }
                    writer.WriteEndElement();
                });
                req.Message.Body = tw.ToString();
                tw.Dispose();
                ErrorHelper.HandleSendRequestErrorAndTimeout(req);
                req.FinalResponseReceived += new EventHandler<SipResponseReceivedEventArgs>(this, (IntPtr) this.finalResponseReceived_GetUserSetContactsInfo);
                base.Owner.SendSipMessage(req);
            }
        }

        public void AsyncGetUserSetContactsInfo(ContactCollection contacts, bool getWithVersion, AsyncBizOperation op, params string[] attr)
        {
            if (contacts.Count != 0)
            {
                ContactCollection contacts2 = new ContactCollection();
                using (IEnumerator<Imps.Client.Core.Contact> enumerator = contacts.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        Imps.Client.Core.Contact item = enumerator.get_Current();
                        if ((item.Type != ContactType.Vodafone) && (contacts2.FindContact(item.Uri.Raw) == null))
                        {
                            contacts2.Add(item);
                        }
                    }
                }
                SipRequest req = base.Owner.CreateSipRequest("S");
                req.Message.AddHeader(new SipcEventHeader("GetLocalContactsInfo"));
                req.Context = op;
                string attrs = string.Empty;
                foreach (string text2 in attr)
                {
                    if (attrs.Length > 0)
                    {
                        attrs = attrs + ";";
                    }
                    attrs = attrs + text2;
                }
                req.Message.Body = generateGetUserSetContactsInfoString(contacts2, getWithVersion, attrs);
                ErrorHelper.HandleSendRequestErrorAndTimeout(req);
                req.FinalResponseReceived += new EventHandler<SipResponseReceivedEventArgs>(this, (IntPtr) this.finalResponseReceived_GetUserSetContactsInfo);
                base.Owner.SendSipMessage(req);
            }
        }

        public bool AsyncHandleContactRequest(string uri, int result, bool? isBlock, int? targetGroupId, bool requestByMobile, string localName, AsyncBizOperation op)
        {
            localName = localName.Trim();
            if (!new IicUri(uri).IsValid)
            {
                LogHelper.LogFatalError("Uri不合法");
                return false;
            }
            if (((result != 0) && (result != 1)) && (result != 2))
            {
                LogHelper.LogFatalError("result参数不合法");
                return false;
            }
            if ((result == 0) && !isBlock.get_HasValue())
            {
                isBlock = false;
            }
            SipRequest req = base.Owner.CreateSipRequest("S");
            req.Message.AddHeader(new SipcEventHeader("HandleContactRequest"));
            req.Context = op;
            StringWriter tw = new StringWriter();
            XmlHelper.CreateXmlWriterForSipRequest(tw, null, delegate (XmlWriter writer, object context) {
                writer.WriteStartElement("contacts");
                writer.WriteStartElement("buddies");
                writer.WriteStartElement("buddy");
                writer.WriteAttributeString("uri", uri);
                writer.WriteAttributeString("result", result.ToString());
                if (result == 1)
                {
                    writer.WriteAttributeString("buddy-lists", targetGroupId.ToString());
                    writer.WriteAttributeString("expose-mobile-no", requestByMobile ? "1" : "0");
                    writer.WriteAttributeString("expose-name", requestByMobile ? "1" : "0");
                    if (localName.Length > 0)

⌨️ 快捷键说明

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