[Csmail-patches] CVS: csmail/src/CSMail AddressException.cs,NONE,1.1 ChangeLog,1.56,1.57 EMailAddres
Status: Pre-Alpha
                
                Brought to you by:
                
                    mastergaurav
                    
                
            | 
      
      
      From: Gaurav V. <mas...@us...> - 2002-10-17 10:34:17
      
     | 
| Update of /cvsroot/csmail/csmail/src/CSMail
In directory usw-pr-cvs1:/tmp/cvs-serv20330
Modified Files:
	ChangeLog EMailAddress.cs EMailAddressList.cs Provider.cs 
Added Files:
	AddressException.cs 
Log Message:
2002-10-17
* AddressException.cs     : Added new exception class.
* EMailAddressList.cs     : ParseHeaderLine(string)
                                     - Renamed to Parse(string).
                          : Parse(string),
                          : Parse(string, bool),
                          : ParseHeader(string, bool),
                                                - Implemented.
                          : ParseHeader(string, bool, bool),
                                                - Stubbed.
* EMailAddress.cs         : Validate()          - Stubbed.
--- NEW FILE ---
/**
 * Namespace:   CSMail
 * Class:       AddressException
 *
 * Author:      Gaurav Vaish
 * Maintainer:  mastergaurav AT users DOT sf DOT net
 *
 * (C) Gaurav Vaish (2002)
 */
using System;
namespace CSMail
{
	public class AddressException : Exception
	{
		private int position = -1;
		private string actualString = null;
		public AddressException() : base()
		{
		}
		public AddressException(string message) : base(message)
		{
		}
		public AddressException(string message, string actualString,
		                        int position) : base(message)
		{
			this.actualString = actualString;
			this.position     = position;
		}
		public AddressException(string message, Exception e)
		                       : base(message, e)
		{
		}
	}
}
Index: ChangeLog
===================================================================
RCS file: /cvsroot/csmail/csmail/src/CSMail/ChangeLog,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- ChangeLog	9 Oct 2002 07:09:30 -0000	1.56
+++ ChangeLog	17 Oct 2002 10:34:14 -0000	1.57
@@ -1,4 +1,22 @@
 
+2002-10-17    Gaurav Vaish <mastergaurav AT users DOT sf DOT net>
+
+	* AddressException.cs     : Added new exception class.
+	* EMailAddressList.cs     : ParseHeaderLine(string)
+	                                     - Renamed to Parse(string).
+	                          : Parse(string),
+	                          : Parse(string, bool),
+	                          : ParseHeader(string, bool),
+	                                                - Implemented.
+	                          : ParseHeader(string, bool, bool),
+	                                                - Stubbed.
+	* EMailAddress.cs         : Validate()          - Stubbed.
+
+2002-10-16    Gaurav Vaish <mastergaurav AT users DOT sf DOT net>
+
+	* EMailAddressList.cs     : ParseHeaderLine(string)
+	                                                - Stubbed.
+
 2002-10-09    Gaurav Vaish <mastergaurav AT users DOT sf DOT net>
 
 	* ContentType.cs          : ctor(string)        - Implemented.
Index: EMailAddress.cs
===================================================================
RCS file: /cvsroot/csmail/csmail/src/CSMail/EMailAddress.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- EMailAddress.cs	9 Oct 2002 07:09:30 -0000	1.5
+++ EMailAddress.cs	17 Oct 2002 10:34:14 -0000	1.6
@@ -97,6 +97,12 @@
 			}
 		}
 
+		[MailTODO]
+		public void Validate()
+		{
+			throw new NotImplementedException();
+		}
+
 		/// <summary>
 		/// Checks for equality with another address.
 		/// </summary>
Index: EMailAddressList.cs
===================================================================
RCS file: /cvsroot/csmail/csmail/src/CSMail/EMailAddressList.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- EMailAddressList.cs	30 Sep 2002 12:27:22 -0000	1.4
+++ EMailAddressList.cs	17 Oct 2002 10:34:14 -0000	1.5
@@ -70,6 +70,81 @@
 			throw new NotImplementedException();
 		}
 
+		public static EMailAddress[] Parse(string headerValue)
+		{
+			return Parse(headerValue, true);
+		}
+
+		public static EMailAddress[] Parse(string headerValue,
+		                                     bool strict)
+		{
+			return Parse(headerValue, strict, false);
+		}
+		
+		public static EMailAddress[] ParseHeader(string headerValue,
+		                                         bool strict)
+		{
+			return Parse(headerValue, strict, true);
+		}
+
+		[MailTODO]
+		private static EMailAddress[] Parse(string headerValue,
+		                                    bool strict, bool validate)
+		{
+			int i1 = -1;
+			int j1 = -1;
+			int len = headerValue.Length;
+			
+			bool flag2 = false;
+			bool flag3 = false; // addressRead
+			bool startTag = false; // flag4
+			
+			ArrayList addressList = new ArrayList();
+			int j = -1;
+			int i = -1;
+			int index;
+			
+			for(index = 0; index < len; index++)
+			{
+				char c = headerValue[index];
+				switch(c)
+				{
+					case '\t' : break;
+					case '\n' : break;
+					case '\r' : break;
+					case ' '  : break;
+					
+					case '('  : startTag = true;
+					            if(i >= 0 && j == -1)
+					            	j = index;
+					            if(i1 == -1)
+					            	i1 = index + 1;
+					            index++;
+					            int unbalance;
+					            for(unbalance = 1; index < len &&
+					                               unbalance > 0; index++)
+					            {
+					            	switch(headerValue[index])
+					            	{
+					            		case '\\' : index++;
+					            		            break;
+					            		case '('  : unbalance++;
+					            		            break;
+					            		case ')'  : unbalance--;
+					            		            break;
+					            		default   : break;
+					            	}
+					            }
+					            
+					            if(unbalance > 0)
+					            	throw new AddressException("[EMailAddressList] Missing ')'",
+					            	                   headerValue, index);
+					            throw new NotImplementedException();
+				}
+			}
+			throw new NotImplementedException();
+		}
+
 		/// <summary>
 		/// Gets or sets an address at the specified index.
 		/// </summary>
Index: Provider.cs
===================================================================
RCS file: /cvsroot/csmail/csmail/src/CSMail/Provider.cs,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Provider.cs	9 Oct 2002 07:09:30 -0000	1.8
+++ Provider.cs	17 Oct 2002 10:34:14 -0000	1.9
@@ -157,7 +157,7 @@
 		{
 			if(obj != null && obj is Provider)
 			{
-				return (this == (Provider)obj;
+				return (this == (Provider)obj);
 			}
 			return false;
 		}
 |