-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add - doc - Added support for agents in vCard 2.1, 3.0, and 5.0
--- We've added support for contact agents that take a string containing vCard content for each agent to vCard 2.1, 3.0, and 5.0 parsers. The content must follow the rules of parsing vCard files in the VisualCard way (versions must be specified inline or not, multiple contacts may use different vCard versions, ...) in order to parse successfully. --- Type: add Breaking: False Doc Required: True Part: 1/1
- Loading branch information
Showing
8 changed files
with
330 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,6 +91,7 @@ public override Card Parse() | |
List<TimeZoneInfo> _timezones = []; | ||
List<GeoInfo> _geos = []; | ||
List<ImppInfo> _impps = []; | ||
List<AgentInfo> _agents = []; | ||
List<XNameInfo> _xes = []; | ||
|
||
// Name and Full Name specifiers are required | ||
|
@@ -211,6 +212,7 @@ public override Card Parse() | |
} | ||
|
||
// Label (LABEL;TYPE=dom,home,postal,parcel:Mr.John Q. Public\, Esq.\nMail Drop: TNE QB\n123 Main Street\nAny Town\, CA 91921 - 1234\nU.S.A.) | ||
// ALTID is supported. | ||
if (_value.StartsWith(VcardConstants._labelSpecifier + delimiter)) | ||
{ | ||
if (isWithType) | ||
|
@@ -219,6 +221,16 @@ public override Card Parse() | |
_labels.Add(LabelAddressInfo.FromStringVcardFive(_value, altId)); | ||
} | ||
|
||
// Agent (AGENT:BEGIN:VCARD\nFN:Joe Friday\nTEL:+1...) | ||
// ALTID is supported. | ||
if (_value.StartsWith(VcardConstants._agentSpecifier + delimiter)) | ||
{ | ||
if (isWithType) | ||
_agents.Add(AgentInfo.FromStringVcardFiveWithType(_value, finalArgs, altId)); | ||
else | ||
_agents.Add(AgentInfo.FromStringVcardFive(_value, altId)); | ||
} | ||
|
||
// Email (EMAIL;TYPE=HOME,INTERNET:[email protected]) | ||
// ALTID is supported. | ||
if (_value.StartsWith(VcardConstants._emailSpecifier + delimiter)) | ||
|
@@ -530,6 +542,7 @@ public override Card Parse() | |
ContactTelephones = [.. _telephones], | ||
ContactAddresses = [.. _addresses], | ||
ContactLabels = [.. _labels], | ||
ContactAgents = [.. _agents], | ||
ContactOrganizations = [.. _orgs], | ||
ContactTitles = [.. _titles], | ||
ContactURL = _url, | ||
|
@@ -588,6 +601,8 @@ internal override string SaveToString(Card card) | |
cardBuilder.AppendLine(address.ToStringVcardFive()); | ||
foreach (LabelAddressInfo label in card.ContactLabels) | ||
cardBuilder.AppendLine(label.ToStringVcardFive()); | ||
foreach (AgentInfo agent in card.ContactAgents) | ||
cardBuilder.AppendLine(agent.ToStringVcardFive()); | ||
foreach (EmailInfo email in card.ContactMails) | ||
cardBuilder.AppendLine(email.ToStringVcardFive()); | ||
foreach (OrganizationInfo organization in card.ContactOrganizations) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,6 +87,7 @@ public override Card Parse() | |
List<TimeZoneInfo> _timezones = []; | ||
List<GeoInfo> _geos = []; | ||
List<ImppInfo> _impps = []; | ||
List<AgentInfo> _agents = []; | ||
List<XNameInfo> _xes = []; | ||
|
||
// Name and Full Name specifiers are required | ||
|
@@ -161,6 +162,15 @@ public override Card Parse() | |
_labels.Add(LabelAddressInfo.FromStringVcardThree(_value)); | ||
} | ||
|
||
// Agent (AGENT:BEGIN:VCARD\nFN:Joe Friday\nTEL:+1...) | ||
if (_value.StartsWith(VcardConstants._agentSpecifier + delimiter)) | ||
{ | ||
if (isWithType) | ||
_agents.Add(AgentInfo.FromStringVcardThreeWithType(_value)); | ||
else | ||
_agents.Add(AgentInfo.FromStringVcardThree(_value)); | ||
} | ||
|
||
// Email (EMAIL;TYPE=HOME,INTERNET:[email protected]) | ||
if (_value.StartsWith(VcardConstants._emailSpecifier + delimiter)) | ||
{ | ||
|
@@ -397,6 +407,7 @@ public override Card Parse() | |
ContactTelephones = [.. _telephones], | ||
ContactAddresses = [.. _addresses], | ||
ContactLabels = [.. _labels], | ||
ContactAgents = [.. _agents], | ||
ContactOrganizations = [.. _orgs], | ||
ContactTitles = [.. _titles], | ||
ContactURL = _url, | ||
|
@@ -455,6 +466,8 @@ internal override string SaveToString(Card card) | |
cardBuilder.AppendLine(address.ToStringVcardThree()); | ||
foreach (LabelAddressInfo label in card.ContactLabels) | ||
cardBuilder.AppendLine(label.ToStringVcardThree()); | ||
foreach (AgentInfo agent in card.ContactAgents) | ||
cardBuilder.AppendLine(agent.ToStringVcardThree()); | ||
foreach (EmailInfo email in card.ContactMails) | ||
cardBuilder.AppendLine(email.ToStringVcardThree()); | ||
foreach (OrganizationInfo organization in card.ContactOrganizations) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,6 +83,7 @@ public override Card Parse() | |
List<TimeZoneInfo> _timezones = []; | ||
List<GeoInfo> _geos = []; | ||
List<ImppInfo> _impps = []; | ||
List<AgentInfo> _agents = []; | ||
List<XNameInfo> _xes = []; | ||
|
||
// Name specifier is required | ||
|
@@ -155,6 +156,15 @@ public override Card Parse() | |
_labels.Add(LabelAddressInfo.FromStringVcardTwo(_value)); | ||
} | ||
|
||
// Agent (AGENT:BEGIN:VCARD\nFN:Joe Friday\nTEL:+1...) | ||
if (_value.StartsWith(VcardConstants._agentSpecifier + delimiter)) | ||
{ | ||
if (isWithType) | ||
_agents.Add(AgentInfo.FromStringVcardTwoWithType(_value)); | ||
else | ||
_agents.Add(AgentInfo.FromStringVcardTwo(_value)); | ||
} | ||
|
||
// Email (EMAIL;HOME;INTERNET:[email protected] or EMAIL;TYPE=HOME,INTERNET:[email protected]) | ||
if (_value.StartsWith(VcardConstants._emailSpecifier + delimiter)) | ||
{ | ||
|
@@ -344,6 +354,7 @@ public override Card Parse() | |
ContactTelephones = [.. _telephones], | ||
ContactAddresses = [.. _addresses], | ||
ContactLabels = [.. _labels], | ||
ContactAgents = [.. _agents], | ||
ContactOrganizations = [.. _orgs], | ||
ContactTitles = [.. _titles], | ||
ContactURL = _url, | ||
|
@@ -402,6 +413,8 @@ internal override string SaveToString(Card card) | |
cardBuilder.AppendLine(address.ToStringVcardTwo()); | ||
foreach (LabelAddressInfo label in card.ContactLabels) | ||
cardBuilder.AppendLine(label.ToStringVcardTwo()); | ||
foreach (AgentInfo agent in card.ContactAgents) | ||
cardBuilder.AppendLine(agent.ToStringVcardTwo()); | ||
foreach (EmailInfo email in card.ContactMails) | ||
cardBuilder.AppendLine(email.ToStringVcardTwo()); | ||
foreach (OrganizationInfo organization in card.ContactOrganizations) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.