[Csmail-patches] CVS: csmail/src/CSMail ChangeLog,1.7,1.8 Provider.cs,1.1,1.2 Session.cs,1.3,1.4
Status: Pre-Alpha
Brought to you by:
mastergaurav
From: Gaurav V. <mas...@us...> - 2002-08-28 11:44:23
|
Update of /cvsroot/csmail/csmail/src/CSMail In directory usw-pr-cvs1:/tmp/cvs-serv30170/CSMail Modified Files: ChangeLog Provider.cs Session.cs Log Message: 2002-08-28 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> * CSMail/Providers.cs : Completed. * CSMail/Properties.cs : Made contructor public. * CSMail/Session.cs : Working on it. * CSMail.Utils/Properties.cs : Stubbed "this[string]" property. Index: ChangeLog =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/ChangeLog,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- ChangeLog 28 Aug 2002 10:25:52 -0000 1.7 +++ ChangeLog 28 Aug 2002 11:44:20 -0000 1.8 @@ -1,6 +1,13 @@ 2002-08-28 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + * Providers.cs : Completed. + * Properties.cs : Made contructor public. + * Session.cs : Working on it. + * Properties.cs : Stubbed "this[string]" property. + +2002-08-28 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + * Folder.cs : Removed "MailTODO" from "ToString()" 2002-08-28 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> Index: Provider.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/Provider.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Provider.cs 20 Jun 2002 10:34:55 -0000 1.1 +++ Provider.cs 28 Aug 2002 11:44:20 -0000 1.2 @@ -20,21 +20,14 @@ private string vendor; private string version; - internal Provider() + public Provider(ProviderType type, string protocol, string className, + string vendor, string version) { - //TODO: Initialize the values from the configuration file - Initialize(String.Empty); - } - - internal Provider(string configFile) - { - Initialize(configFile); - } - - [MailTODO] - internal void Initialize(string configFile) - { - throw new NotImplementedException(); + this.type = type; + this.protocol = protocol; + this.className = className; + this.vendor = vendor; + this.version = version; } public string ClassName @@ -75,6 +68,26 @@ { return version; } + } + + public override string ToString() + { + String retVal = "CSMail.Provider["; + switch(type) + { + case ProviderType.Store: retVal += "STORE,"; + break; + case ProviderType.Transport: retVal += "TRANSPORT,"; + break; + default : break; + } + retVal += (protocol + "," + className); + if(vendor != null) + retVal += ("," + vendor); + if(version != null) + retVal += ("," + version); + retVal += "]"; + return retVal; } } } Index: Session.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/Session.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Session.cs 28 Aug 2002 10:17:12 -0000 1.3 +++ Session.cs 28 Aug 2002 11:44:20 -0000 1.4 @@ -8,15 +8,16 @@ * (C) Gaurav Vaish (2002) */ +using System; using System.Collections; using CSMail.Utils; namespace CSMail { - public class Session + public sealed class Session { - private Properties properties; - private Authenticator authenticator; + private readonly Properties properties; + private readonly Authenticator authenticator; private Hashtable authTable; private ArrayList providers; private Hashtable provByProto; @@ -26,6 +27,8 @@ private static Session defaultSession; + private const string CSMailVersion = "0.1"; + private Session() { } @@ -40,19 +43,38 @@ providers = new ArrayList(); provByProto = new Hashtable(); provByClass = new Hashtable(); - //addrMap = new Properties(); + addrMap = new Properties(); + + debug = bool.Parse(this.properties["CSMail.debug"]); + } - // debug = bool.Parse(this.properties["mail.debug"]) + public static Session GetInstance(Properties props, Authenticator auth) + { + return new Session(props, auth); } - public Session GetDefaultInstance(Properties properties, Authenticator authenticator) + public static Session GetInstance(Properties props) + { + return new Session(props, null); + } + + public static Session GetDefaultInstance(Properties properties, + Authenticator authenticator) { if(defaultSession == null) { - defaultSession = new Session(); - // Do some initialization??? + defaultSession = new Session(properties, authenticator); + } else + { + if(defaultSession.authenticator != authenticator) + throw new Exception("Access to default session denied"); } return defaultSession; + } + + public static Session GetDefaultInstance(Properties properties) + { + return GetDefaultInstance(properties, null); } } } |