Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
PerMessageFields.cs
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace Waher.Content.Dsn
6{
11 {
12 private string originalEnvelopeId = null;
13 private string reportingMta = null;
14 private string reportingMtaType = null;
15 private string dsnGateway = null;
16 private string dsnGatewayType = null;
17 private string receivedFromMta = null;
18 private string receivedFromMtaType = null;
19 private DateTimeOffset? arrivalDate = null;
20
25 public PerMessageFields(string[] Rows)
26 : base(Rows)
27 {
28 }
29
36 protected override bool Parse(string Key, string Value)
37 {
38 switch (Key.ToUpper())
39 {
40 case "ORIGINAL-ENVELOPE-ID":
41 this.originalEnvelopeId = Value;
42 return true;
43
44 case "REPORTING-MTA":
45 if (this.ParseType(ref Value, out this.reportingMtaType))
46 {
47 this.reportingMta = Value;
48 return true;
49 }
50 else
51 return false;
52
53 case "DSN-GATEWAY":
54 if (this.ParseType(ref Value, out this.dsnGatewayType))
55 {
56 this.dsnGateway = Value;
57 return true;
58 }
59 else
60 return false;
61
62 case "RECEIVED-FROM-MTA":
63 if (this.ParseType(ref Value, out this.receivedFromMtaType))
64 {
65 this.receivedFromMta = Value;
66 return true;
67 }
68 else
69 return false;
70
71 case "ARRIVAL-DATE":
72 if (CommonTypes.TryParseRfc822(Value, out DateTimeOffset DTO))
73 {
74 this.arrivalDate = DTO;
75 return true;
76 }
77 else
78 return false;
79
80 default:
81 return false;
82 }
83 }
84
88 public string OriginalEnvelopeId => this.originalEnvelopeId;
89
93 public string ReportingMta => this.reportingMta;
94
98 public string ReportingMtaType => this.reportingMtaType;
99
103 public string DsnGateway => this.dsnGateway;
104
108 public string DsnGatewayType => this.dsnGatewayType;
109
113 public string ReceivedFromMta => this.receivedFromMta;
114
118 public string ReceivedFromMtaType => this.receivedFromMtaType;
119
123 public DateTimeOffset? ArrivalDate => this.arrivalDate;
124 }
125}
Helps with parsing of commong data types.
Definition: CommonTypes.cs:13
static bool TryParseRfc822(string s, out DateTimeOffset Value)
Parses a date and time value encoded according to RFC 822, §5.
Definition: CommonTypes.cs:170
Base class for DSN field classes.
Definition: DsnFields.cs:11
bool ParseType(ref string Value, out string Type)
Parses a type value prefixed to the field value.
Definition: DsnFields.cs:60
Information fields for the message.
string ReportingMtaType
Type of Reporting Message Transfer Agent
string DsnGatewayType
Type of Delivery Status Notification Gateway
DateTimeOffset? ArrivalDate
Arrival Date
string ReceivedFromMta
Received from Message Transfer Agent
override bool Parse(string Key, string Value)
Parses a field
string DsnGateway
Delivery Status Notification Gateway
PerMessageFields(string[] Rows)
Information fields for the message.
string ReportingMta
Reporting Message Transfer Agent
string OriginalEnvelopeId
Original envelope identifier
string ReceivedFromMtaType
Type of Received from Message Transfer Agent