[Csmail-patches] CVS: csmail/src/CSMail ProviderSearchType.cs,1.2,1.3 StoreSearchType.cs,NONE,1.1 Ch
Status: Pre-Alpha
Brought to you by:
mastergaurav
From: Gaurav V. <mas...@us...> - 2002-08-30 10:31:30
|
Update of /cvsroot/csmail/csmail/src/CSMail In directory usw-pr-cvs1:/tmp/cvs-serv10314 Modified Files: ChangeLog EMailAddress.cs ProviderList.cs Session.cs Added Files: ProviderSearchType.cs StoreSearchType.cs Log Message: 2002-08-30 * Session.cs : Providers { get; } - Implemented : Minor changes due to CSMail.Utils.Properties * EMailAddress.cs : Equals(IAddress) - Changed criterion : operator == - Implemented : operator != - Implemented : GetHashCode() - Implemented * StoreSearchType.cs : Added enumeration. * ProviderList.cs : this[,] - Changed second parameter type to object. Was string. --- NEW FILE --- /** * Namespace: CSMail * Class: StoreSearchType * * Author: Gaurav Vaish * Maintainer: mastergaurav AT users DOT sf DOT net * * (C) Gaurav Vaish (2002) */ namespace CSMail { public enum StoreSearchType { ClassName, Index, URLName } } Index: ChangeLog =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/ChangeLog,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- ChangeLog 30 Aug 2002 08:41:28 -0000 1.13 +++ ChangeLog 30 Aug 2002 10:31:26 -0000 1.14 @@ -1,6 +1,18 @@ 2002-08-30 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + * Session.cs : Providers { get; } - Implemented + : Minor changes due to CSMail.Utils.Properties + * EMailAddress.cs : Equals(IAddress) - Changed criterion + : operator == - Implemented + : operator != - Implemented + : GetHashCode() - Implemented + * StoreSearchType.cs : Added enumeration. + * ProviderList.cs : this[,] - Changed second parameter type + to object. Was string. + +2002-08-30 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + * Session.cs : providers - Changed to ProviderList : provByProto, provByClass - Removed members Index: EMailAddress.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/EMailAddress.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- EMailAddress.cs 20 Jun 2002 02:43:24 -0000 1.1 +++ EMailAddress.cs 30 Aug 2002 10:31:26 -0000 1.2 @@ -17,18 +17,18 @@ private string user; private string host; private string name; - + public EMailAddress(string user, string host) { this.user = user; this.host = host; } - + public EMailAddress(string name, string user, string host): this(user, host) { this.name = name; } - + public string User { get @@ -36,7 +36,7 @@ return user; } } - + public string Host { get @@ -44,7 +44,7 @@ return host; } } - + public string Name { get @@ -52,7 +52,7 @@ return name; } } - + public AddressType AddressType { get @@ -60,18 +60,53 @@ return AddressType.EmailAddress; } } - + public bool Equals(IAddress address) { if(address is EMailAddress) { EMailAddress that = (EMailAddress)address; - if(this.User == that.User && this.Host == that.Host && this.Name == that.Name) + if(this.User == that.User && this.Host == that.Host) return true; } return false; } - + + public override bool Equals(object address) + { + if(address is EMailAddress) + { + EMailAddress that = (EMailAddress)address; + if(this.User == that.User && this.Host == that.Host) + return true; + } + return false; + } + + public static bool operator == (EMailAddress left, EMailAddress right) + { + if(left == null && right == null) + { + return true; + } + if(left != null && right != null) + { + return left.Equals(right); + } + return false; + } + + public static bool operator != (EMailAddress left, EMailAddress right) + { + return !(left == right); + } + + public override int GetHashCode() + { + string em = user.ToLower() + "@" + host.ToLower(); + return em.GetHashCode(); + } + public override string ToString() { string retVal = String.Empty; @@ -87,4 +122,4 @@ return retVal; } } -} +} \ No newline at end of file Index: ProviderList.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/ProviderList.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ProviderList.cs 30 Aug 2002 08:41:28 -0000 1.3 +++ ProviderList.cs 30 Aug 2002 10:31:26 -0000 1.4 @@ -22,7 +22,7 @@ } [MailTODO] - public Provider this[ProviderSearchType type, string key] + public Provider this[ProviderSearchType type, object key] { get { Index: Session.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/Session.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- Session.cs 30 Aug 2002 08:41:28 -0000 1.8 +++ Session.cs 30 Aug 2002 10:31:26 -0000 1.9 @@ -35,6 +35,14 @@ { } + public ProviderList Providers + { + get + { + return providers; + } + } + private Session(Properties properties, Authenticator authenticator) { this.properties = properties; @@ -49,7 +57,7 @@ addrMap = new Properties(); dirsToSearch = new ArrayList(); - debug = bool.Parse(this.properties["CSMail.debug"]); + debug = bool.Parse((string)this.properties["CSMail.debug"]); this.LoadProviders(); this.LoadAddressMap(); @@ -141,6 +149,7 @@ { Provider toAdd = new Provider(currentLine); providers.Add(toAdd); + properties["CSMail." + toAdd.ClassName + ".class"] = toAdd; //provByProto.Add(toAdd.Protocol, toAdd); //provByClass.Add(toAdd.ClassName, toAdd); } @@ -200,8 +209,8 @@ private void SetDirsToSearch() { - string cshome = properties["CSMail.home"]; - string[] cspath = StringUtils.SeparatePath(properties["CSMail.path"]); + string cshome = (string)properties["CSMail.home"]; + string[] cspath = StringUtils.SeparatePath((string)properties["CSMail.path"]); string cwd = Environment.CurrentDirectory; string configP = Path.DirectorySeparatorChar + "config"; |