[Csmail-patches] CVS: csmail/src/CSMail ChangeLog,1.60,1.61 InternetAddress.cs,1.6,1.7
Status: Pre-Alpha
                
                Brought to you by:
                
                    mastergaurav
                    
                
            | 
      
      
      From: Gaurav V. <mas...@us...> - 2002-10-25 17:19:13
      
     | 
| Update of /cvsroot/csmail/csmail/src/CSMail
In directory usw-pr-cvs1:/tmp/cvs-serv3428
Modified Files:
	ChangeLog InternetAddress.cs 
Log Message:
2002-10-25
* InternetAddress.cs      : Equals(InternetAddress)   - Implemented.
                          : ctor(string)              - Implemented.
Index: ChangeLog
===================================================================
RCS file: /cvsroot/csmail/csmail/src/CSMail/ChangeLog,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- ChangeLog	25 Oct 2002 10:07:34 -0000	1.60
+++ ChangeLog	25 Oct 2002 10:33:00 -0000	1.61
@@ -1,6 +1,11 @@
 
 2002-10-25    Gaurav Vaish <mastergaurav AT users DOT sf DOT net>
 
+	* InternetAddress.cs      : Equals(InternetAddress)   - Implemented.
+	                          : ctor(string)              - Implemented.
+
+2002-10-25    Gaurav Vaish <mastergaurav AT users DOT sf DOT net>
+
 	* MessagingException.cs   : Meesage { get; },
 	                          : GetMessage()              - Implemented.
 	                          : BaseMessage { get; }      - Default is
Index: InternetAddress.cs
===================================================================
RCS file: /cvsroot/csmail/csmail/src/CSMail/InternetAddress.cs,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- InternetAddress.cs	9 Sep 2002 06:23:01 -0000	1.6
+++ InternetAddress.cs	25 Oct 2002 10:33:00 -0000	1.7
@@ -58,10 +58,21 @@
 		/// Initialization with a URI string.
 		/// </summary>
 		/// <param name="fullURI">Complete URI to parse.</param>
-		[MailTODO]
 		public InternetAddress(string fullURI)
 		{
-			throw new NotImplementedException();
+			int sep = fullURI.IndexOf("://");
+			if(sep < 0)
+				throw new AddressException("[InternetAddress]" +
+				          " No '://' found", fullURI, 0);
+			if(sep == 0)
+				throw new AddressException("[InternetAddress]" +
+				          " '://' cannot be at start", fullURI, 0);
+			protocol = fullURI.Substring(0, sep);
+			int slash = fullURI.IndexOf('/', sep + 3);
+			if(slash == -1)
+				hostname = fullURI.Substring(sep + 3);
+			else
+				hostname = fullURI.Substring(sep + 3, slash - sep - 3);
 		}
 
 		/// <summary>
@@ -220,10 +231,9 @@
 		/// <returns><c>true</c> if the two represent same URI,
 		/// <c>false</c> otherwise.
 		/// </returns>
-		[MailTODO]
 		public bool Equals(InternetAddress address)
 		{
-			throw new NotImplementedException();
+			return (ToString().ToLower() == address.ToString().ToLower());
 		}
 
 		/// <summary>
 |