📄 contactinfo.cs
字号:
return;
}
this._owner.Owner.FireImpsErrorInUiThread(new ImpsErrorEventArgs(StringTable.ContactProfile.GetUserSetContactInfoFailed), op);
}
else
{
XmlDocument document = new XmlDocument();
document.LoadXml(sipMsg.Message.Body);
XmlNode node = document.DocumentElement.SelectSingleNode("contacts");
if (node == null)
{
LogHelper.LogReceivedSipMessage(sipMsg);
this._owner.Owner.FireImpsErrorInUiThread(new ImpsErrorEventArgs(StringTable.ContactProfile.GetUserSetContactInfoFailed), op);
}
else
{
XmlNode node2 = node.SelectSingleNode("contact");
if (node2 == null)
{
LogHelper.LogReceivedSipMessage(sipMsg);
this._owner.Owner.FireImpsErrorInUiThread(new ImpsErrorEventArgs(StringTable.ContactProfile.UpdateProfileFailed), op);
}
else
{
string text = XmlHelper.ReadXmlAttributeString(node2, "version");
if (text.Length <= 0)
{
LogHelper.LogReceivedSipMessage(sipMsg);
this._owner.Owner.FireImpsErrorInUiThread(new ImpsErrorEventArgs(StringTable.ContactProfile.GetUserSetContactInfoFailed), op);
}
else
{
string uriStr = XmlHelper.ReadXmlAttributeString(node2, "uri");
if (this.OwnerUri.CompareTo(uriStr) != 0)
{
LogHelper.LogReceivedSipMessage(sipMsg);
this._owner.Owner.FireImpsErrorInUiThread(new ImpsErrorEventArgs(StringTable.ContactProfile.UpdateProfileFailed), op);
}
else
{
this.LoadUserSetXmlNode(node2);
this.UserSetVersion = text;
this.Owner.Owner.ContactList.SaveContactListXml();
}
}
}
}
}
}
}
private static string GetDisplayNameFromUri(IicUri uri)
{
if (uri.Belongs(IicUriType.Sip))
{
return uri.Sid.ToString();
}
if ((uri.Type & IicUriType.Tel) != IicUriType.Unknown)
{
return uri.MobileNo;
}
return uri.ToString();
}
public static bool HasPropertyUserSet<T>(ContactInfoItem<T> property, T defaultVal)
{
if (!property.HasUserSetData)
{
return false;
}
return !object.Equals(property.UserSetData.OriginalValue, defaultVal);
}
internal void LoadContactSetXmlNode(XmlNode personalNode, DownloadPortraitPriority priority, string requestedProperties)
{
if (personalNode != null)
{
Suspender suspender = new Suspender(this);
try
{
if (!string.IsNullOrEmpty(requestedProperties))
{
if (requestedProperties == "all")
{
if (this.OwnerUri.Belongs(IicUriType.Sip))
{
base.MobileNo = string.Empty;
}
this.Name = this.Name.CloneWithContactSetValue(string.Empty);
this.BirthDate = this.BirthDate.CloneWithContactSetValue(PersonalInfoBase.NullBirthDate);
this.IsBirthdayValid = this.IsBirthdayValid.CloneWithContactSetValue(false);
this.WorkEmail = this.WorkEmail.CloneWithContactSetValue(string.Empty);
this.PersonalEmail = this.PersonalEmail.CloneWithContactSetValue(string.Empty);
this.OtherEmail = this.OtherEmail.CloneWithContactSetValue(string.Empty);
this.PrimaryEmail = this.PrimaryEmail.CloneWithContactSetValue(0);
this.HomePhone = this.HomePhone.CloneWithContactSetValue(string.Empty);
this.WorkPhone = this.WorkPhone.CloneWithContactSetValue(string.Empty);
this.OtherPhone = this.OtherPhone.CloneWithContactSetValue(string.Empty);
this.Company = this.Company.CloneWithContactSetValue(string.Empty);
this.CompanyWebsite = this.CompanyWebsite.CloneWithContactSetValue(string.Empty);
this.JobTitle = this.JobTitle.CloneWithContactSetValue(string.Empty);
}
else
{
if (!requestedProperties.StartsWith(";"))
{
requestedProperties = ";" + requestedProperties;
}
if (!requestedProperties.EndsWith(";"))
{
requestedProperties = requestedProperties + ";";
}
if (requestedProperties.Contains(";name;"))
{
this.Name = this.Name.CloneWithContactSetValue(string.Empty);
}
if (requestedProperties.Contains(";birth-date;"))
{
this.BirthDate = this.BirthDate.CloneWithContactSetValue(PersonalInfoBase.NullBirthDate);
}
if (requestedProperties.Contains(";birthday-valid;"))
{
this.IsBirthdayValid = this.IsBirthdayValid.CloneWithContactSetValue(false);
}
if (requestedProperties.Contains(";work-email;"))
{
this.WorkEmail = this.WorkEmail.CloneWithContactSetValue(string.Empty);
}
if (requestedProperties.Contains(";personal-email;"))
{
this.PersonalEmail = this.PersonalEmail.CloneWithContactSetValue(string.Empty);
}
if (requestedProperties.Contains(";other-email;"))
{
this.OtherEmail = this.OtherEmail.CloneWithContactSetValue(string.Empty);
}
if (requestedProperties.Contains(";primary-email;"))
{
this.PrimaryEmail = this.PrimaryEmail.CloneWithContactSetValue(0);
}
if (requestedProperties.Contains(";home-phone;"))
{
this.HomePhone = this.HomePhone.CloneWithContactSetValue(string.Empty);
}
if (requestedProperties.Contains(";work-phone;"))
{
this.WorkPhone = this.WorkPhone.CloneWithContactSetValue(string.Empty);
}
if (requestedProperties.Contains(";other-phone;"))
{
this.OtherPhone = this.OtherPhone.CloneWithContactSetValue(string.Empty);
}
if (requestedProperties.Contains(";company;"))
{
this.Company = this.Company.CloneWithContactSetValue(string.Empty);
}
if (requestedProperties.Contains(";company-website;"))
{
this.CompanyWebsite = this.Company.CloneWithContactSetValue(string.Empty);
}
if (requestedProperties.Contains(";job-title;"))
{
this.JobTitle = this.JobTitle.CloneWithContactSetValue(string.Empty);
}
}
}
string text = string.Empty;
string nicknameGuest = string.Empty;
DateTime nullBirthDate = PersonalInfoBase.NullBirthDate;
short num = 0;
int num2 = 0;
foreach (XmlAttribute attribute in personalNode.Attributes)
{
switch (attribute.Name)
{
case "provisioning":
{
if (int.TryParse(attribute.Value, ref num2))
{
this.Provision = num2;
}
continue;
}
case "nickname":
if (!string.Equals(StringTable.PersonalInfo.NicknameGuest, attribute.Value))
{
break;
}
this.Nickname = this.Nickname.CloneWithContactSetValue(StringTable.PersonalInfo.NicknameGuest);
goto Label_05F9;
case "name":
if (!string.Equals(StringTable.PersonalInfo.NicknameGuest, attribute.Value))
{
goto Label_061F;
}
nicknameGuest = StringTable.PersonalInfo.NicknameGuest;
goto Label_0627;
case "mobile-no":
{
text = attribute.Value;
if (!string.IsNullOrEmpty(text) || !this.OwnerUri.Belongs(IicUriType.Tel))
{
goto Label_067C;
}
base.MobileNo = this.OwnerUri.MobileNo;
continue;
}
case "impresa":
{
this.Owner.Presence.MoodPhrase = StringHelper.ReplaceCrLfToSpace(attribute.Value);
continue;
}
case "portrait-crc":
{
base.PortraitCrc = attribute.Value;
this.OwnerUser.PortraitDownloader.AsyncGetPortrait(this, priority);
continue;
}
case "gender":
{
this.Gender = EnumHelper.IntStrToEnum<Imps.Common.Gender>(attribute.Value);
continue;
}
case "birth-date":
{
try
{
DateTime.TryParse(attribute.Value, ref nullBirthDate);
this.BirthDate = this.BirthDate.CloneWithContactSetValue(nullBirthDate);
}
catch
{
}
continue;
}
case "birthday-valid":
{
this.IsBirthdayValid = this.IsBirthdayValid.CloneWithContactSetValue(attribute.Value == "1");
continue;
}
case "nation":
{
this.UserNationality = this.UserNationality.CloneWithContactSetValue(attribute.Value);
continue;
}
case "province":
{
this.Province = this.Province.CloneWithContactSetValue(attribute.Value);
continue;
}
case "city":
{
if (int.TryParse(attribute.Value, ref num2))
{
this.City = this.City.CloneWithContactSetValue(num2);
}
continue;
}
case "profile":
{
this.Notes = this.Notes.CloneWithContactSetValue(attribute.Value);
continue;
}
case "lunar-animal":
{
this.LunarAnimal = EnumHelper.IntStrToEnum<Imps.Common.LunarAnimal>(attribute.Value);
continue;
}
case "horoscope":
{
this.Horoscope = EnumHelper.IntStrToEnum<Imps.Common.Horoscope>(attribute.Value);
continue;
}
case "blood-type":
{
this.BloodType = this.BloodType.CloneWithContactSetValue(EnumHelper.IntStrToEnum<Imps.Common.BloodType>(attribute.Value));
continue;
}
case "occupation":
{
if (int.TryParse(attribute.Value, ref num2))
{
this.Occupation = this.Occupation.CloneWithContactSetValue(num2);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -