Thread: [Csmail-patches] CVS: csmail/src/CSMail ConnectionEventHandler.cs,1.1,1.2 FolderEventArgs.cs,1.1,1.2
Status: Pre-Alpha
Brought to you by:
mastergaurav
From: Gaurav V. <mas...@us...> - 2002-09-09 06:23:04
|
Update of /cvsroot/csmail/csmail/src/CSMail In directory usw-pr-cvs1:/tmp/cvs-serv2841 Modified Files: ConnectionEventHandler.cs FolderEventArgs.cs FolderEventHandler.cs IllegalStateException.cs InternetAddress.cs InternetAddressList.cs MessageDeliveredEventArgs.cs MessageRemovedException.cs StoreMessageEventHandler.cs Log Message: 2002-09-09 * *.cs -- Documentation, documentation, documentation! Index: ConnectionEventHandler.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/ConnectionEventHandler.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ConnectionEventHandler.cs 20 Jun 2002 02:43:24 -0000 1.1 +++ ConnectionEventHandler.cs 9 Sep 2002 06:23:01 -0000 1.2 @@ -10,5 +10,12 @@ namespace CSMail { + /// <summary> + /// Represents the method that will handle + /// <c>Service.Connection</c> event of a <c>Service</c>. + /// </summary> + /// <seealso cref="ConnectionEventArgs"/> + /// <seealso cref="ConnectionEventType"/> + /// <seealso cref="Service"/> public delegate void ConnectionEventHandler(object sender, ConnectionEventArgs e); -} \ No newline at end of file +} Index: FolderEventArgs.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/FolderEventArgs.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- FolderEventArgs.cs 20 Jun 2002 02:43:24 -0000 1.1 +++ FolderEventArgs.cs 9 Sep 2002 06:23:01 -0000 1.2 @@ -12,12 +12,32 @@ namespace CSMail { + /// <summary> + /// Arguments for a folder event. + /// </summary> + /// <seealso cref="FolderEventHandler"/> + /// <seealso cref="FolderEventType"/> public class FolderEventArgs { private FolderEventType eventType; private Folder folder; private Folder newFolder; + /// <summary> + /// Initiates the instance of the object with given event type. + /// </summary> + /// <exception cref="ArgumentException">If the + /// <c>eventType</c> is <c>FolderType.Renamed</c> + /// or is not from a value defined in + /// <see>FolderEventType</see>. + /// </exception> + /// <remarks> + /// Use this contructor when a folder event occurs, except for + /// when a folder is renamed. + /// </remarks> + /// <param name="folder">Folder on which the event has + /// occured.</param> + /// <param name="eventType">The type of event occured.</param> public FolderEventArgs(Folder folder, FolderEventType eventType) { if(eventType == FolderEventType.Renamed || !Enum.IsDefined(typeof(FolderEventType), eventType)) @@ -28,6 +48,14 @@ this.folder = folder; } + /// <summary> + /// Initiates the instance with event type as folder renaming. + /// </summary> + /// <remarks> + /// Use this contstructor when the folder has been named. + /// </remarks> + /// <param name="folder">The folder before renaming.</param> + /// <param name="newFolder">The folder after renaming.</param> public FolderEventArgs(Folder folder, Folder newFolder) { this.folder = folder; @@ -35,6 +63,9 @@ eventType = FolderEventType.Renamed; } + /// <summary> + /// Returns the type of the event occured. + /// </summary> public FolderEventType EventType { get @@ -43,6 +74,12 @@ } } + /// <summary> + /// Returns the associated folder. + /// </summary> + /// <remarks> + /// Returns the old folder during folder renaming. + /// </remarks> public Folder Folder { get @@ -51,6 +88,13 @@ } } + /// <summary> + /// Returns the new folder associated. + /// </summary> + /// <remarks> + /// Returns a <c>null</c> if the even type is not + /// <c>FolderEventType.Renamed</c> . + /// </remarks> public Folder NewFolder { get Index: FolderEventHandler.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/FolderEventHandler.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- FolderEventHandler.cs 20 Jun 2002 02:43:24 -0000 1.1 +++ FolderEventHandler.cs 9 Sep 2002 06:23:01 -0000 1.2 @@ -10,5 +10,12 @@ namespace CSMail { + /// <summary> + /// Represents the method that will handle + /// <c>Store.Folder</c> event of a <c>Store</c>. + /// </summary> + /// <seealso cref="FolderEventArgs"/> + /// <seealso cref="FolderEventType"/> + /// <seealso cref="Store"/> public delegate void FolderEventHandler(object sender, FolderEventArgs e); -} \ No newline at end of file +} Index: IllegalStateException.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/IllegalStateException.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- IllegalStateException.cs 28 Aug 2002 10:17:12 -0000 1.1 +++ IllegalStateException.cs 9 Sep 2002 06:23:01 -0000 1.2 @@ -12,12 +12,27 @@ namespace CSMail { + /// <summary> + /// Execption thrown while accessing a <see>Folder</see> + /// in a wrong mode. + /// </summary> + /// <example> + /// An exception is thrown while trying to retrieve the + /// <see>FolderOpenMode</see> of a closed <c>Folder</c>. + /// </example> public class IllegalStateException : Exception { + /// <summary> + /// Default constructor. With no message. + /// </summary> public IllegalStateException() : base() { } + /// <summary> + /// Contructor with descriptive message, giving reasons + /// for why the exception was thrown. + /// </summary> public IllegalStateException(string message) : base(message) { } Index: InternetAddress.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/InternetAddress.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- InternetAddress.cs 3 Sep 2002 12:38:45 -0000 1.5 +++ InternetAddress.cs 9 Sep 2002 06:23:01 -0000 1.6 @@ -18,13 +18,31 @@ namespace CSMail { - public class InternetAddress + /// <summary> + /// Class to represent a URL. + /// </summary> + /// <remarks> + /// It is supposed to understand a URL of the type + /// <code> + /// prot://[user[:pass]@]hostname[:port]/filepath[#ref] + /// </code> + /// but it currently understands only + /// <code> + /// prot://hostname + /// </code> + /// </remarks> + public class InternetAddress : IAddress { private string hostname; private string protocol; private int[] ip; private bool isIP; + /// <summary> + /// Initialization with a hostname and specified protocol. + /// </summary> + /// <param name="hostname">The hostname.</param> + /// <param name="protocol">The protocol.</param> public InternetAddress(string hostname, string protocol) { hostname = hostname.Trim(); @@ -36,6 +54,10 @@ } } + /// <summary> + /// Initialization with a URI string. + /// </summary> + /// <param name="fullURI">Complete URI to parse.</param> [MailTODO] public InternetAddress(string fullURI) { @@ -43,10 +65,14 @@ } /// <summary> - /// Currently only IP_V4 formats are supported. To support - /// the IP_V6 format IPs, I have to first go through the - /// documentations. + /// Initialization with a given IP address and the specified + /// protocol. /// </summary> + /// <remarks> + /// Currently only IP_V4 formats are supported. + /// To support the IP_V6 format IPs, I have to first + /// go through the documentations. + /// </remarks> public InternetAddress(int[] ip, string protocol) { if(!ValidIP4(ip)) @@ -64,6 +90,9 @@ this.isIP = true; } + /// <summary> + /// Returns the hostname. + /// </summary> public string Hostname { get @@ -72,6 +101,14 @@ } } + /// <summary> + /// Checks if the provided <see>Hostname</see> + /// is a valid IP address or not. + /// </summary> + /// <remarks> + /// It does not check for the existence of + /// such an IP, but only for its validity. + /// </remarks> public bool IsIP { get @@ -79,7 +116,22 @@ return isIP; } } - + + /// <summary> + /// Returns the address type, which is + /// <c>AddressType.InternetAddress</c> + /// </summary> + public AddressType AddressType + { + get + { + return AddressType.InternetAddress; + } + } + + /// <summary> + /// Returns the associated protocol. + /// </summary> public string Protocol { get @@ -88,6 +140,13 @@ } } + /// <summary> + /// Returns the IP. + /// </summary> + /// <remarks> + /// Returns <c>null</c> is the hostname does not + /// represent a valid IP address. + /// </remarks> public int[] getIP { get @@ -137,7 +196,45 @@ } return true; } - + + /// <summary> + /// Checks for equality with another address. + /// </summary> + /// <param name="address">Address to compare to.</param> + /// <returns><c>true</c> if the two represent same URI, + /// <c>false</c> otherwise. + /// </returns> + bool IAddress.Equals(IAddress address) + { + if(address is InternetAddress) + { + return Equals((InternetAddress)address); + } + return false; + } + + /// <summary> + /// Checks for equality with another address. + /// </summary> + /// <param name="address">Address to compare to.</param> + /// <returns><c>true</c> if the two represent same URI, + /// <c>false</c> otherwise. + /// </returns> + [MailTODO] + public bool Equals(InternetAddress address) + { + throw new NotImplementedException(); + } + + /// <summary> + /// Returns string repesentation of the URI. + /// </summary> + /// <remarks> + /// The returned value is of the form: + /// <code> + /// protocol://[user[:pass]@]host[:port]/file[#ref] + /// </code> + /// </remarks> public override string ToString() { string retVal; Index: InternetAddressList.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/InternetAddressList.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- InternetAddressList.cs 4 Sep 2002 06:35:42 -0000 1.4 +++ InternetAddressList.cs 9 Sep 2002 06:23:01 -0000 1.5 @@ -14,14 +14,25 @@ namespace CSMail { + /// <summary> + /// Represents a collection of InternetAddress-es. + /// </summary> + /// <seealso cref="InternetAddress"/> public class InternetAddressList : IAddressList, IEnumerable { private ArrayList addresses = new ArrayList(); + /// <summary> + /// Creates an empty list. + /// </summary> public InternetAddressList() { } + /// <summary> + /// Creates a list with given initial address list. + /// </summary> + /// <param name="addresses">Initial list of addresses.</param> public InternetAddressList(InternetAddress[] addresses) { if(addresses != null) @@ -36,6 +47,10 @@ } } + /// <summary> + /// Creates a list with given initial address list. + /// </summary> + /// <param name="addresses">Initial list of addresses.</param> public InternetAddressList(InternetAddressList addresses) { if(addresses != null) @@ -47,6 +62,9 @@ } } + /// <summary> + /// Returns the number of addresses in the list. + /// </summary> public int Count { get @@ -55,6 +73,14 @@ } } + /// <summary> + /// Returns an address at a specified index. + /// </summary> + /// <param name="index">The index at which the value + /// is to be retrieved.</param> + /// <remarks> + /// Returns null is <c>index < 0 || index >= Count</c> + /// </remarks> public InternetAddress this[int index] { get @@ -65,11 +91,23 @@ } } + /// <summary> + /// Adds an address to the list. + /// </summary> + /// <param name="address">Address to be added.</param> + /// <returns>The number of address in the list after + /// adding new address.</returns> public int Add(InternetAddress address) { return addresses.Add(address); } + /// <summary> + /// Adds a set of addresss to the list. + /// </summary> + /// <param name="address">Addresses to be added.</param> + /// <returns>The number of address in the list after + /// adding new addresses.</returns> public int Add(InternetAddressList address) { foreach(InternetAddress current in address) @@ -82,16 +120,33 @@ return addresses.Count; } + /// <summary> + /// Adds an address at the specified index. + /// </summary> + /// <param name="index">Index at which new address is + /// to be inserted.</param> + /// <param name="address">The address to be inserted.</param> public void AddAt(int index, InternetAddress address) { addresses.Insert(index, address); } + /// <summary> + /// Returns an address at the given index. + /// </summary> + /// <param name="index">Index under consideration.</param> + /// <returns>Address at the given index.</returns> public InternetAddress GetAddress(int index) { - return (InternetAddress)addresses[index]; + return this[index]; } + /// <summary> + /// Adds an address to the list. + /// </summary> + /// <param name="address">Address to be added.</param> + /// <returns>The number of address in the list after + /// adding new address.</returns> int IAddressList.Add(IAddress address) { if(address is InternetAddress) @@ -101,38 +156,76 @@ return addresses.Count; } + /// <summary> + /// Adds an address at the specified index. + /// </summary> + /// <param name="index">Index at which new address is + /// to be inserted.</param> + /// <param name="address">The address to be inserted.</param> void IAddressList.AddAt(int index, IAddress address) { if(address is InternetAddress) AddAt(index, (InternetAddress)address); } + /// <summary> + /// Returns an address at the given index. + /// </summary> + /// <param name="index">Index under consideration.</param> + /// <returns>Address at the given index.</returns> IAddress IAddressList.GetAddress(int index) { return (IAddress)GetAddress(index); } + /// <summary> + /// Removes an address from the list. + /// </summary> + /// <param name="address">Address to be removed.</param> void IAddressList.Remove(IAddress address) { if(address is InternetAddress) Remove((InternetAddress)address); } + /// <summary> + /// Removes an address from the list. + /// </summary> + /// <param name="address">Address to be removed.</param> public void Remove(InternetAddress address) { addresses.Remove(address); } + /// <summary> + /// Clears the list. + /// </summary> public void Clear() { addresses.Clear(); } + /// <summary> + /// Returns the index of the address in the list. + /// </summary> + /// <param name="address">The address under consideration.</param> + /// <returns>The index (zero based) of the address, + /// -1 if not found.</returns> public int IndexOf(InternetAddress address) { return addresses.IndexOf(address); } + /// <summary> + /// Search for a URI by its string representation. + /// </summary> + /// <param name="address">The address under consideration.</param> + /// <param name="ignoreCase">Whether to ignore case during + /// comparision or not.</param> + /// <returns> + /// The index at which the URI exists in the list, + /// -1 if not found. + /// </returns> public int FindByValue(string address, bool ignoreCase) { int i; @@ -151,6 +244,8 @@ return -1; } + /// <summary> + /// </summary> public void RemoveAt(int index) { if(index >= 0 && index < Count) @@ -159,11 +254,15 @@ } } + /// <summary> + /// </summary> public void RemoveFirst(string address, bool ignoreCase) { RemoveAt(FindByValue(address, ignoreCase)); } + /// <summary> + /// </summary> public void Remove(string[] addresses, bool ignoreCase) { ArrayList delete = new ArrayList(); @@ -189,6 +288,8 @@ } } + /// <summary> + /// </summary> public IEnumerator GetEnumerator() { return addresses.GetEnumerator(); Index: MessageDeliveredEventArgs.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/MessageDeliveredEventArgs.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MessageDeliveredEventArgs.cs 3 Sep 2002 04:17:00 -0000 1.1 +++ MessageDeliveredEventArgs.cs 9 Sep 2002 06:23:01 -0000 1.2 @@ -10,6 +10,14 @@ namespace CSMail { + /// <summary> + /// Represents the method that will handle + /// <c>Transport.MessageDelivered</c> event of a + /// <c>Transport</c>. + /// </summary> + /// <seealso cref="MessageDeliveredEventHandler"/> + /// <seealso cref="MessageDeliveryStatus"/> + /// <seealso cref="Transport"/> public class MessageDeliveredEventArgs { private MessageDeliveryStatus status; @@ -19,6 +27,27 @@ private IAddressList validUnsent; private IAddressList invalid; + /// <summary> + /// Initiates the object with specified values. + /// </summary> + /// <param name="transport">Associated transport.</param> + /// <param name="status">The delivery status.</param> + /// <param name="msg">The associated message.</param> + /// <param name="validSent">List of valid addresses to + /// which the message has been delivered.</param> + /// <param name="validUnsent">List of valid addresses to + /// which the message has not been sent, if any.</param> + /// <param name="invalid">List of invalid addresses, + /// if any.</param> + /// <remarks> + /// Should <c>Transport</c> be an argument in the constructor, + /// or should it be the <c>sender</c> in + /// <see>MessageDeliveredEventHandler</see>? + /// </remarks> + /// <seealso cref="MessageDeliveredEventHandler"/> + /// <seealso cref="MessageDeliveryStatus"/> + /// <seealso cref="Message"/> + /// <seealso cref="IAddressList"/> public MessageDeliveredEventArgs(Transport transport, MessageDeliveryStatus status, Message msg, @@ -34,6 +63,9 @@ this.invalid = invalid; } + /// <summary> + /// Returns the delivery status. + /// </summary> public MessageDeliveryStatus DeliveryStatus { get @@ -42,6 +74,9 @@ } } + /// <summary> + /// Returns the associated transport. + /// </summary> public Transport Transport { get @@ -50,7 +85,10 @@ } } - public Message msg + /// <summary> + /// Returns the associated message. + /// </summary> + public Message Message { get { @@ -58,6 +96,10 @@ } } + /// <summary> + /// Returns the list of valid addresses to which + /// the message was delivered. + /// </summary> public IAddressList ValidSent { get @@ -66,6 +108,10 @@ } } + /// <summary> + /// Returns the list of valid addresses to which + /// the message failed to be delivered. + /// </summary> public IAddressList ValidUnsent { get @@ -74,6 +120,9 @@ } } + /// <summary> + /// Returns the list of invalid addresses. + /// </summary> public IAddressList Invalid { get Index: MessageRemovedException.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/MessageRemovedException.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MessageRemovedException.cs 28 Aug 2002 10:17:12 -0000 1.1 +++ MessageRemovedException.cs 9 Sep 2002 06:23:01 -0000 1.2 @@ -12,12 +12,21 @@ namespace CSMail { + /// <summary> + /// Thrown while trying to retrieve an expunged message from a folder. + /// </summary> public class MessageRemovedException : Exception { + /// <summary> + /// Default constructor. + /// </summary> public MessageRemovedException() : base() { } + /// <summary> + /// Contructor with description of the error. + /// </summary> public MessageRemovedException(string message) : base(message) { } Index: StoreMessageEventHandler.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/StoreMessageEventHandler.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- StoreMessageEventHandler.cs 5 Sep 2002 05:24:21 -0000 1.3 +++ StoreMessageEventHandler.cs 9 Sep 2002 06:23:01 -0000 1.4 @@ -11,10 +11,12 @@ namespace CSMail { /// <summary> - /// Delegate to handle all the message-events related to a store. + /// Represents the message that will handle the + /// <c>StoreMessage</c> event of a <c>Store</c>. /// </summary> /// <param name="sender">Sender of the message.</param> /// <param name="e">The arguments associated with the raised event.</param> /// <seealso cref="StoreMessageEventArgs"/> + /// <seealso cref="StoreMessageType"/> public delegate void StoreMessageEventHandler(object sender, StoreMessageEventArgs e); } |