Revision: 55
Author: tmyroadctfig
Date: 2006-07-01 08:34:40 -0700 (Sat, 01 Jul 2006)
ViewCVS: http://svn.sourceforge.net/nmailserver/?rev=55&view=rev
Log Message:
-----------
Moved classes into (hopefully) a better structure.
Modified Paths:
--------------
NMail/branches/luke-dev/NMail/Configuration/NMailConfiguration.cs
NMail/branches/luke-dev/NMail/DataTypes/ACLs/StoreFolderAcl.cs
NMail/branches/luke-dev/NMail/NMail.csproj
NMail/branches/luke-dev/NMail.Administration.Console/Command/AddUserCommand.cs
NMail/branches/luke-dev/NMail.Administration.Console/Command/AddUserToMailDomainCommand.cs
NMail/branches/luke-dev/NMail.Administration.Console/Command/DeleteUserCommand.cs
NMail/branches/luke-dev/NMail.Administration.Console/Command/ListFoldersCommand.cs
NMail/branches/luke-dev/NMail.Administration.Console/Command/ListUserAddressesCommand.cs
NMail/branches/luke-dev/NMail.Administration.Console/Command/ListUsersCommand.cs
NMail/branches/luke-dev/NMail.Administration.Console/Command/RemoveUserFromMailDomainCommand.cs
NMail/branches/luke-dev/NMail.Administration.Console/Context/LocalStoreContext.cs
NMail/branches/luke-dev/NMail.Administration.Web/App_Code/FolderDataSource.cs
NMail/branches/luke-dev/NMail.Administration.Web/App_Code/UserDataSource.cs
NMail/branches/luke-dev/NMail.Administration.Web/CreateFolder.aspx.cs
NMail/branches/luke-dev/NMail.Administration.Web/CreateMailDomain.aspx.cs
NMail/branches/luke-dev/NMail.Administration.Web/CreateUser.aspx.cs
NMail/branches/luke-dev/NMail.Administration.Web/FolderDetails.aspx.cs
NMail/branches/luke-dev/NMail.Administration.Web/MailDomainDetails.aspx.cs
NMail/branches/luke-dev/NMail.Administration.Web/TaskList.ascx.cs
NMail/branches/luke-dev/NMail.Administration.Web/UserDetails.aspx.cs
NMail/branches/luke-dev/NMail.ImapService/Command/AppendCommand.cs
NMail/branches/luke-dev/NMail.ImapService/Command/StoreCommand.cs
NMail/branches/luke-dev/NMail.ImapService/ImapSession.cs
NMail/branches/luke-dev/NMail.ImapService/Response/LSubResponse.cs
NMail/branches/luke-dev/NMail.ImapService/Response/ListResponse.cs
NMail/branches/luke-dev/NMail.ImapService/State/AbstractState.cs
NMail/branches/luke-dev/NMail.ImapService/State/AuthenticatedState.cs
NMail/branches/luke-dev/NMail.ImapService/State/ExamineState.cs
NMail/branches/luke-dev/NMail.ImapService/State/SelectedState.cs
NMail/branches/luke-dev/NMail.LocalStore/DeliveryActions/ClamAvScanner.cs
NMail/branches/luke-dev/NMail.LocalStore/DeliveryActions/Copy.cs
NMail/branches/luke-dev/NMail.LocalStore/DeliveryActions/ManageWhiteList.cs
NMail/branches/luke-dev/NMail.LocalStore/DeliveryActions/Move.cs
NMail/branches/luke-dev/NMail.LocalStore/Validators/AddressDate.cs
NMail/branches/luke-dev/NMail.LocalStore/Validators/AddressKeyword.cs
NMail/branches/luke-dev/NMail.LocalStore/Validators/AddressSender.cs
NMail/branches/luke-dev/NMail.LocalStore/Validators/OnWhiteList.cs
NMail/branches/luke-dev/NMail.LocalStore/Validators/OrdbBlackList.cs
NMail/branches/luke-dev/NMail.Server/NMailServer.cs
NMail/branches/luke-dev/NMail.SmtpService/SmtpService.cs
NMail/branches/luke-dev/NMail.SpoolData.MySql/MySqlSpoolData.cs
NMail/branches/luke-dev/NMail.SpoolFilter/Configuration/SpoolFilterConfiguration.cs
NMail/branches/luke-dev/NMail.SpoolFilter/NoActionFilter.cs
NMail/branches/luke-dev/NMail.SpoolFilter/SpoolFilter.cs
NMail/branches/luke-dev/NMail.SpoolFilter.RegexAddressRewriter/RegexAddressRewriter.cs
NMail/branches/luke-dev/NMail.SpoolService/SpoolService.cs
Added Paths:
-----------
NMail/branches/luke-dev/NMail/DataTypes/AbstractMessageRouter.cs
NMail/branches/luke-dev/NMail/DataTypes/IDnsClient.cs
NMail/branches/luke-dev/NMail/DataTypes/IService.cs
NMail/branches/luke-dev/NMail/DataTypes/ISmtpClient.cs
NMail/branches/luke-dev/NMail/DataTypes/LocalStore/ILocalStore.cs
NMail/branches/luke-dev/NMail/DataTypes/LocalStore/ILocalStoreData.cs
NMail/branches/luke-dev/NMail/DataTypes/LocalStore/ILocalStoreDeliveryAction.cs
NMail/branches/luke-dev/NMail/DataTypes/LocalStore/ILocalStoreRecipientValidator.cs
NMail/branches/luke-dev/NMail/DataTypes/LocalStore/ILocalStoreUserMap.cs
NMail/branches/luke-dev/NMail/DataTypes/LocalStore/LocalStoreDelivery.cs
NMail/branches/luke-dev/NMail/DataTypes/LocalStore/LocalStoreGroup.cs
NMail/branches/luke-dev/NMail/DataTypes/LocalStore/LocalStoreUser.cs
NMail/branches/luke-dev/NMail/DataTypes/LocalStore/StoreFolder.cs
NMail/branches/luke-dev/NMail/DataTypes/LocalStore/StoreMessageFlags.cs
NMail/branches/luke-dev/NMail/DataTypes/Spool/
NMail/branches/luke-dev/NMail/DataTypes/Spool/ISpoolData.cs
NMail/branches/luke-dev/NMail/DataTypes/Spool/ISpoolFilter.cs
NMail/branches/luke-dev/NMail/DataTypes/Spool/ISpoolFilterService.cs
NMail/branches/luke-dev/NMail/DataTypes/Spool/ISpoolService.cs
NMail/branches/luke-dev/NMail.Administration.Web/App_Code/Task.cs
Removed Paths:
-------------
NMail/branches/luke-dev/NMail/AbstractMessageRouter.cs
NMail/branches/luke-dev/NMail/DataTypes/LocalStoreDelivery.cs
NMail/branches/luke-dev/NMail/DataTypes/LocalStoreGroup.cs
NMail/branches/luke-dev/NMail/DataTypes/LocalStoreUser.cs
NMail/branches/luke-dev/NMail/DataTypes/StoreFolder.cs
NMail/branches/luke-dev/NMail/DataTypes/StoreMessageFlags.cs
NMail/branches/luke-dev/NMail/IDnsClient.cs
NMail/branches/luke-dev/NMail/ILocalStore.cs
NMail/branches/luke-dev/NMail/ILocalStoreData.cs
NMail/branches/luke-dev/NMail/ILocalStoreDeliveryAction.cs
NMail/branches/luke-dev/NMail/ILocalStoreRecipientValidator.cs
NMail/branches/luke-dev/NMail/ILocalStoreUserMap.cs
NMail/branches/luke-dev/NMail/IService.cs
NMail/branches/luke-dev/NMail/ISmtpClient.cs
NMail/branches/luke-dev/NMail/ISpoolData.cs
NMail/branches/luke-dev/NMail/ISpoolFilter.cs
NMail/branches/luke-dev/NMail/ISpoolFilterService.cs
NMail/branches/luke-dev/NMail/ISpoolService.cs
NMail/branches/luke-dev/NMail/Interfaces/
Property Changed:
----------------
NMail/branches/luke-dev/NMail.PostInstall/
Deleted: NMail/branches/luke-dev/NMail/AbstractMessageRouter.cs
===================================================================
--- NMail/branches/luke-dev/NMail/AbstractMessageRouter.cs 2006-07-01 09:39:32 UTC (rev 54)
+++ NMail/branches/luke-dev/NMail/AbstractMessageRouter.cs 2006-07-01 15:34:40 UTC (rev 55)
@@ -1,101 +0,0 @@
-/*
- * Copyright 2004-2006 Luke Quinane and Daniel Frampton
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-using System;
-using System.Collections;
-
-using NMail.Configuration;
-using NMail.DataTypes;
-
-namespace NMail {
- /// <summary>
- /// Provides the basis for a message router.
- /// </summary>
- public abstract class AbstractMessageRouter {
- /// <summary>
- /// A delegate for validating a recipient.
- /// </summary>
- /// <param name="messageRecipient">The recipient to validate.</param>
- /// <param name="result">The result of the validation.</param>
- /// <returns>
- /// True if validation should continue to the next step. False if this result
- /// should be final.
- /// </returns>
- public delegate bool ValidateRecipientDelegate(out DeliveryResult result, SmtpMessageRecipient messageRecipient);
-
- /// <summary>
- /// A event that occurs before built in message router validation.
- /// </summary>
- public event ValidateRecipientDelegate OnBeforeValidateRecipient;
-
- /// <summary>
- /// A event that occurs after built in message router validation.
- /// </summary>
- public event ValidateRecipientDelegate OnAfterValidateRecipient;
-
- /// <summary>
- /// Validate a specified recipient of the passed message.
- /// </summary>
- /// <param name="messageRecipient">The recipient to validate.</param>
- /// <returns>The result of the request.</returns>
- public DeliveryResult ValidateRecipient(SmtpMessageRecipient messageRecipient) {
-
- if (OnBeforeValidateRecipient != null) {
- foreach(ValidateRecipientDelegate method in OnBeforeValidateRecipient.GetInvocationList()) {
- DeliveryResult result;
-
- if (!method(out result, messageRecipient))
- return result;
- }
- }
-
- DeliveryResult internalResult = this.ValidateRecipientInternal(messageRecipient);
-
- if (OnAfterValidateRecipient != null) {
- foreach(ValidateRecipientDelegate method in OnAfterValidateRecipient.GetInvocationList()) {
- DeliveryResult result;
-
- if (!method(out result, messageRecipient))
- return result;
- }
- }
-
- return internalResult;
- }
-
- /// <summary>
- /// Validate a specified recipient of the passed message.
- /// </summary>
- /// <param name="messageRecipient">The recipient to validate.</param>
- /// <returns>The result of the request.</returns>
- abstract protected DeliveryResult ValidateRecipientInternal(SmtpMessageRecipient messageRecipient);
-
- /// <summary>
- /// Spool a mail message.
- /// </summary>
- /// <param name="message">The message to be spooled.</param>
- /// <returns>The result of the request.</returns>
- abstract public DeliveryResult SpoolMessage(SmtpMessage message);
-
- /// <summary>
- /// Deliver a group of messages, including both connecting to remote SMTP
- /// servers and the local store.
- /// </summary>
- /// <param name="batch">The batch of messages to deliver</param>
- abstract public void DeliverMessages(DeliveryBatch batch);
- }
-}
Modified: NMail/branches/luke-dev/NMail/Configuration/NMailConfiguration.cs
===================================================================
--- NMail/branches/luke-dev/NMail/Configuration/NMailConfiguration.cs 2006-07-01 09:39:32 UTC (rev 54)
+++ NMail/branches/luke-dev/NMail/Configuration/NMailConfiguration.cs 2006-07-01 15:34:40 UTC (rev 55)
@@ -22,6 +22,8 @@
using NMail.Authentication;
using NMail.DataTypes;
+using NMail.DataTypes.LocalStore;
+using NMail.DataTypes.Spool;
using NMail.Helper;
namespace NMail.Configuration {
Modified: NMail/branches/luke-dev/NMail/DataTypes/ACLs/StoreFolderAcl.cs
===================================================================
--- NMail/branches/luke-dev/NMail/DataTypes/ACLs/StoreFolderAcl.cs 2006-07-01 09:39:32 UTC (rev 54)
+++ NMail/branches/luke-dev/NMail/DataTypes/ACLs/StoreFolderAcl.cs 2006-07-01 15:34:40 UTC (rev 55)
@@ -19,6 +19,8 @@
using System.Collections.Generic;
using System.Text;
+using NMail.DataTypes.LocalStore;
+
namespace NMail.DataTypes.ACLs {
/// <summary>
/// A list of access control entries for a folder.
Copied: NMail/branches/luke-dev/NMail/DataTypes/AbstractMessageRouter.cs (from rev 49, NMail/branches/luke-dev/NMail/AbstractMessageRouter.cs)
===================================================================
--- NMail/branches/luke-dev/NMail/DataTypes/AbstractMessageRouter.cs (rev 0)
+++ NMail/branches/luke-dev/NMail/DataTypes/AbstractMessageRouter.cs 2006-07-01 15:34:40 UTC (rev 55)
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2004-2006 Luke Quinane and Daniel Frampton
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System;
+using System.Collections;
+
+using NMail.Configuration;
+
+namespace NMail.DataTypes {
+ /// <summary>
+ /// Provides the basis for a message router.
+ /// </summary>
+ public abstract class AbstractMessageRouter {
+ /// <summary>
+ /// A delegate for validating a recipient.
+ /// </summary>
+ /// <param name="messageRecipient">The recipient to validate.</param>
+ /// <param name="result">The result of the validation.</param>
+ /// <returns>
+ /// True if validation should continue to the next step. False if this result
+ /// should be final.
+ /// </returns>
+ public delegate bool ValidateRecipientDelegate(out DeliveryResult result, SmtpMessageRecipient messageRecipient);
+
+ /// <summary>
+ /// A event that occurs before built in message router validation.
+ /// </summary>
+ public event ValidateRecipientDelegate OnBeforeValidateRecipient;
+
+ /// <summary>
+ /// A event that occurs after built in message router validation.
+ /// </summary>
+ public event ValidateRecipientDelegate OnAfterValidateRecipient;
+
+ /// <summary>
+ /// Validate a specified recipient of the passed message.
+ /// </summary>
+ /// <param name="messageRecipient">The recipient to validate.</param>
+ /// <returns>The result of the request.</returns>
+ public DeliveryResult ValidateRecipient(SmtpMessageRecipient messageRecipient) {
+
+ if (OnBeforeValidateRecipient != null) {
+ foreach(ValidateRecipientDelegate method in OnBeforeValidateRecipient.GetInvocationList()) {
+ DeliveryResult result;
+
+ if (!method(out result, messageRecipient))
+ return result;
+ }
+ }
+
+ DeliveryResult internalResult = this.ValidateRecipientInternal(messageRecipient);
+
+ if (OnAfterValidateRecipient != null) {
+ foreach(ValidateRecipientDelegate method in OnAfterValidateRecipient.GetInvocationList()) {
+ DeliveryResult result;
+
+ if (!method(out result, messageRecipient))
+ return result;
+ }
+ }
+
+ return internalResult;
+ }
+
+ /// <summary>
+ /// Validate a specified recipient of the passed message.
+ /// </summary>
+ /// <param name="messageRecipient">The recipient to validate.</param>
+ /// <returns>The result of the request.</returns>
+ abstract protected DeliveryResult ValidateRecipientInternal(SmtpMessageRecipient messageRecipient);
+
+ /// <summary>
+ /// Spool a mail message.
+ /// </summary>
+ /// <param name="message">The message to be spooled.</param>
+ /// <returns>The result of the request.</returns>
+ abstract public DeliveryResult SpoolMessage(SmtpMessage message);
+
+ /// <summary>
+ /// Deliver a group of messages, including both connecting to remote SMTP
+ /// servers and the local store.
+ /// </summary>
+ /// <param name="batch">The batch of messages to deliver</param>
+ abstract public void DeliverMessages(DeliveryBatch batch);
+ }
+}
Copied: NMail/branches/luke-dev/NMail/DataTypes/IDnsClient.cs (from rev 49, NMail/branches/luke-dev/NMail/IDnsClient.cs)
===================================================================
--- NMail/branches/luke-dev/NMail/DataTypes/IDnsClient.cs (rev 0)
+++ NMail/branches/luke-dev/NMail/DataTypes/IDnsClient.cs 2006-07-01 15:34:40 UTC (rev 55)
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2004-2006 Luke Quinane and Daniel Frampton
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System;
+using System.Net;
+
+namespace NMail.DataTypes {
+ /// <summary>
+ /// The interface for NMail to access Dns.
+ /// </summary>
+ public interface IDnsClient {
+ /// <summary>
+ /// One of the IP addresses listed against this domain matches the given address.
+ /// </summary>
+ /// <param name="domain">The domain to compare.</param>
+ /// <param name="address">The address to compare.</param>
+ /// <returns>True if the domain matches the address.</returns>
+ bool DomainMatchesAddress(Domain domain, IPAddress address);
+
+ /// <summary>
+ /// Attempts to resolve the IP address to a domain name and returns a host
+ /// containing either the resolved domain name or the given IP address.
+ /// </summary>
+ /// <param name="address">The address to resolve.</param>
+ /// <returns>The resolved host.</returns>
+ Host ResolveHost(IPAddress address);
+
+ /// <summary>
+ /// Returns an IP address for the given domain.
+ /// </summary>
+ /// <param name="domain">The domain to resolve.</param>
+ /// <returns>The resolved IP address.</returns>
+ IPAddress ResolveIPAddress(Domain domain);
+
+ /// <summary>
+ /// Returns all valid MX records for the domain in order of preference.
+ /// </summary>
+ /// <remarks>Returns null when no MX records are found.</remarks>
+ /// <param name="domain">The domain to lookup the MX records for.</param>
+ /// <returns>The list of MX records or null.</returns>
+ Domain[] ResolveMXRecords(Domain domain);
+ }
+}
Copied: NMail/branches/luke-dev/NMail/DataTypes/IService.cs (from rev 49, NMail/branches/luke-dev/NMail/IService.cs)
===================================================================
--- NMail/branches/luke-dev/NMail/DataTypes/IService.cs (rev 0)
+++ NMail/branches/luke-dev/NMail/DataTypes/IService.cs 2006-07-01 15:34:40 UTC (rev 55)
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2004-2006 Luke Quinane and Daniel Frampton
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System;
+
+namespace NMail.DataTypes {
+ /// <summary>
+ /// A service to be hosted by NMail. This includes but it not
+ /// limited to SpoolService, POP3, SMTP and IMAP services.
+ /// </summary>
+ public interface IService {
+ /// <summary>
+ /// Initialise the service. All services are <b>Init</b>ialised before any services are <b>Start</b>ed.
+ /// </summary>
+ void Init();
+
+ /// <summary>
+ /// Start the service.
+ /// </summary>
+ /// <exception cref="System.InvalidOperationException">
+ /// If Start() is called before Init().
+ /// </exception>
+ void Start();
+
+ /// <summary>
+ /// Stop the service. It should be possible to resume the service with a subsequent call to Init and Start.
+ /// If you take too long (arbitrary) to Stop gracefully, then you may get an additional call to Stop
+ /// immediately on another thread, you must be able to handle this.
+ /// </summary>
+ void Stop(bool runCurrentToCompletion);
+
+ /// <summary>
+ /// Returns true if this service supports pausing processing without performing a complete shutdown.
+ /// </summary>
+ bool SupportsPause {get;}
+
+ /// <summary>
+ /// Pauses the service from processing but doesn't require a complete shutdown. E.g. a service may stop
+ /// accepting new connections or stop processing its work queue.
+ /// </summary>
+ /// <exception cref="System.InvalidOperationException">
+ /// If this service doesn't support pausing.
+ /// </exception>
+ void Pause();
+
+ /// <summary>
+ /// Continues processing following a pause command.
+ /// </summary>
+ /// <exception cref="System.InvalidOperationException">
+ /// If this service doesn't support pausing.
+ /// </exception>
+ void Continue();
+
+ /// <summary>
+ /// Reload the service configuration. This may recycle the service instance by stopping and discarding
+ /// the current IService and returning a new one.
+ /// </summary>
+ /// <remarks>
+ /// The service is <b>running</b> when this is called.
+ /// </remarks>
+ /// <exception cref="System.InvalidOperationException">
+ /// If this service is not running when this is called.
+ /// </exception>
+ IService ReloadConfiguration();
+
+ /// <summary>
+ /// Does this service support reloading configuration parameters on the fly?
+ /// </summary>
+ bool AllowsReloadConfiguration {get;}
+
+ /// <summary>
+ /// Is the service currently running?
+ /// </summary>
+ bool Running {get;}
+
+ /// <summary>
+ /// The name of this service.
+ /// </summary>
+ string Name {get;}
+
+ /// <summary>
+ /// The description of this service.
+ /// </summary>
+ string Description {get;}
+
+ /// <summary>
+ /// A URL for details on this service.
+ /// </summary>
+ Uri SupportUrl {get;}
+
+ /// <summary>
+ /// The event triggered when the service has been started.
+ /// </summary>
+ /// <remarks>
+ /// Running should return true when this event is recieved.
+ /// </remarks>
+ event EventHandler Started;
+
+ /// <summary>
+ /// The event triggered when the sevice has been stopped.
+ /// </summary>
+ /// <remarks>
+ /// Running should return false when this event is recieved.
+ /// </remarks>
+ event EventHandler Stopped;
+ }
+}
Copied: NMail/branches/luke-dev/NMail/DataTypes/ISmtpClient.cs (from rev 49, NMail/branches/luke-dev/NMail/ISmtpClient.cs)
===================================================================
--- NMail/branches/luke-dev/NMail/DataTypes/ISmtpClient.cs (rev 0)
+++ NMail/branches/luke-dev/NMail/DataTypes/ISmtpClient.cs 2006-07-01 15:34:40 UTC (rev 55)
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2004-2006 Luke Quinane and Daniel Frampton
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System;
+
+namespace NMail.DataTypes {
+ /// <summary>
+ /// The interface for a SMTP client.
+ /// </summary>
+ public interface ISmtpClient {
+ /// <summary>
+ /// Connects to an MX for the given destination.
+ /// </summary>
+ /// <param name="destination">The destination address.</param>
+ void Connect(Host destination);
+
+ /// <summary>
+ /// Sends the given message.
+ /// </summary>
+ /// <param name="message">The message to send.</param>
+ /// <returns>The result of the delivery attempt.</returns>
+ SmtpDeliveryResult Send(SmtpMessage message);
+
+ /// <summary>
+ /// Closes the connection to the remote server.
+ /// </summary>
+ void Close();
+ }
+}
Copied: NMail/branches/luke-dev/NMail/DataTypes/LocalStore/ILocalStore.cs (from rev 49, NMail/branches/luke-dev/NMail/ILocalStore.cs)
===================================================================
--- NMail/branches/luke-dev/NMail/DataTypes/LocalStore/ILocalStore.cs (rev 0)
+++ NMail/branches/luke-dev/NMail/DataTypes/LocalStore/ILocalStore.cs 2006-07-01 15:34:40 UTC (rev 55)
@@ -0,0 +1,773 @@
+/*
+ * Copyright 2004-2006 Luke Quinane and Daniel Frampton
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System;
+
+using NMail.Authentication;
+using NMail.DataTypes;
+using NMail.DataTypes.ACLs;
+
+namespace NMail.DataTypes.LocalStore {
+ /// <summary>
+ /// The interface for a local store.
+ /// </summary>
+ public interface ILocalStore {
+ /// <summary>
+ /// Gets the folder delimiter for this local store.
+ /// </summary>
+ char FolderDelimiter {get;}
+
+ #region Delivery Validation
+ /// <summary>
+ /// Checks if this local store handles mail for the given hostname.
+ /// </summary>
+ /// <param name="host">The host to check.</param>
+ /// <returns>True if the store accepts mail for the hostname.</returns>
+ bool WithinLocalStore(Host host);
+
+ /// <summary>
+ /// Checks if the given recipient is valid for this local store.
+ /// </summary>
+ /// <param name="recipient">The recipient to check.</param>
+ /// <returns>The result of the validation.</returns>
+ DeliveryResult ValidateRecipient(SmtpMessageRecipient recipient);
+ #endregion
+
+ #region Message Delivery
+ /// <summary>
+ /// Delivers the given recipient and message into the local store.
+ /// </summary>
+ /// <param name="recipient">The recipient and message to deliver.</param>
+ /// <returns>The result of the delivery attempt.</returns>
+ RecipientDeliveryResult DeliverMessage(SmtpMessageRecipient recipient);
+
+ /// <summary>
+ /// Delivers the message into the given folder.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials of the current user.</param>
+ /// <param name="message">The message to deliver.</param>
+ /// <param name="folder">The folder to deliver the message into.</param>
+ /// <returns>The result of the delivery.</returns>
+ DeliveryResult DeliverMessage(IAuthenticationToken authToken, Message message, StoreFolder folder);
+ #endregion
+
+ #region Folder Retrieval and Manipulation
+ /// <summary>
+ /// Gets the nominal folder for the given authentication creditials.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <returns>The nominal store folder or null if the authentication token is invalid.</returns>
+ StoreFolder GetNominalStoreFolder(IAuthenticationToken authToken);
+
+ /// <summary>
+ /// Gets the store folder from the given folder name.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="folder">The folder to lookup.</param>
+ /// <returns>The store folder or null if the folder name is invalid.</returns>
+ StoreFolder GetStoreFolder(IAuthenticationToken authToken, string folder);
+
+ /// <summary>
+ /// Gets the store folder from the given folder Id.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="folderId">The Id of the folder to lookup.</param>
+ /// <returns>The store folder or null if the folder Id is invalid.</returns>
+ StoreFolder GetStoreFolder(IAuthenticationToken authToken, int folderId);
+
+ /// <summary>
+ /// Creates a new folder.
+ /// </summary>
+ /// <remarks>
+ /// It is a requirement of the local store that each new folder get an incremented Id number.
+ /// </remarks>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="newFolder">The folder to create.</param>
+ /// <returns>The result of the create attempt.</returns>
+ LocalStoreFolderResult CreateFolder(IAuthenticationToken authToken, string newFolder);
+
+ /// <summary>
+ /// Deletes an existing folder.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="folderId">The Id of the folder to delete.</param>
+ /// <returns>The result of the delete attempt.</returns>
+ LocalStoreFolderResult DeleteFolder(IAuthenticationToken authToken, int folderId);
+
+ /// <summary>
+ /// Renames an existing folder in the local store.
+ /// </summary>
+ /// <remarks>
+ /// It is a requirement of the local store that a renamed folder and all its sub-folder get a new
+ /// folder Id. Futher, this new Id number cannot have been used previously.
+ ///
+ /// Thus any existing folder Ids for the rename folder or its childed obtained before the rename may
+ /// be altered and must be reaquired from the local store.
+ /// </remarks>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="folder">The folder to rename.</param>
+ /// <param name="newFolder">The new folder name.</param>
+ /// <returns>The result of the rename attempt.</returns>
+ LocalStoreFolderResult RenameFolder(IAuthenticationToken authToken, StoreFolder folder, string newFolder);
+
+ /// <summary>
+ /// Gets a list of folders that match the query folder.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="queryFolder">The query folder used in the lookup.</param>
+ /// <returns>The list of matching folders.</returns>
+ StoreFolder[] GetMatching(IAuthenticationToken authToken, string queryFolder);
+
+ /// <summary>
+ /// Gets a list of child folders for the given parent folder.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="parent">The parent to get the children from.</param>
+ /// <returns>The list of folders.</returns>
+ StoreFolder[] GetChildren(IAuthenticationToken authToken, StoreFolder parent);
+
+ /// <summary>
+ /// Gets a list of all folders
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <returns>The list of folders.</returns>
+ StoreFolder[] GetFolders(IAuthenticationToken authToken);
+ #endregion
+
+ #region Folder Subscription
+ /// <summary>
+ /// Gets a list of subscribed folders that match the query folder.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="queryFolder">The query folder used in the lookup.</param>
+ /// <returns>The list of folders.</returns>
+ StoreFolder[] GetSubscribed(IAuthenticationToken authToken, string queryFolder);
+
+ /// <summary>
+ /// Subscribes to a folder.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="folder">The folder to subscribe to.</param>
+ /// <returns>The result of the subscribe attempt.</returns>
+ LocalStoreFolderResult Subscribe(IAuthenticationToken authToken, StoreFolder folder);
+
+ /// <summary>
+ /// Un-subscribes from a folder.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="folder">The folder to unsubscribe from.</param>
+ void UnSubscribe(IAuthenticationToken authToken, StoreFolder folder);
+ #endregion
+
+ #region Message Id and Offset
+ /// <summary>
+ /// Gets the Id for the next message in the folder after the current Id.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="currentId">The Id to start looking from.</param>
+ /// <param name="folder"></param>
+ /// <returns>The Id of the next existing message or 0 if there is none.</returns>
+ int GetNextMessageId(IAuthenticationToken authToken, int currentId, StoreFolder folder);
+
+ /// <summary>
+ /// Gets the Id for the next message to be added into the folder.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="folder">The folder the message is in.</param>
+ /// <returns>The next message Id or 0 if insufficient privileges.</returns>
+ int GetNextMessageId(IAuthenticationToken authToken, StoreFolder folder);
+
+ /// <summary>
+ /// Gets the message Id (UID) corresponding to the given message offset.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="messageOffset">The offset of the message to lookup.</param>
+ /// <param name="folder">The folder the message is in.</param>
+ /// <returns>The message Id or 0 if there is no such message.</returns>
+ int GetMessageId(IAuthenticationToken authToken, int messageOffset, StoreFolder folder);
+
+ /// <summary>
+ /// Gets the message offset corresponding the to given message Id (UID).
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="messageId">The Id of the message to lookup.</param>
+ /// <param name="folder">The folder the message is in.</param>
+ /// <returns>The message offset or 0 if there is no such message.</returns>
+ int GetMessageOffset(IAuthenticationToken authToken, int messageId, StoreFolder folder);
+ #endregion
+
+ #region Message Flags
+ /// <summary>
+ /// Gets the message flags for a message.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="messageId">The Id of the message to get the flags for.</param>
+ /// <param name="folder">The folder the message is in.</param>
+ /// <returns>The message flags or null if invalid folder or privileges.</returns>
+ StoreMessageFlags? GetMessageFlags(IAuthenticationToken authToken, int messageId, StoreFolder folder);
+
+ /// <summary>
+ /// Sets the message flags for a message.
+ /// </summary>
+ /// <remarks>This will replace any existing flags on the message.</remarks>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="messageId">The Id of the message to set the flags for.</param>
+ /// <param name="folder">The folder the message is in.</param>
+ /// <param name="flags">The flags to set.</param>
+ void SetMessageFlags(IAuthenticationToken authToken, int messageId, StoreFolder folder, StoreMessageFlags flags);
+ #endregion
+
+ #region Message Retrieval
+ /// <summary>
+ /// Gets the internal date for the message.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="messageId">The Id of the message to get the date for.</param>
+ /// <param name="folder">The folder the message is in.</param>
+ /// <returns>The message date or null if invalid folder or privileges.</returns>
+ DateTime? GetInternalDate(IAuthenticationToken authToken, int messageId, StoreFolder folder);
+
+ /// <summary>
+ /// Gets the size of the message.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="messageId">The Id of the message to get the size from.</param>
+ /// <param name="folder">The folder the message is in.</param>
+ /// <returns>The message size in bytes or null if invalid folder or privileges.</returns>
+ int? GetMessageSize(IAuthenticationToken authToken, int messageId, StoreFolder folder);
+
+ /// <summary>
+ /// Gets the headers for the message.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="messageId">The Id of the message to get the headers for.</param>
+ /// <param name="folder">The folder the message is in.</param>
+ /// <returns>The message headers or null if none exist.</returns>
+ MessageHeaders GetMessageHeaders(IAuthenticationToken authToken, int messageId, StoreFolder folder);
+
+ /// <summary>
+ /// Gets a specific MIME part from the message.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="messageId">The Id of the message to get the headers for.</param>
+ /// <param name="folder">The folder the message is in.</param>
+ /// <param name="messagePart">The number of the part to get.</param>
+ /// <returns>The MIME part or null if the part is invalid.</returns>
+ IMessageBodyPart GetMessageMimePart(IAuthenticationToken authToken, int messageId, StoreFolder folder, int messagePart);
+
+ /// <summary>
+ /// Gets the entire message.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="messageId">The Id of the message to get.</param>
+ /// <param name="folder">The folder the message is in.</param>
+ /// <returns>The message or null if the message Id is invalid.</returns>
+ Message GetMessage(IAuthenticationToken authToken, int messageId, StoreFolder folder);
+ #endregion
+
+ #region Message Counts
+ /// <summary>
+ /// Gets the number of messages in the given store folder.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="folder">The folder to count the messages in.</param>
+ /// <returns>The message count or null if invalid folder or privileges.</returns>
+ int? GetMessageCount(IAuthenticationToken authToken, StoreFolder folder);
+
+ /// <summary>
+ /// Gets the number of messages with the RECENT flag set.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="folder">The folder to count the recent messages in.</param>
+ /// <returns>The number of recent messages or null if invalid folder or privileges.</returns>
+ int? GetRecentMessageCount(IAuthenticationToken authToken, StoreFolder folder);
+ #endregion
+
+ /// <summary>
+ /// Permanently removes messages flagged as deleted.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="folder">The folder to delete messages in.</param>
+ /// <returns>
+ /// The list of message offsets for the deleted messages or null if insufficient
+ /// privileges or invalid folder.
+ /// </returns>
+ int[] PurgeDeletedMessages(IAuthenticationToken authToken, StoreFolder folder);
+
+ #region Folder ACLs
+ /// <summary>
+ /// Sets the privileges on the folder. If no ACE exists for the associated
+ /// identifier one is added.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="folder">The folder to set the ACE on.</param>
+ /// <param name="ace">The privileges and the identifier to put.</param>
+ void SetStoreFolderAce(IAuthenticationToken authToken, StoreFolder folder, GenericAce<StoreFolderPrivilege> ace);
+
+ /// <summary>
+ /// Removes any ACE associated with the given user.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="folder">The folder to remove the ACE from.</param>
+ /// <param name="identifier">The identifier to remove from the ACL.</param>
+ void RemoveStoreFolderAce(IAuthenticationToken authToken, StoreFolder folder, string identifier);
+
+ /// <summary>
+ /// Gets the ACL for the given folder.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="folderId">The Id of the folder to get the ACL for.</param>
+ /// <returns>The folder ACL or null if insufficient privileges.</returns>
+ StoreFolderAcl GetStoreFolderAcl(IAuthenticationToken authToken, int folderId);
+ #endregion
+
+ #region Load and Save Object
+ /// <summary>
+ /// Gets a serialized object that can be used by either an validation or a delivery action.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="type">The requesting class' type.</param>
+ /// <param name="key">A key to identify which object to get.</param>
+ /// <returns>The object.</returns>
+ object LoadOjbect(IAuthenticationToken authToken, Type type, string key);
+
+ /// <summary>
+ /// Serializes an object that can be used later by either an validation or a delivery action.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="type">The requesting class' type.</param>
+ /// <param name="key">A key to identify the object at load time.</param>
+ void SaveObject(IAuthenticationToken authToken, object o, Type type, string key);
+ #endregion
+
+ #region User Management
+ /// <summary>
+ /// Gets the user for the given username.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="username">The username to look up.</param>
+ /// <returns>The matching user or null if non is found.</returns>
+ LocalStoreUser GetUser(IAuthenticationToken authToken, string username);
+
+ /// <summary>
+ /// Gets the user for the given user Id.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="userId">The Id of the user to look up.</param>
+ /// <returns>The matching user or null if non is found.</returns>
+ LocalStoreUser GetUser(IAuthenticationToken authToken, int userId);
+
+ /// <summary>
+ /// Gets the list of users that currently exist in the local store.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <returns>The list of users.</returns>
+ LocalStoreUser[] GetUsers(IAuthenticationToken authToken);
+
+ /// <summary>
+ /// Creates a new user in the local store and creates an initial folder.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="userName">The name of the new user.</param>
+ /// <param name="warnQuota">The warning quota level.</param>
+ /// <param name="hardQuota">The hard quota.</param>
+ /// <returns>The result of the attemp to create a new user.</returns>
+ LocalStoreUserResult CreateUser(IAuthenticationToken authToken, string userName, int? warnQuota, int? hardQuota);
+
+ /// <summary>
+ /// Removes a user from the local store.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="userId">The Id of the user to delete.</param>
+ /// <returns>The result of the attempt to delete a user.</returns>
+ LocalStoreUserResult DeleteUser(IAuthenticationToken authToken, int userId);
+
+ /// <summary>
+ /// Updates the any changes to the user into the local store.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="user">The user details to update.</param>
+ /// <returns>The result of the attempt to update the user.</returns>
+ LocalStoreUserResult UpdateUser(IAuthenticationToken authToken, LocalStoreUser user);
+
+ /// <summary>
+ /// Gets the list of email addresses that map to the given user.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="userId">The Id of the user to look up the addresses for.</param>
+ /// <returns>The user's email addresses.</returns>
+ EmailAddress[] GetUserAddresses(IAuthenticationToken authToken, int userId);
+
+ /// <summary>
+ /// Adds the given address the to list of addresses for the user.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="userId">The Id of the user to add the address for.</param>
+ /// <param name="address">The address to add.</param>
+ void AddUserAddress(IAuthenticationToken authToken, int userId, EmailAddress address);
+
+ /// <summary>
+ /// Removes the given address from the list of addresses for the user.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="userId">The Id of the user to remove the address from.</param>
+ /// <param name="address">The address to remove.</param>
+ void RemoveUserAddress(IAuthenticationToken authToken, int userId, EmailAddress address);
+
+ /// <summary>
+ /// Adds a user to the given mail domain.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="userId">The Id of the user to add.</param>
+ /// <param name="mailDomainId">The Id of the mail domain to add the user to.</param>
+ /// <returns>The result of the attempt to add the user to the mail domain.</returns>
+ LocalStoreUserResult AddUserToMailDomain(IAuthenticationToken authToken, int userId, int mailDomainId);
+
+ /// <summary>
+ /// Removes user from the given mail domain.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="userId">The Id of the user to remove.</param>
+ /// <param name="mailDomainId">The Id of the mail domain to revome the user from.</param>
+ /// <returns>The result of the attempt to remove the user from the mail domain.</returns>
+ LocalStoreUserResult RemoveUserFromMailDomain(IAuthenticationToken authToken, int userId, int mailDomainId);
+
+ /// <summary>
+ /// Gets a list of folder that belong to the user with the given user Id.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="userId">The Id of the user to get the folder for.</param>
+ /// <returns>The list of folders or null if the user Id is invalid or unauthorized.</returns>
+ StoreFolder[] GetUserFolders(IAuthenticationToken authToken, int userId);
+ #endregion
+
+ #region Group Management
+ /// <summary>
+ /// Gets the group for the given name.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="name">The name to look up.</param>
+ /// <returns>The matching group or null if non is found.</returns>
+ LocalStoreGroup GetGroup(IAuthenticationToken authToken, string name);
+
+ /// <summary>
+ /// Gets the group for the given user Id.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="groupId">The Id of the group to look up.</param>
+ /// <returns>The matching group or null if non is found.</returns>
+ LocalStoreGroup GetGroup(IAuthenticationToken authToken, int groupId);
+
+ /// <summary>
+ /// Gets the list of groups that currently exist in the local store.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <returns>The list of groups.</returns>
+ LocalStoreGroup[] GetGroups(IAuthenticationToken authToken);
+
+ /// <summary>
+ /// Creates a new group in the local store.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="name">The name of the new group.</param>
+ /// <returns>The result of the attemp to create a new group.</returns>
+ LocalStoreGroupResult CreateGroup(IAuthenticationToken authToken, string name);
+
+ /// <summary>
+ /// Removes a group from the local store.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="groupId">The Id of the group to delete.</param>
+ /// <returns>The result of the attempt to delete a group.</returns>
+ LocalStoreGroupResult DeleteGroup(IAuthenticationToken authToken, int groupId);
+
+ /// <summary>
+ /// Renames the group.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="groupId">The Id of the group to delete.</param>
+ /// <param name="newName">The new name for the group.</param>
+ /// <returns>The result of the attempt to rename the group.</returns>
+ LocalStoreGroupResult RenameGroup(IAuthenticationToken authToken, LocalStoreGroup group);
+
+ /// <summary>
+ /// Adds a child group to the given group.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="groupId">The child group to add.</param>
+ /// <param name="parentId">The group to add the child to.</param>
+ /// <returns>The result of the attempt to add.</returns>
+ LocalStoreGroupResult AddGroupToGroup(IAuthenticationToken authToken, int parentId, int groupId);
+
+ /// <summary>
+ /// Removes a child group from the given group.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="groupId">The child group to remove.</param>
+ /// <param name="parentId">The group to remove the child from.</param>
+ /// <returns>The result of the attempt to remove.</returns>
+ LocalStoreGroupResult RemoveGroupFromGroup(IAuthenticationToken authToken, int parentId, int groupId);
+
+ /// <summary>
+ /// Adds a group to the given mail domain.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="groupId">The Id of the group to add.</param>
+ /// <param name="mailDomainId">The Id of the mail domain to add the group to.</param>
+ LocalStoreGroupResult AddGroupToMailDomain(IAuthenticationToken authToken, int groupId, int mailDomainId);
+
+ /// <summary>
+ /// Removes group from the given mail domain.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="groupId">The Id of the group to remove.</param>
+ /// <param name="mailDomainId">The Id of the mail domain to revome the group from.</param>
+ LocalStoreGroupResult RemoveGroupFromMailDomain(IAuthenticationToken authToken, int groupId, int mailDomainId);
+ #endregion
+
+ #region Mail Domain Management
+ /// <summary>
+ /// Gets all mail domains associated with this local store.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <returns>The mail domains.</returns>
+ MailDomain[] GetMailDomains(IAuthenticationToken authToken);
+
+ /// <summary>
+ /// Creates a new mail domain for the given host.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="host">The primary host for the mail domain.</param>
+ /// <returns>The result of the attempt to add the mail domain.</returns>
+ LocalStoreMailDomainResult CreateMailDomain(IAuthenticationToken authToken, Host host);
+
+ /// <summary>
+ /// Deletes a mail domain from the local store.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="mailDomainId">The Id of the mail domain to delete.</param>
+ /// <returns>The result of the attempt to delete the domain.</returns>
+ LocalStoreMailDomainResult DeleteMailDomain(IAuthenticationToken authToken, int mailDomainId);
+
+ /// <summary>
+ /// Updates a mail domain in the local store.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="updatedMailDomain">The updated mail domain.</param>
+ /// <returns>The result of the attempt to update the mail domain.</returns>
+ LocalStoreMailDomainResult UpdateMailDomain(IAuthenticationToken authToken, MailDomain updatedMailDomain);
+
+ /// <summary>
+ /// Gets a list of group Ids for groups that are associated with the given
+ /// mail domain Id.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="mailDomainId">The mail domain to look up the groups for.</param>
+ /// <returns>The list of group Ids.</returns>
+ int[] GetMailDomainGroups(IAuthenticationToken authToken, int mailDomainId);
+
+ /// <summary>
+ /// Gets a list of user Ids for groups that are associated with the given
+ /// mail domain Id.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="mailDomainId">The mail domain to look up the users for.</param>
+ /// <returns>The list of user Ids.</returns>
+ int[] GetMailDomainUsers(IAuthenticationToken authToken, int mailDomainId);
+ #endregion
+
+ #region System ACL
+ /// <summary>
+ /// Sets the system privileges for the associated identifier. If no ACE exists for
+ /// the associated identifier one is added.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="ace">The privileges and the identifier to put.</param>
+ void SetSystemPrivilegeAce(IAuthenticationToken authToken, GenericAce<SystemPrivilege> ace);
+
+ /// <summary>
+ /// Removes any ACE associated with the given identifier.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="identifier">The identifier to remove from the ACL.</param>
+ void RemoveSystemPrivilegeAce(IAuthenticationToken authToken, string identifier);
+
+ /// <summary>
+ /// Gets the system ACL.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <returns>The system ACL or null if insufficient privileges.</returns>
+ GenericAcl<SystemPrivilege> GetSystemPrivilegeAcl(IAuthenticationToken authToken);
+ #endregion
+
+ #region User and Group Administration
+ /// <summary>
+ /// Get the ACL that lists user's privileges for user and group administration.
+ /// </summary>
+ /// <param name="user">The user trying to get the admin ACL.</param>
+ /// <returns>The ACL or null if insufficient privileges.</returns>
+ GenericAcl<UserGroupAdminPrivilege> GetAdministrationAcl(IAuthenticationToken user);
+
+ /// <summary>
+ /// Sets the administration privileges for the associated identifier.
+ /// If no ACE exists for the associated identifier one is added.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="ace">The privileges and the identifier to put.</param>
+ void SetAdministrationAce(IAuthenticationToken authToken, GenericAce<SystemPrivilege> ace);
+
+ /// <summary>
+ /// Removes any ACE associated with the given identifier.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="identifier">The identifier to remove from the ACL.</param>
+ void RemoveAdministrationAce(IAuthenticationToken authToken, string identifier);
+ #endregion
+ }
+
+ /// <summary>
+ /// Possible return results for local store folder operations.
+ /// </summary>
+ public enum LocalStoreFolderResult {
+ /// <summary>
+ /// The operation was completed successfully.
+ /// </summary>
+ OkSuccessful = 0,
+
+ /// <summary>
+ /// The create or rename failed because a folder with the same name already existed.
+ /// </summary>
+ AlreadyExists = 1,
+
+ /// <summary>
+ /// The folder was not deleted because it contained child folders.
+ /// </summary>
+ HasChildren = 2,
+
+ /// <summary>
+ /// The operation failed because the source folder was not found on the server.
+ /// If the operation is on a subfolder that the user can't see due to permissions
+ /// this will be returned.
+ /// </summary>
+ NonExistent = 3,
+
+ /// <summary>
+ /// The user is not permitted to perform the operation.
+ /// </summary>
+ NotPermitted = 4
+ }
+
+ /// <summary>
+ /// Possible return results for local store user operations.
+ /// </summary>
+ public enum LocalStoreUserResult {
+ /// <summary>
+ /// The operation completed successfully.
+ /// </summary>
+ OkSuccessful = 0,
+
+ /// <summary>
+ /// A user with the same name already exists.
+ /// </summary>
+ AlreadyExists = 1,
+
+ /// <summary>
+ /// No matching user exists in the local store.
+ /// </summary>
+ NoSuchUser = 2,
+
+ /// <summary>
+ /// Cannot add or remove the user from the mail domain because it doens't exist.
+ /// </summary>
+ NoSuchMailDomain = 3,
+
+ /// <summary>
+ /// The user cannot be deleted because they still own folders.
+ /// </summary>
+ UserStillHasFolders = 4,
+
+ /// <summary>
+ /// The user is not permitted to perform the operation.
+ /// </summary>
+ NotPermitted = 5,
+
+ /// <summary>
+ /// The user cannot be created because there is existing folders with the same details.
+ /// </summary>
+ FoldersAlreadyExist = 6,
+
+ /// <summary>
+ /// An unknown error occurred trying to perform the operation.
+ /// </summary>
+ UnkownError = 7
+ }
+
+ /// <summary>
+ /// Possible return results for local store group operations.
+ /// </summary>
+ public enum LocalStoreGroupResult {
+ /// <summary>
+ /// The operation completed successfully.
+ /// </summary>
+ OkSuccessful = 0,
+
+ /// <summary>
+ /// A group with the same name already exists.
+ /// </summary>
+ AlreadyExists = 1,
+
+ /// <summary>
+ /// No matching group exists in the local store.
+ /// </summary>
+ NoSuchGroup = 2,
+
+ /// <summary>
+ /// Cannot add or remove the group from the mail domain because it doens't exist.
+ /// </summary>
+ NoSuchMailDomain = 3,
+
+ /// <summary>
+ /// The user is not permitted to perform the operation.
+ /// </summary>
+ NotPermitted = 4
+ }
+
+ /// <summary>
+ /// Possible return results for local store mail domain operations.
+ /// </summary>
+ public enum LocalStoreMailDomainResult {
+ /// <summary>
+ /// The operation completed successfully.
+ /// </summary>
+ OkSuccessful = 0,
+
+ /// <summary>
+ /// A mail domain with the same primary host already exists.
+ /// </summary>
+ AlreadyExists = 1,
+
+ /// <summary>
+ /// No matching mail domain exists in the local store.
+ /// </summary>
+ NoSuchMailDomain = 2,
+
+ /// <summary>
+ /// The user is not permitted to perform the operation.
+ /// </summary>
+ NotPermitted = 3
+ }
+}
Copied: NMail/branches/luke-dev/NMail/DataTypes/LocalStore/ILocalStoreData.cs (from rev 49, NMail/branches/luke-dev/NMail/ILocalStoreData.cs)
===================================================================
--- NMail/branches/luke-dev/NMail/DataTypes/LocalStore/ILocalStoreData.cs (rev 0)
+++ NMail/branches/luke-dev/NMail/DataTypes/LocalStore/ILocalStoreData.cs 2006-07-01 15:34:40 UTC (rev 55)
@@ -0,0 +1,521 @@
+/*
+ * Copyright 2004-2006 Luke Quinane and Daniel Frampton
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System;
+using System.Data;
+
+using NMail.DataTypes;
+using NMail.DataTypes.ACLs;
+
+namespace NMail.DataTypes.LocalStore {
+ /// <summary>
+ /// The interface for a local store data provider.
+ /// </summary>
+ public interface ILocalStoreData {
+ #region Message Delivery
+ /// <summary>
+ /// Delivers the message into the given folder.
+ /// </summary>
+ /// <param name="message">The details of the delivery.</param>
+ void DeliverMessage(LocalStoreDelivery message);
+
+ /// <summary>
+ /// Delivers the message into the given folder.
+ /// </summary>
+ /// <param name="message">The message data.</param>
+ /// <param name="folder">The folder to deliver into.</param>
+ void DeliverMessage(Message message, StoreFolder folder);
+ #endregion
+
+ #region Folder Retrieval and Manipulation
+ /// <summary>
+ /// Gets the nominal folder for the given user name.
+ /// </summary>
+ /// <param name="userName">The user to get the folder for.</param>
+ /// <returns>The nominal store folder or null if the username is invalid.</returns>
+ StoreFolder GetNominalStoreFolder(string userName);
+
+ /// <summary>
+ /// Gets the store folder from the given folder name.
+ /// </summary>
+ /// <param name="folder">The folder to lookup.</param>
+ /// <returns>The store folder or null if the folder name is invalid.</returns>
+ StoreFolder GetStoreFolder(Folder folder);
+
+ /// <summary>
+ /// Gets the store folder from the given folder Id.
+ /// </summary>
+ /// <param name="folderId">The Id of the folder to lookup.</param>
+ /// <returns>The store folder or null if the folder Id is invali...
[truncated message content] |