[csmaild-cvs] csmaild/src/Common/Rfc2822 AddressList.cs,1.1,1.2 AddressMailboxList.cs,1.1,1.2 Header
Brought to you by:
tamc
|
From: <ta...@us...> - 2003-08-02 15:57:13
|
Update of /cvsroot/csmaild/csmaild/src/Common/Rfc2822
In directory sc8-pr-cvs1:/tmp/cvs-serv5380/src/Common/Rfc2822
Modified Files:
AddressList.cs AddressMailboxList.cs HeaderFieldList.cs
Interpreter.cs
Log Message:
Modified XML mail store to read the internal date of the message
Added internal date to the message object
Added Count properties to the various "collections" in the rfc2822 object model
Fixed the rfc2822 message interpreter for addresses, and various other small fixes
Index: AddressList.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Common/Rfc2822/AddressList.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** AddressList.cs 1 Aug 2003 22:02:37 -0000 1.1
--- AddressList.cs 2 Aug 2003 15:57:10 -0000 1.2
***************
*** 26,29 ****
--- 26,37 ----
mList.Add(addr);
}
+
+ public int Count
+ {
+ get
+ {
+ return mList.Count;
+ }
+ }
}
}
Index: AddressMailboxList.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Common/Rfc2822/AddressMailboxList.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** AddressMailboxList.cs 1 Aug 2003 22:02:37 -0000 1.1
--- AddressMailboxList.cs 2 Aug 2003 15:57:10 -0000 1.2
***************
*** 25,28 ****
--- 25,36 ----
mList.Add(box);
}
+
+ public int Count
+ {
+ get
+ {
+ return mList.Count;
+ }
+ }
}
}
Index: HeaderFieldList.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Common/Rfc2822/HeaderFieldList.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** HeaderFieldList.cs 1 Aug 2003 22:02:37 -0000 1.1
--- HeaderFieldList.cs 2 Aug 2003 15:57:10 -0000 1.2
***************
*** 26,30 ****
return (HeaderField[])lst.ToArray(typeof(HeaderField));
else
! return new HeaderField[]{};
}
}
--- 26,30 ----
return (HeaderField[])lst.ToArray(typeof(HeaderField));
else
! return null;
}
}
Index: Interpreter.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Common/Rfc2822/Interpreter.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Interpreter.cs 1 Aug 2003 22:02:37 -0000 1.1
--- Interpreter.cs 2 Aug 2003 15:57:10 -0000 1.2
***************
*** 51,59 ****
string fieldValu = rawHeader.Substring(colonIdx+1);
! // TODO: parse/validate/correct the header based on its name
switch(fieldName.ToLower())
{
case "date":
return new HeaderField(fieldName, InterpretDateTime(fieldValu));
case "to":
return new HeaderField(fieldName, InterpretAddressList(fieldValu));
--- 51,66 ----
string fieldValu = rawHeader.Substring(colonIdx+1);
! if(fieldValu[0] == ' ')
! fieldValu = fieldValu.Substring(1);
!
switch(fieldName.ToLower())
{
case "date":
return new HeaderField(fieldName, InterpretDateTime(fieldValu));
+ case "bcc":
+ case "cc":
+ case "from":
+ case "reply-to":
+ case "sender":
case "to":
return new HeaderField(fieldName, InterpretAddressList(fieldValu));
***************
*** 94,103 ****
private AddressMailbox InterpretAddressMailbox(string rawMailbox)
{
! int atIdx = rawMailbox.IndexOf('@');
! int spIdx = rawMailbox.LastIndexOf(' ', atIdx);
! string host = rawMailbox.Substring(atIdx+1);
! string displayName = rawMailbox.Substring(0, spIdx);
! string localPart = rawMailbox.Substring(spIdx+1, atIdx-spIdx);
return new AddressMailbox(displayName, localPart, host);
--- 101,122 ----
private AddressMailbox InterpretAddressMailbox(string rawMailbox)
{
! int spIdx = rawMailbox.LastIndexOf(' ');
! string displayName = null;
! if(spIdx != -1)
! {
! displayName = rawMailbox.Substring(0, spIdx);
! if(displayName[0] == '"' && displayName[displayName.Length-1] == '"')
! displayName = displayName.Substring(1, displayName.Length-2);
! }
!
! string address = rawMailbox.Substring(spIdx+1);
! if(address[0] == '<' && address[address.Length-1] == '>')
! address = address.Substring(1, address.Length-2);
!
! int atIdx = address.IndexOf('@');
!
! string host = address.Substring(atIdx+1);
! string localPart = address.Substring(0, atIdx);
return new AddressMailbox(displayName, localPart, host);
***************
*** 129,136 ****
{
// validate and correct, possibly also convert to System.DateTime for easy use outside of Rfc2822
return rawDateTime;
}
#endregion
!
#region Body
private void InterpretBody(MessageBody bdy)
--- 148,173 ----
{
// validate and correct, possibly also convert to System.DateTime for easy use outside of Rfc2822
+
return rawDateTime;
}
#endregion
! /*
! date-time = [ day-of-week "," ] date FWS time [CFWS]
! day-of-week = ([FWS] day-name) / obs-day-of-week
! day-name = "Mon" / "Tue" / "Wed" / "Thu" /
! "Fri" / "Sat" / "Sun"
! date = day month year
! year = 4*DIGIT / obs-year
! month = (FWS month-name FWS) / obs-month
! month-name = "Jan" / "Feb" / "Mar" / "Apr" /
! "May" / "Jun" / "Jul" / "Aug" /
! "Sep" / "Oct" / "Nov" / "Dec"
! day = ([FWS] 1*2DIGIT) / obs-day
! time = time-of-day FWS zone
! time-of-day = hour ":" minute [ ":" second ]
! hour = 2DIGIT / obs-hour
! minute = 2DIGIT / obs-minute
! second = 2DIGIT / obs-second
! zone = (( "+" / "-" ) 4DIGIT) / obs-zone*/
#region Body
private void InterpretBody(MessageBody bdy)
|