nmailserver-commits Mailing List for NMail (Page 4)
Brought to you by:
dframpton-oss,
tmyroadctfig
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(13) |
Jun
(14) |
Jul
(8) |
Aug
|
Sep
|
Oct
(8) |
Nov
(22) |
Dec
(9) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(21) |
Feb
(31) |
Mar
(24) |
Apr
(8) |
May
(23) |
Jun
(40) |
Jul
(14) |
Aug
(5) |
Sep
(7) |
Oct
(10) |
Nov
|
Dec
|
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <tmy...@us...> - 2007-06-10 03:33:59
|
Revision: 212
http://svn.sourceforge.net/nmailserver/?rev=212&view=rev
Author: tmyroadctfig
Date: 2007-06-09 20:33:59 -0700 (Sat, 09 Jun 2007)
Log Message:
-----------
Fixed minor defect in type converters.
Modified Paths:
--------------
NMail/trunk/NMail/Configuration/ObjectConfigurationElement.cs
NMail/trunk/NMail/DataTypes/Host.cs
Modified: NMail/trunk/NMail/Configuration/ObjectConfigurationElement.cs
===================================================================
--- NMail/trunk/NMail/Configuration/ObjectConfigurationElement.cs 2007-06-10 03:32:48 UTC (rev 211)
+++ NMail/trunk/NMail/Configuration/ObjectConfigurationElement.cs 2007-06-10 03:33:59 UTC (rev 212)
@@ -95,7 +95,7 @@
}
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) {
- if (destinationType == typeof(string)) {
+ if (value != null && destinationType == typeof(string)) {
Type t = (Type) value;
return string.Format("{0}, {1}", t.FullName, t.Assembly.GetName().Name);
Modified: NMail/trunk/NMail/DataTypes/Host.cs
===================================================================
--- NMail/trunk/NMail/DataTypes/Host.cs 2007-06-10 03:32:48 UTC (rev 211)
+++ NMail/trunk/NMail/DataTypes/Host.cs 2007-06-10 03:33:59 UTC (rev 212)
@@ -285,7 +285,7 @@
}
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) {
- if (destinationType == typeof(string)) {
+ if (value != null && destinationType == typeof(string)) {
return value.ToString();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2007-06-10 03:32:49
|
Revision: 211
http://svn.sourceforge.net/nmailserver/?rev=211&view=rev
Author: tmyroadctfig
Date: 2007-06-09 20:32:48 -0700 (Sat, 09 Jun 2007)
Log Message:
-----------
Further work on mail domain administration in UI.
Modified Paths:
--------------
NMail/trunk/NMail.Administration.WinForms/AuthenticationPrompt.Designer.cs
NMail/trunk/NMail.Administration.WinForms/AuthenticationPrompt.cs
NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.Designer.cs
NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.cs
NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.resx
NMail/trunk/NMail.Administration.WinForms/MainForm.cs
NMail/trunk/NMail.Administration.WinForms/NMail.Administration.WinForms.csproj
NMail/trunk/NMail.Icons/NMail.Icons.csproj
Added Paths:
-----------
NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainEditor.Designer.cs
NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainEditor.cs
NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainEditor.resx
NMail/trunk/NMail.Icons/Resources/16x16/actions/delete.png
NMail/trunk/NMail.Icons/Resources/16x16/actions/edit.png
Modified: NMail/trunk/NMail.Administration.WinForms/AuthenticationPrompt.Designer.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/AuthenticationPrompt.Designer.cs 2007-05-31 12:13:10 UTC (rev 210)
+++ NMail/trunk/NMail.Administration.WinForms/AuthenticationPrompt.Designer.cs 2007-06-10 03:32:48 UTC (rev 211)
@@ -69,6 +69,7 @@
this.userNameTextBox.Name = "userNameTextBox";
this.userNameTextBox.Size = new System.Drawing.Size(132, 20);
this.userNameTextBox.TabIndex = 6;
+ this.userNameTextBox.Text = "Administrator";
//
// pictureBox1
//
Modified: NMail/trunk/NMail.Administration.WinForms/AuthenticationPrompt.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/AuthenticationPrompt.cs 2007-05-31 12:13:10 UTC (rev 210)
+++ NMail/trunk/NMail.Administration.WinForms/AuthenticationPrompt.cs 2007-06-10 03:32:48 UTC (rev 211)
@@ -33,6 +33,11 @@
this.pictureBox1.Image = IconHelper.GetImage("password", "apps", IconSize.s32x32);
}
+ protected override void OnShown(EventArgs e) {
+ base.OnShown(e);
+ this.passwordTextBox.Focus();
+ }
+
private void cancelButton_Click(object sender, EventArgs e) {
this.DialogResult = DialogResult.Cancel;
this.Close();
Added: NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainEditor.Designer.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainEditor.Designer.cs (rev 0)
+++ NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainEditor.Designer.cs 2007-06-10 03:32:48 UTC (rev 211)
@@ -0,0 +1,97 @@
+namespace NMail.Administration.WinForms.MailDomain {
+ partial class MailDomainEditor {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent() {
+ this.propertyGrid = new System.Windows.Forms.PropertyGrid();
+ this.bottomPanel = new System.Windows.Forms.Panel();
+ this.cancelButton = new System.Windows.Forms.Button();
+ this.okButton = new System.Windows.Forms.Button();
+ this.bottomPanel.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // propertyGrid
+ //
+ this.propertyGrid.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.propertyGrid.Location = new System.Drawing.Point(0, 0);
+ this.propertyGrid.Name = "propertyGrid";
+ this.propertyGrid.Size = new System.Drawing.Size(312, 266);
+ this.propertyGrid.TabIndex = 0;
+ //
+ // bottomPanel
+ //
+ this.bottomPanel.Controls.Add(this.cancelButton);
+ this.bottomPanel.Controls.Add(this.okButton);
+ this.bottomPanel.Dock = System.Windows.Forms.DockStyle.Bottom;
+ this.bottomPanel.Location = new System.Drawing.Point(0, 266);
+ this.bottomPanel.Name = "bottomPanel";
+ this.bottomPanel.Size = new System.Drawing.Size(312, 43);
+ this.bottomPanel.TabIndex = 1;
+ //
+ // cancelButton
+ //
+ this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ this.cancelButton.Location = new System.Drawing.Point(84, 6);
+ this.cancelButton.Name = "cancelButton";
+ this.cancelButton.Size = new System.Drawing.Size(75, 23);
+ this.cancelButton.TabIndex = 1;
+ this.cancelButton.Text = "Cancel";
+ this.cancelButton.UseVisualStyleBackColor = true;
+ this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
+ //
+ // okButton
+ //
+ this.okButton.Location = new System.Drawing.Point(3, 6);
+ this.okButton.Name = "okButton";
+ this.okButton.Size = new System.Drawing.Size(75, 23);
+ this.okButton.TabIndex = 0;
+ this.okButton.Text = "OK";
+ this.okButton.UseVisualStyleBackColor = true;
+ this.okButton.Click += new System.EventHandler(this.okButton_Click);
+ //
+ // MailDomainEditor
+ //
+ this.AcceptButton = this.okButton;
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.CancelButton = this.cancelButton;
+ this.ClientSize = new System.Drawing.Size(312, 309);
+ this.Controls.Add(this.propertyGrid);
+ this.Controls.Add(this.bottomPanel);
+ this.MinimumSize = new System.Drawing.Size(160, 100);
+ this.Name = "MailDomainEditor";
+ this.TabText = "Mail Domain Editor";
+ this.Text = "Mail Domain Editor";
+ this.bottomPanel.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.PropertyGrid propertyGrid;
+ private System.Windows.Forms.Panel bottomPanel;
+ private System.Windows.Forms.Button cancelButton;
+ private System.Windows.Forms.Button okButton;
+ }
+}
Added: NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainEditor.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainEditor.cs (rev 0)
+++ NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainEditor.cs 2007-06-10 03:32:48 UTC (rev 211)
@@ -0,0 +1,57 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Text;
+using System.Windows.Forms;
+
+using WeifenLuo.WinFormsUI.Docking;
+
+namespace NMail.Administration.WinForms.MailDomain {
+ /// <summary>
+ /// A simple editor for mail domains.
+ /// </summary>
+ public partial class MailDomainEditor : DockContent {
+ public MailDomainEditor() {
+ InitializeComponent();
+
+ this.MailDomain = new NMail.DataTypes.LocalStore.MailDomain();
+ }
+
+ /// <summary>
+ /// The text on the OK button.
+ /// </summary>
+ public string OkButtonText {
+ get {
+ return this.okButton.Text;
+ }
+ set {
+ this.okButton.Text = value;
+ }
+ }
+
+ private NMail.DataTypes.LocalStore.MailDomain mailDomain;
+
+ /// <summary>
+ /// The mail domain displayed in the editor.
+ /// </summary>
+ public NMail.DataTypes.LocalStore.MailDomain MailDomain {
+ get { return mailDomain; }
+ set {
+ mailDomain = value;
+ this.propertyGrid.SelectedObject = mailDomain;
+ }
+ }
+
+ private void okButton_Click(object sender, EventArgs e) {
+ this.DialogResult = DialogResult.OK;
+ this.Close();
+ }
+
+ private void cancelButton_Click(object sender, EventArgs e) {
+ this.DialogResult = DialogResult.Cancel;
+ this.Close();
+ }
+ }
+}
Added: NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainEditor.resx
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainEditor.resx (rev 0)
+++ NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainEditor.resx 2007-06-10 03:32:48 UTC (rev 211)
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
\ No newline at end of file
Modified: NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.Designer.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.Designer.cs 2007-05-31 12:13:10 UTC (rev 210)
+++ NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.Designer.cs 2007-06-10 03:32:48 UTC (rev 211)
@@ -23,33 +23,40 @@
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
- this.mainDomainsListView = new System.Windows.Forms.ListView();
+ this.components = new System.ComponentModel.Container();
+ this.mailDomainsListView = new System.Windows.Forms.ListView();
this.idColumnHeader = new System.Windows.Forms.ColumnHeader();
this.primaryHostColumnHeader = new System.Windows.Forms.ColumnHeader();
this.secondaryColumnHeader = new System.Windows.Forms.ColumnHeader();
- this.editColumnHeader = new System.Windows.Forms.ColumnHeader();
+ this.imageList = new System.Windows.Forms.ImageList(this.components);
this.bottomPanel = new System.Windows.Forms.Panel();
this.refreshButton = new System.Windows.Forms.Button();
+ this.mailDomainContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
+ this.addToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.editMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.bottomPanel.SuspendLayout();
+ this.mailDomainContextMenu.SuspendLayout();
this.SuspendLayout();
//
- // mainDomainsListView
+ // mailDomainsListView
//
- this.mainDomainsListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
+ this.mailDomainsListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.idColumnHeader,
this.primaryHostColumnHeader,
- this.secondaryColumnHeader,
- this.editColumnHeader});
- this.mainDomainsListView.Dock = System.Windows.Forms.DockStyle.Fill;
- this.mainDomainsListView.FullRowSelect = true;
- this.mainDomainsListView.GridLines = true;
- this.mainDomainsListView.HideSelection = false;
- this.mainDomainsListView.Location = new System.Drawing.Point(0, 0);
- this.mainDomainsListView.Name = "mainDomainsListView";
- this.mainDomainsListView.Size = new System.Drawing.Size(620, 369);
- this.mainDomainsListView.TabIndex = 1;
- this.mainDomainsListView.UseCompatibleStateImageBehavior = false;
- this.mainDomainsListView.View = System.Windows.Forms.View.Details;
+ this.secondaryColumnHeader});
+ this.mailDomainsListView.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.mailDomainsListView.FullRowSelect = true;
+ this.mailDomainsListView.GridLines = true;
+ this.mailDomainsListView.HideSelection = false;
+ this.mailDomainsListView.Location = new System.Drawing.Point(0, 0);
+ this.mailDomainsListView.Name = "mailDomainsListView";
+ this.mailDomainsListView.Size = new System.Drawing.Size(620, 369);
+ this.mailDomainsListView.SmallImageList = this.imageList;
+ this.mailDomainsListView.TabIndex = 1;
+ this.mailDomainsListView.UseCompatibleStateImageBehavior = false;
+ this.mailDomainsListView.View = System.Windows.Forms.View.Details;
+ this.mailDomainsListView.MouseClick += new System.Windows.Forms.MouseEventHandler(this.mailDomainsListView_MouseClick);
//
// idColumnHeader
//
@@ -66,9 +73,11 @@
this.secondaryColumnHeader.Text = "Additional Hosts";
this.secondaryColumnHeader.Width = 188;
//
- // editColumnHeader
+ // imageList
//
- this.editColumnHeader.Text = "Edit";
+ this.imageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
+ this.imageList.ImageSize = new System.Drawing.Size(16, 16);
+ this.imageList.TransparentColor = System.Drawing.Color.Transparent;
//
// bottomPanel
//
@@ -89,28 +98,63 @@
this.refreshButton.UseVisualStyleBackColor = true;
this.refreshButton.Click += new System.EventHandler(this.refreshButton_Click);
//
+ // mailDomainContextMenu
+ //
+ this.mailDomainContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.addToolStripMenuItem,
+ this.editMenuItem,
+ this.deleteToolStripMenuItem});
+ this.mailDomainContextMenu.Name = "mailDomainContextMenu";
+ this.mailDomainContextMenu.Size = new System.Drawing.Size(153, 92);
+ //
+ // addToolStripMenuItem
+ //
+ this.addToolStripMenuItem.Name = "addToolStripMenuItem";
+ this.addToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.addToolStripMenuItem.Text = "Add";
+ this.addToolStripMenuItem.Click += new System.EventHandler(this.addToolStripMenuItem_Click);
+ //
+ // editMenuItem
+ //
+ this.editMenuItem.Name = "editMenuItem";
+ this.editMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.editMenuItem.Text = "Edit...";
+ this.editMenuItem.Click += new System.EventHandler(this.editMenuItem_Click);
+ //
+ // deleteToolStripMenuItem
+ //
+ this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem";
+ this.deleteToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.deleteToolStripMenuItem.Text = "Delete";
+ this.deleteToolStripMenuItem.Click += new System.EventHandler(this.deleteToolStripMenuItem_Click);
+ //
// MailDomainManager
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.Controls.Add(this.mainDomainsListView);
+ this.Controls.Add(this.mailDomainsListView);
this.Controls.Add(this.bottomPanel);
this.Name = "MailDomainManager";
this.Size = new System.Drawing.Size(620, 408);
this.bottomPanel.ResumeLayout(false);
+ this.mailDomainContextMenu.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
- private System.Windows.Forms.ListView mainDomainsListView;
+ private System.Windows.Forms.ListView mailDomainsListView;
private System.Windows.Forms.ColumnHeader idColumnHeader;
private System.Windows.Forms.ColumnHeader primaryHostColumnHeader;
private System.Windows.Forms.ColumnHeader secondaryColumnHeader;
- private System.Windows.Forms.ColumnHeader editColumnHeader;
private System.Windows.Forms.Panel bottomPanel;
private System.Windows.Forms.Button refreshButton;
+ private System.Windows.Forms.ImageList imageList;
+ private System.Windows.Forms.ContextMenuStrip mailDomainContextMenu;
+ private System.Windows.Forms.ToolStripMenuItem editMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem deleteToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem addToolStripMenuItem;
}
}
Modified: NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.cs 2007-05-31 12:13:10 UTC (rev 210)
+++ NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.cs 2007-06-10 03:32:48 UTC (rev 211)
@@ -23,14 +23,24 @@
using System.Text;
using System.Windows.Forms;
+using WeifenLuo.WinFormsUI.Docking;
+
+using NMail.DataTypes;
using NMail.DataTypes.LocalStore;
+using NMail.Icons;
namespace NMail.Administration.WinForms.MailDomain {
+
public partial class MailDomainManager : UserControl {
public MailDomainManager(MainForm mainForm) {
InitializeComponent();
this.mainForm = mainForm;
+
+ this.imageList.Images.Add(IconHelper.GetImage("server", "actions", IconSize.s16x16));
+
+ this.editMenuItem.Image = IconHelper.GetImage("edit", "actions", IconSize.s16x16);
+ this.deleteToolStripMenuItem.Image = IconHelper.GetImage("delete", "actions", IconSize.s16x16);
}
MainForm mainForm;
@@ -41,11 +51,12 @@
ILocalStore localStore = this.mainForm.RemoteAdministration.NMailServer.LocalStore;
IList<NMail.DataTypes.LocalStore.MailDomain> mailDomains = localStore.GetMailDomains(this.mainForm.AuthenticationToken);
- this.mainDomainsListView.Items.Clear();
+ this.mailDomainsListView.Items.Clear();
// Add them to the list view
foreach (NMail.DataTypes.LocalStore.MailDomain mailDomain in mailDomains) {
-
+ ListViewItem item = new MailDomainListVieItem(mailDomain);
+ this.mailDomainsListView.Items.Add(item);
}
} catch (Exception ex) {
@@ -53,5 +64,129 @@
Program.ShowExceptionDialog(ex);
}
}
+
+ private MailDomainListVieItem clickedItem;
+
+ private void mailDomainsListView_MouseClick(object sender, MouseEventArgs e) {
+ if (e.Button == MouseButtons.Right) {
+ this.clickedItem = this.mailDomainsListView.GetItemAt(e.X, e.Y) as MailDomainListVieItem;
+ this.mailDomainContextMenu.Show(Control.MousePosition, ToolStripDropDownDirection.BelowRight);
+ }
+ }
+
+ private void addToolStripMenuItem_Click(object sender, EventArgs e) {
+ // Create a new editor and display it
+ MailDomainEditor editor = new MailDomainEditor();
+ editor.TabText = "Add Mail Domain";
+ editor.OkButtonText = "Add";
+ editor.Icon = IconHelper.GetIcon("server", "actions", IconSize.s16x16);
+ this.mainForm.DockFloat(editor, new Size(320, 440));
+
+ // Add a handler for the editor's closing event
+ editor.FormClosing += delegate(object s, FormClosingEventArgs fea) {
+
+ if (editor.DialogResult == DialogResult.OK) {
+ // Attempt to add the mail domain
+ try {
+ NMail.Authentication.IAuthenticationToken authToken = this.mainForm.AuthenticationToken;
+ this.mainForm.RemoteAdministration.NMailServer.LocalStore.CreateMailDomain(authToken, editor.MailDomain);
+ } catch (Exception ex) {
+ Program.ShowExceptionDialog(ex);
+ }
+
+ // Update the list of mail domains
+ refreshButton_Click(this, new EventArgs());
+ }
+ };
+ }
+
+ private void editMenuItem_Click(object sender, EventArgs e) {
+ if (this.clickedItem != null) {
+ // Create a new editor and display it
+ MailDomainEditor editor = new MailDomainEditor();
+ editor.Dock = DockStyle.Fill;
+ editor.TabText = "Edit Mail Domain";
+ editor.OkButtonText = "Update";
+ editor.Icon = IconHelper.GetIcon("server", "actions", IconSize.s16x16);
+ editor.MailDomain = this.clickedItem.MailDomain;
+ this.mainForm.DockFloat(editor, new Size(320, 440));
+
+ // Add a handler for the editor's closing event
+ editor.FormClosing += delegate(object s, FormClosingEventArgs fea) {
+
+ if (editor.DialogResult == DialogResult.OK) {
+ // Attempt to add the mail domain
+ try {
+ NMail.Authentication.IAuthenticationToken authToken = this.mainForm.AuthenticationToken;
+ this.mainForm.RemoteAdministration.NMailServer.LocalStore.UpdateMailDomain(authToken, editor.MailDomain);
+ } catch (Exception ex) {
+ Program.ShowExceptionDialog(ex);
+ }
+
+ // Update the list of mail domains
+ refreshButton_Click(this, new EventArgs());
+ }
+ };
+ }
+ }
+
+ private void deleteToolStripMenuItem_Click(object sender, EventArgs e) {
+ if (this.clickedItem != null) {
+ if (this.clickedItem.MailDomain.PrimaryHost.Domain == Domain.LocalHost) {
+
+ // Can't delete the localhost mail domain
+ MessageBox.Show(this,
+ "Can't delete the localhost mail domain.",
+ "Error",
+ MessageBoxButtons.OK,
+ MessageBoxIcon.Error);
+ return;
+ }
+
+ // Prompt the user to confirm deletion
+ DialogResult result = MessageBox.Show(
+ this,
+ string.Format("Really delete mail domain '{0}'?", this.clickedItem.MailDomain.PrimaryHost.ToString()),
+ "Confirm delete...",
+ MessageBoxButtons.YesNo,
+ MessageBoxIcon.Warning,
+ MessageBoxDefaultButton.Button2);
+
+ if (result == DialogResult.Yes) {
+ // Attempt to delete the mail domain
+ try {
+ NMail.Authentication.IAuthenticationToken authToken = this.mainForm.AuthenticationToken;
+ this.mainForm.RemoteAdministration.NMailServer.LocalStore.DeleteMailDomain(authToken, this.clickedItem.MailDomain.MailDomainId);
+ } catch (Exception ex) {
+ Program.ShowExceptionDialog(ex);
+ }
+ }
+ }
+ }
}
+
+ public class MailDomainListVieItem : ListViewItem {
+
+ private NMail.DataTypes.LocalStore.MailDomain mailDomain;
+
+ public MailDomainListVieItem(NMail.DataTypes.LocalStore.MailDomain mailDomain) {
+ this.mailDomain = mailDomain;
+
+ this.SubItems[0] = new ListViewSubItem(this, mailDomain.MailDomainId.ToString());
+ this.SubItems.Add(new ListViewSubItem(this, mailDomain.PrimaryHost.ToString()));
+
+ string additional = string.Empty;
+ foreach (WildcardHost host in mailDomain.AdditionalHosts) {
+ additional += host.ToString() + "; ";
+ }
+ this.SubItems.Add(new ListViewSubItem(this, additional));
+ this.ImageIndex = 0;
+ }
+
+ public NMail.DataTypes.LocalStore.MailDomain MailDomain {
+ get {
+ return this.mailDomain;
+ }
+ }
+ }
}
Modified: NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.resx
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.resx 2007-05-31 12:13:10 UTC (rev 210)
+++ NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.resx 2007-06-10 03:32:48 UTC (rev 211)
@@ -117,4 +117,10 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
+ <metadata name="imageList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
+ <metadata name="mailDomainContextMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>116, 17</value>
+ </metadata>
</root>
\ No newline at end of file
Modified: NMail/trunk/NMail.Administration.WinForms/MainForm.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/MainForm.cs 2007-05-31 12:13:10 UTC (rev 210)
+++ NMail/trunk/NMail.Administration.WinForms/MainForm.cs 2007-06-10 03:32:48 UTC (rev 211)
@@ -321,6 +321,9 @@
}
protected void ShowStatusBrowser() {
+ this.statusBrowserDock.DockState = DockState.Document;
+ this.statusBrowserDock.DockHandler.DockTo(this.dockPanel.DockWindows[DockState.Document].NestedPanes[0], DockStyle.Fill, 0);
+ this.statusBrowserDock.DockHandler.Show();
}
#endregion
@@ -379,6 +382,7 @@
} else {
this.servicesDock.DockState = DockState.Document;
this.servicesDock.DockHandler.DockTo(this.dockPanel.DockWindows[DockState.Document].NestedPanes[0], DockStyle.Fill, 0);
+ this.servicesDock.DockHandler.Show();
}
}
#endregion
@@ -422,6 +426,7 @@
} else {
this.mailDomainManagerDock.DockState = DockState.Document;
this.mailDomainManagerDock.DockHandler.DockTo(this.dockPanel.DockWindows[DockState.Document].NestedPanes[0], DockStyle.Fill, 0);
+ this.mailDomainManagerDock.DockHandler.Show();
}
}
#endregion
@@ -435,5 +440,22 @@
private void exitMenuItem_Click(object sender, EventArgs e) {
this.Close();
}
+
+ public void DockFloat(DockContent dockContent, Size size) {
+ int centerThisX = this.Location.X + this.Size.Width / 2;
+ int centerThisY = this.Location.Y + this.Size.Height / 2;
+ Point centerThis = new Point(centerThisX, centerThisY);
+
+ Point halfChild = new Point(size.Width / 2, size.Height / 2);
+ Rectangle r = new Rectangle(
+ centerThis.X - halfChild.X,
+ centerThis.Y - halfChild.Y,
+ size.Width,
+ size.Height);
+
+ dockContent.DockPanel = this.dockPanel;
+ dockContent.DockHandler.FloatAt(r);
+ dockContent.Show();
+ }
}
}
\ No newline at end of file
Modified: NMail/trunk/NMail.Administration.WinForms/NMail.Administration.WinForms.csproj
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/NMail.Administration.WinForms.csproj 2007-05-31 12:13:10 UTC (rev 210)
+++ NMail/trunk/NMail.Administration.WinForms/NMail.Administration.WinForms.csproj 2007-06-10 03:32:48 UTC (rev 211)
@@ -14,7 +14,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
+ <OutputPath>..\References\NMail\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -22,7 +22,7 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
+ <OutputPath>..\References\NMail\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -67,6 +67,12 @@
<Compile Include="ExceptionDialog.Designer.cs">
<DependentUpon>ExceptionDialog.cs</DependentUpon>
</Compile>
+ <Compile Include="MailDomain\MailDomainEditor.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="MailDomain\MailDomainEditor.Designer.cs">
+ <DependentUpon>MailDomainEditor.cs</DependentUpon>
+ </Compile>
<Compile Include="MailDomain\MailDomainManager.cs">
<SubType>UserControl</SubType>
</Compile>
@@ -99,6 +105,10 @@
<SubType>Designer</SubType>
<DependentUpon>ExceptionDialog.cs</DependentUpon>
</EmbeddedResource>
+ <EmbeddedResource Include="MailDomain\MailDomainEditor.resx">
+ <SubType>Designer</SubType>
+ <DependentUpon>MailDomainEditor.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="MailDomain\MailDomainManager.resx">
<SubType>Designer</SubType>
<DependentUpon>MailDomainManager.cs</DependentUpon>
Modified: NMail/trunk/NMail.Icons/NMail.Icons.csproj
===================================================================
--- NMail/trunk/NMail.Icons/NMail.Icons.csproj 2007-05-31 12:13:10 UTC (rev 210)
+++ NMail/trunk/NMail.Icons/NMail.Icons.csproj 2007-06-10 03:32:48 UTC (rev 211)
@@ -57,6 +57,8 @@
<EmbeddedResource Include="Resources\22x22\actions\folder.png" />
<EmbeddedResource Include="Resources\22x22\actions\queue.png" />
<EmbeddedResource Include="Resources\32x32\apps\password.png" />
+ <EmbeddedResource Include="Resources\16x16\actions\delete.png" />
+ <EmbeddedResource Include="Resources\16x16\actions\edit.png" />
<Content Include="Resources\LGPL.txt" />
</ItemGroup>
<ItemGroup>
Added: NMail/trunk/NMail.Icons/Resources/16x16/actions/delete.png
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/NMail.Icons/Resources/16x16/actions/delete.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: NMail/trunk/NMail.Icons/Resources/16x16/actions/edit.png
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/NMail.Icons/Resources/16x16/actions/edit.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2007-05-31 12:13:07
|
Revision: 210
http://svn.sourceforge.net/nmailserver/?rev=210&view=rev
Author: tmyroadctfig
Date: 2007-05-31 05:13:10 -0700 (Thu, 31 May 2007)
Log Message:
-----------
Changed reinstall schema to grant admin system privileges.
Modified Paths:
--------------
NMail/trunk/NMail.LocalStoreData.NHibernate/NHibernateLocalStoreData.cs
Modified: NMail/trunk/NMail.LocalStoreData.NHibernate/NHibernateLocalStoreData.cs
===================================================================
--- NMail/trunk/NMail.LocalStoreData.NHibernate/NHibernateLocalStoreData.cs 2007-05-31 12:11:17 UTC (rev 209)
+++ NMail/trunk/NMail.LocalStoreData.NHibernate/NHibernateLocalStoreData.cs 2007-05-31 12:13:10 UTC (rev 210)
@@ -1882,14 +1882,30 @@
public void ReinstallSchema() {
new global::NHibernate.Tool.hbm2ddl.SchemaExport(NHibernateHelper.Configuration).Create(false, true);
+ // Create an administrator user
LocalStoreUser administrator = new LocalStoreUser();
administrator.Username = "Administrator"; // TODO: get from a global admin name or something
CreateUser(administrator);
+ // Grant the admin privileges
+ GenericAce<SystemPrivilege> sysAce = new GenericAce<SystemPrivilege>();
+ sysAce.AceType = AcePrivilegeType.Allow;
+ sysAce.Privilege = SystemPrivilege.CreateMailDomain
+ | SystemPrivilege.DeleteMailDomain
+ | SystemPrivilege.EditAllAcls
+ | SystemPrivilege.ModifySystemPrivileges
+ | SystemPrivilege.UpdateMailDomain
+ | SystemPrivilege.ViewMailDomains
+ | SystemPrivilege.ViewSystemPrivileges;
+ sysAce.Identifier = administrator.Username;
+ SetSystemPrivilegeAce(sysAce);
+
+ // Create an administrator group
LocalStoreGroup adminGroup = new LocalStoreGroup();
adminGroup.Name = "Administrators"; // TODO: get from a global admin name or something
CreateGroup(adminGroup);
+ // Create an initial mail domain
MailDomain localMailDomain = new MailDomain();
localMailDomain.PrimaryHost = new Host(Domain.LocalHost);
localMailDomain.UserIds.Add(administrator.UserId);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2007-05-31 12:11:19
|
Revision: 209
http://svn.sourceforge.net/nmailserver/?rev=209&view=rev
Author: tmyroadctfig
Date: 2007-05-31 05:11:17 -0700 (Thu, 31 May 2007)
Log Message:
-----------
Added directories to ignore list.
Property Changed:
----------------
NMail/trunk/NMail.SurveyService/
Property changes on: NMail/trunk/NMail.SurveyService
___________________________________________________________________
Name: svn:ignore
+ bin
obj
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2007-05-31 12:10:36
|
Revision: 208
http://svn.sourceforge.net/nmailserver/?rev=208&view=rev
Author: tmyroadctfig
Date: 2007-05-31 05:10:37 -0700 (Thu, 31 May 2007)
Log Message:
-----------
Work on the setup wizard.
Modified Paths:
--------------
NMail/trunk/NMail.Server/Configuration/ServerConfiguration.cs
NMail/trunk/NMail.Server/RemoteAdminAuthorisation.cs
NMail/trunk/NMail.SetupWizard/DatabaseConfigPanel.cs
NMail/trunk/NMail.SetupWizard/NMail.SetupWizard.csproj
NMail/trunk/NMail.SetupWizard/Properties/Settings.Designer.cs
NMail/trunk/NMail.SetupWizard/ServiceConfigPanel.cs
Added Paths:
-----------
NMail/trunk/NMail.SetupWizard/RemoteAdminConfigPanel.Designer.cs
NMail/trunk/NMail.SetupWizard/RemoteAdminConfigPanel.cs
NMail/trunk/NMail.SetupWizard/RemoteAdminConfigPanel.resx
NMail/trunk/NMail.SetupWizard/SurveyConfigPanel.Designer.cs
NMail/trunk/NMail.SetupWizard/SurveyConfigPanel.cs
NMail/trunk/NMail.SetupWizard/SurveyConfigPanel.resx
Modified: NMail/trunk/NMail.Server/Configuration/ServerConfiguration.cs
===================================================================
--- NMail/trunk/NMail.Server/Configuration/ServerConfiguration.cs 2007-05-31 12:07:34 UTC (rev 207)
+++ NMail/trunk/NMail.Server/Configuration/ServerConfiguration.cs 2007-05-31 12:10:37 UTC (rev 208)
@@ -74,6 +74,19 @@
}
/// <summary>
+ /// A flags indicating if unauthenticated users are allowed (Not recommended).
+ /// </summary>
+ [ConfigurationProperty("AllowUnauthenticatedUsers", DefaultValue=false)]
+ public bool AllowUnauthenticatedUsers {
+ get {
+ return (bool) this["AllowUnauthenticatedUsers"];
+ }
+ set {
+ this["AllowUnauthenticatedUsers"] = value;
+ }
+ }
+
+ /// <summary>
/// The list of users authorized to connect to the remote administration
/// remoting interface.
/// </summary>
Modified: NMail/trunk/NMail.Server/RemoteAdminAuthorisation.cs
===================================================================
--- NMail/trunk/NMail.Server/RemoteAdminAuthorisation.cs 2007-05-31 12:07:34 UTC (rev 207)
+++ NMail/trunk/NMail.Server/RemoteAdminAuthorisation.cs 2007-05-31 12:10:37 UTC (rev 208)
@@ -74,6 +74,11 @@
/// True if the user identity of the client is authorized; otherwise, false.
/// </returns>
public bool IsConnectingIdentityAuthorized(IIdentity identity) {
+ // Check if unsafe connections are allowed
+ if (ServerConfiguration.Current.AllowUnauthenticatedUsers) {
+ return true;
+ }
+
string connectingUser = identity.Name.Trim().ToLower();
CommaDelimitedStringCollection remoteAdminUsers = ServerConfiguration.Current.RemoteAdminAuthorizedUsers;
Modified: NMail/trunk/NMail.SetupWizard/DatabaseConfigPanel.cs
===================================================================
--- NMail/trunk/NMail.SetupWizard/DatabaseConfigPanel.cs 2007-05-31 12:07:34 UTC (rev 207)
+++ NMail/trunk/NMail.SetupWizard/DatabaseConfigPanel.cs 2007-05-31 12:10:37 UTC (rev 208)
@@ -32,7 +32,7 @@
this.localStoreConfigPanel = localStoreConfigPanel;
this.smtpConfigPanel = smtpConfigPanel;
this.PreviousPanel = previous;
- this.NextPanel = new ServiceConfigPanel(this.BaseForm, this);
+ this.NextPanel = new RemoteAdminConfigPanel(this.BaseForm, this);
loadConfiguration();
}
Modified: NMail/trunk/NMail.SetupWizard/NMail.SetupWizard.csproj
===================================================================
--- NMail/trunk/NMail.SetupWizard/NMail.SetupWizard.csproj 2007-05-31 12:07:34 UTC (rev 207)
+++ NMail/trunk/NMail.SetupWizard/NMail.SetupWizard.csproj 2007-05-31 12:10:37 UTC (rev 208)
@@ -50,6 +50,18 @@
<Compile Include="BasePanel.Designer.cs">
<DependentUpon>BasePanel.cs</DependentUpon>
</Compile>
+ <Compile Include="SurveyConfigPanel.cs">
+ <SubType>UserControl</SubType>
+ </Compile>
+ <Compile Include="SurveyConfigPanel.Designer.cs">
+ <DependentUpon>SurveyConfigPanel.cs</DependentUpon>
+ </Compile>
+ <Compile Include="RemoteAdminConfigPanel.cs">
+ <SubType>UserControl</SubType>
+ </Compile>
+ <Compile Include="RemoteAdminConfigPanel.Designer.cs">
+ <DependentUpon>RemoteAdminConfigPanel.cs</DependentUpon>
+ </Compile>
<Compile Include="DatabaseConfigPanel.cs">
<SubType>UserControl</SubType>
</Compile>
@@ -102,6 +114,14 @@
<SubType>Designer</SubType>
<DependentUpon>BasePanel.cs</DependentUpon>
</EmbeddedResource>
+ <EmbeddedResource Include="SurveyConfigPanel.resx">
+ <DependentUpon>SurveyConfigPanel.cs</DependentUpon>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
+ <EmbeddedResource Include="RemoteAdminConfigPanel.resx">
+ <DependentUpon>RemoteAdminConfigPanel.cs</DependentUpon>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
<EmbeddedResource Include="DatabaseConfigPanel.resx">
<SubType>Designer</SubType>
<DependentUpon>DatabaseConfigPanel.cs</DependentUpon>
@@ -182,6 +202,10 @@
<Project>{0AB0E8BA-8CAE-479E-AC85-8255103A107C}</Project>
<Name>NMail.MessageRouter</Name>
</ProjectReference>
+ <ProjectReference Include="..\NMail.Server\NMail.Server.csproj">
+ <Project>{45123319-D913-4A92-BB67-C2C9E1A22A17}</Project>
+ <Name>NMail.Server</Name>
+ </ProjectReference>
<ProjectReference Include="..\NMail.SmtpClient\NMail.SmtpClient.csproj">
<Project>{8CDAF015-FF14-4960-BC91-6F2618A6FED3}</Project>
<Name>NMail.SmtpClient</Name>
@@ -202,6 +226,10 @@
<Project>{81EA6856-1AA7-4278-B0CC-1F851B987DA0}</Project>
<Name>NMail.SpoolService</Name>
</ProjectReference>
+ <ProjectReference Include="..\NMail.SurveyService\NMail.SurveyService.csproj">
+ <Project>{11BFAF65-FA51-4245-8747-F4BA39D10FA3}</Project>
+ <Name>NMail.SurveyService</Name>
+ </ProjectReference>
<ProjectReference Include="..\NMail\NMail.csproj">
<Project>{5A5A5012-B157-49B1-A35F-67EC9680112A}</Project>
<Name>NMail</Name>
Modified: NMail/trunk/NMail.SetupWizard/Properties/Settings.Designer.cs
===================================================================
--- NMail/trunk/NMail.SetupWizard/Properties/Settings.Designer.cs 2007-05-31 12:07:34 UTC (rev 207)
+++ NMail/trunk/NMail.SetupWizard/Properties/Settings.Designer.cs 2007-05-31 12:10:37 UTC (rev 208)
@@ -9,18 +9,18 @@
//------------------------------------------------------------------------------
namespace NMail.SetupWizard.Properties {
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")]
- internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
-
- private static Settings defaultInstance = ((Settings) (global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
- public static Settings Default {
- get {
- return defaultInstance;
- }
- }
- }
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+ }
}
Added: NMail/trunk/NMail.SetupWizard/RemoteAdminConfigPanel.Designer.cs
===================================================================
--- NMail/trunk/NMail.SetupWizard/RemoteAdminConfigPanel.Designer.cs (rev 0)
+++ NMail/trunk/NMail.SetupWizard/RemoteAdminConfigPanel.Designer.cs 2007-05-31 12:10:37 UTC (rev 208)
@@ -0,0 +1,203 @@
+namespace NMail.SetupWizard {
+ partial class RemoteAdminConfigPanel {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent() {
+ this.descriptionTextBox = new System.Windows.Forms.TextBox();
+ this.addCnnBtn = new System.Windows.Forms.Button();
+ this.currentConnTextBox = new System.Windows.Forms.TextBox();
+ this.connectionsLbl = new System.Windows.Forms.Label();
+ this.allowedConnectionsList = new System.Windows.Forms.ListBox();
+ this.removeUserBtn = new System.Windows.Forms.Button();
+ this.addUserBtn = new System.Windows.Forms.Button();
+ this.currentUserTextBox = new System.Windows.Forms.TextBox();
+ this.usersLbl = new System.Windows.Forms.Label();
+ this.allowedUsersList = new System.Windows.Forms.ListBox();
+ this.removeCnnBtn = new System.Windows.Forms.Button();
+ this.allowUnauthCheckBox = new System.Windows.Forms.CheckBox();
+ this.mainPanel.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // titleLabel
+ //
+ this.titleLabel.Size = new System.Drawing.Size(277, 29);
+ this.titleLabel.Text = "Remote Administration";
+ //
+ // mainPanel
+ //
+ this.mainPanel.Controls.Add(this.allowUnauthCheckBox);
+ this.mainPanel.Controls.Add(this.removeCnnBtn);
+ this.mainPanel.Controls.Add(this.addCnnBtn);
+ this.mainPanel.Controls.Add(this.descriptionTextBox);
+ this.mainPanel.Controls.Add(this.currentConnTextBox);
+ this.mainPanel.Controls.Add(this.usersLbl);
+ this.mainPanel.Controls.Add(this.connectionsLbl);
+ this.mainPanel.Controls.Add(this.allowedUsersList);
+ this.mainPanel.Controls.Add(this.allowedConnectionsList);
+ this.mainPanel.Controls.Add(this.currentUserTextBox);
+ this.mainPanel.Controls.Add(this.removeUserBtn);
+ this.mainPanel.Controls.Add(this.addUserBtn);
+ //
+ // descriptionTextBox
+ //
+ this.descriptionTextBox.BackColor = System.Drawing.Color.White;
+ this.descriptionTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
+ this.descriptionTextBox.Location = new System.Drawing.Point(8, 8);
+ this.descriptionTextBox.Multiline = true;
+ this.descriptionTextBox.Name = "descriptionTextBox";
+ this.descriptionTextBox.ReadOnly = true;
+ this.descriptionTextBox.Size = new System.Drawing.Size(343, 40);
+ this.descriptionTextBox.TabIndex = 2;
+ this.descriptionTextBox.TabStop = false;
+ this.descriptionTextBox.Text = "NMail uses TCP port 7877 for remote administration. This administration interface" +
+ " can be protected with Windows authentication and restricted to cetain address r" +
+ "anges.";
+ //
+ // addCnnBtn
+ //
+ this.addCnnBtn.Location = new System.Drawing.Point(253, 206);
+ this.addCnnBtn.Name = "addCnnBtn";
+ this.addCnnBtn.Size = new System.Drawing.Size(42, 23);
+ this.addCnnBtn.TabIndex = 8;
+ this.addCnnBtn.Text = "Add";
+ this.addCnnBtn.UseVisualStyleBackColor = true;
+ this.addCnnBtn.Click += new System.EventHandler(this.addCnnBtn_Click);
+ //
+ // currentConnTextBox
+ //
+ this.currentConnTextBox.Location = new System.Drawing.Point(175, 180);
+ this.currentConnTextBox.Name = "currentConnTextBox";
+ this.currentConnTextBox.Size = new System.Drawing.Size(120, 20);
+ this.currentConnTextBox.TabIndex = 7;
+ this.currentConnTextBox.Text = "192.168.1.0/24";
+ //
+ // connectionsLbl
+ //
+ this.connectionsLbl.AutoSize = true;
+ this.connectionsLbl.Location = new System.Drawing.Point(172, 62);
+ this.connectionsLbl.Name = "connectionsLbl";
+ this.connectionsLbl.Size = new System.Drawing.Size(81, 13);
+ this.connectionsLbl.TabIndex = 6;
+ this.connectionsLbl.Text = "Allowed Clients:";
+ //
+ // allowedConnectionsList
+ //
+ this.allowedConnectionsList.FormattingEnabled = true;
+ this.allowedConnectionsList.Location = new System.Drawing.Point(175, 78);
+ this.allowedConnectionsList.Name = "allowedConnectionsList";
+ this.allowedConnectionsList.Size = new System.Drawing.Size(120, 95);
+ this.allowedConnectionsList.TabIndex = 5;
+ //
+ // removeUserBtn
+ //
+ this.removeUserBtn.Location = new System.Drawing.Point(46, 206);
+ this.removeUserBtn.Name = "removeUserBtn";
+ this.removeUserBtn.Size = new System.Drawing.Size(58, 23);
+ this.removeUserBtn.TabIndex = 4;
+ this.removeUserBtn.Text = "Remove";
+ this.removeUserBtn.UseVisualStyleBackColor = true;
+ this.removeUserBtn.Click += new System.EventHandler(this.removeUserBtn_Click);
+ //
+ // addUserBtn
+ //
+ this.addUserBtn.Location = new System.Drawing.Point(110, 206);
+ this.addUserBtn.Name = "addUserBtn";
+ this.addUserBtn.Size = new System.Drawing.Size(42, 23);
+ this.addUserBtn.TabIndex = 3;
+ this.addUserBtn.Text = "Add";
+ this.addUserBtn.UseVisualStyleBackColor = true;
+ this.addUserBtn.Click += new System.EventHandler(this.addUserBtn_Click);
+ //
+ // currentUserTextBox
+ //
+ this.currentUserTextBox.Location = new System.Drawing.Point(32, 180);
+ this.currentUserTextBox.Name = "currentUserTextBox";
+ this.currentUserTextBox.Size = new System.Drawing.Size(120, 20);
+ this.currentUserTextBox.TabIndex = 2;
+ this.currentUserTextBox.Text = "Domain\\Administrator";
+ //
+ // usersLbl
+ //
+ this.usersLbl.AutoSize = true;
+ this.usersLbl.Location = new System.Drawing.Point(29, 62);
+ this.usersLbl.Name = "usersLbl";
+ this.usersLbl.Size = new System.Drawing.Size(77, 13);
+ this.usersLbl.TabIndex = 1;
+ this.usersLbl.Text = "Allowed Users:";
+ //
+ // allowedUsersList
+ //
+ this.allowedUsersList.FormattingEnabled = true;
+ this.allowedUsersList.Location = new System.Drawing.Point(32, 78);
+ this.allowedUsersList.Name = "allowedUsersList";
+ this.allowedUsersList.Size = new System.Drawing.Size(120, 95);
+ this.allowedUsersList.TabIndex = 0;
+ //
+ // removeCnnBtn
+ //
+ this.removeCnnBtn.Location = new System.Drawing.Point(189, 206);
+ this.removeCnnBtn.Name = "removeCnnBtn";
+ this.removeCnnBtn.Size = new System.Drawing.Size(58, 23);
+ this.removeCnnBtn.TabIndex = 9;
+ this.removeCnnBtn.Text = "Remove";
+ this.removeCnnBtn.UseVisualStyleBackColor = true;
+ this.removeCnnBtn.Click += new System.EventHandler(this.removeCnnBtn_Click);
+ //
+ // allowUnauthCheckBox
+ //
+ this.allowUnauthCheckBox.AutoSize = true;
+ this.allowUnauthCheckBox.Location = new System.Drawing.Point(32, 252);
+ this.allowUnauthCheckBox.Name = "allowUnauthCheckBox";
+ this.allowUnauthCheckBox.Size = new System.Drawing.Size(242, 17);
+ this.allowUnauthCheckBox.TabIndex = 10;
+ this.allowUnauthCheckBox.Text = "Allow unauthorized users (Not recommended).";
+ this.allowUnauthCheckBox.UseVisualStyleBackColor = true;
+ this.allowUnauthCheckBox.CheckedChanged += new System.EventHandler(this.allowUnauthUsersCheckBox_CheckedChanged);
+ //
+ // RemoteAdminConfigPanel
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Name = "RemoteAdminConfigPanel";
+ this.mainPanel.ResumeLayout(false);
+ this.mainPanel.PerformLayout();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.TextBox descriptionTextBox;
+ private System.Windows.Forms.TextBox currentUserTextBox;
+ private System.Windows.Forms.Label usersLbl;
+ private System.Windows.Forms.ListBox allowedUsersList;
+ private System.Windows.Forms.Button addCnnBtn;
+ private System.Windows.Forms.TextBox currentConnTextBox;
+ private System.Windows.Forms.Label connectionsLbl;
+ private System.Windows.Forms.ListBox allowedConnectionsList;
+ private System.Windows.Forms.Button removeUserBtn;
+ private System.Windows.Forms.Button addUserBtn;
+ private System.Windows.Forms.CheckBox allowUnauthCheckBox;
+ private System.Windows.Forms.Button removeCnnBtn;
+ }
+}
Added: NMail/trunk/NMail.SetupWizard/RemoteAdminConfigPanel.cs
===================================================================
--- NMail/trunk/NMail.SetupWizard/RemoteAdminConfigPanel.cs (rev 0)
+++ NMail/trunk/NMail.SetupWizard/RemoteAdminConfigPanel.cs 2007-05-31 12:10:37 UTC (rev 208)
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2004-2006 Luke Quinane
+ *
+ * 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.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Text;
+using System.ServiceProcess;
+using System.Windows.Forms;
+
+using NMail.Configuration;
+using NMail.DataTypes;
+using NMail.Server.Configuration;
+
+namespace NMail.SetupWizard {
+ public partial class RemoteAdminConfigPanel : BasePanel {
+
+ private ServerConfiguration config;
+
+ public RemoteAdminConfigPanel(BaseForm baseForm, BasePanel previous)
+ : base(baseForm) {
+ InitializeComponent();
+
+ this.PreviousPanel = previous;
+ this.NextPanel = new SurveyConfigPanel(this.BaseForm, this);
+
+ // Ensure the config has a server section
+ if (!ServerConfiguration.ConfigurationPresent) {
+ ServerConfiguration.AddToConfigFile();
+ }
+
+ config = ServerConfiguration.Current;
+
+ if (config.RemoteAdminAuthorizedUsers.Count > 0) {
+ // Add any allowed users from the current config
+ for (int i = 0; i < this.config.RemoteAdminAuthorizedUsers.Count; i++) {
+ this.allowedUsersList.Items.Add(this.config.RemoteAdminAuthorizedUsers[i]);
+ }
+ }
+
+ if (config.RemoteAdminClients.Count > 0) {
+ // Add any allowed clients from the current config
+ for (int i = 0; i < this.config.RemoteAdminClients.Count; i++) {
+ this.allowedConnectionsList.Items.Add(this.config.RemoteAdminClients[i].MatchWildcardHost);
+ }
+ }
+
+ this.allowUnauthCheckBox.Checked = config.AllowUnauthenticatedUsers;
+ }
+
+ private void addUserBtn_Click(object sender, EventArgs e) {
+ if (!this.allowedUsersList.Items.Contains(this.currentUserTextBox.Text)) {
+ this.allowedUsersList.Items.Add(this.currentUserTextBox.Text);
+
+ this.currentUserTextBox.Text = string.Empty;
+ }
+ }
+
+ private void removeUserBtn_Click(object sender, EventArgs e) {
+ if (this.allowedUsersList.SelectedItem != null) {
+ this.currentUserTextBox.Text = this.allowedUsersList.SelectedItem.ToString();
+ this.allowedUsersList.Items.Remove(this.allowedUsersList.SelectedItem);
+ }
+ }
+
+ private void addCnnBtn_Click(object sender, EventArgs e) {
+ try {
+ WildcardHost wildHost = new WildcardHost(this.currentConnTextBox.Text);
+
+ if (!this.allowedConnectionsList.Items.Contains(wildHost)) {
+ this.allowedConnectionsList.Items.Add(wildHost);
+
+ this.currentConnTextBox.Text = string.Empty;
+ }
+ } catch (Exception ex) {
+ MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void removeCnnBtn_Click(object sender, EventArgs e) {
+ if (this.allowedConnectionsList.SelectedItem != null) {
+ this.currentConnTextBox.Text = this.allowedConnectionsList.SelectedItem.ToString();
+ this.allowedConnectionsList.Items.Remove(this.allowedConnectionsList.SelectedItem);
+ }
+ }
+
+ private void allowUnauthUsersCheckBox_CheckedChanged(object sender, EventArgs e) {
+ this.addUserBtn.Enabled = !this.allowUnauthCheckBox.Checked;
+ this.removeUserBtn.Enabled = !this.allowUnauthCheckBox.Checked;
+ this.currentUserTextBox.Enabled = !this.allowUnauthCheckBox.Checked;
+ this.allowedUsersList.Enabled = !this.allowUnauthCheckBox.Checked;
+ }
+
+ protected override void OnNextButtonClick() {
+ // Clear the list of allowed users and connections
+ config.RemoteAdminAuthorizedUsers.Clear();
+ config.RemoteAdminClients.Clear();
+
+ // Add the list of allowed users
+ foreach (string user in this.allowedUsersList.Items) {
+ config.RemoteAdminAuthorizedUsers.Add(user);
+ }
+
+ // Add the list of allowed clients
+ foreach (WildcardHost host in this.allowedConnectionsList.Items) {
+ WildcardHostConfigurationElement element = new WildcardHostConfigurationElement();
+ element.Match = host.ToString();
+ config.RemoteAdminClients.Add(element);
+ }
+
+ config.AllowUnauthenticatedUsers = allowUnauthCheckBox.Checked;
+
+ base.OnNextButtonClick();
+ }
+ }
+}
Added: NMail/trunk/NMail.SetupWizard/RemoteAdminConfigPanel.resx
===================================================================
--- NMail/trunk/NMail.SetupWizard/RemoteAdminConfigPanel.resx (rev 0)
+++ NMail/trunk/NMail.SetupWizard/RemoteAdminConfigPanel.resx 2007-05-31 12:10:37 UTC (rev 208)
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
\ No newline at end of file
Modified: NMail/trunk/NMail.SetupWizard/ServiceConfigPanel.cs
===================================================================
--- NMail/trunk/NMail.SetupWizard/ServiceConfigPanel.cs 2007-05-31 12:07:34 UTC (rev 207)
+++ NMail/trunk/NMail.SetupWizard/ServiceConfigPanel.cs 2007-05-31 12:10:37 UTC (rev 208)
@@ -1,3 +1,20 @@
+/*
+ * Copyright 2004-2006 Luke Quinane
+ *
+ * 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.Generic;
using System.ComponentModel;
Added: NMail/trunk/NMail.SetupWizard/SurveyConfigPanel.Designer.cs
===================================================================
--- NMail/trunk/NMail.SetupWizard/SurveyConfigPanel.Designer.cs (rev 0)
+++ NMail/trunk/NMail.SetupWizard/SurveyConfigPanel.Designer.cs 2007-05-31 12:10:37 UTC (rev 208)
@@ -0,0 +1,82 @@
+namespace NMail.SetupWizard {
+ partial class SurveyConfigPanel {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent() {
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SurveyConfigPanel));
+ this.allowSurveyCheckBox = new System.Windows.Forms.CheckBox();
+ this.descriptionTextBox = new System.Windows.Forms.RichTextBox();
+ this.mainPanel.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // titleLabel
+ //
+ this.titleLabel.Size = new System.Drawing.Size(197, 29);
+ this.titleLabel.Text = "Periodic Survey";
+ //
+ // mainPanel
+ //
+ this.mainPanel.Controls.Add(this.descriptionTextBox);
+ this.mainPanel.Controls.Add(this.allowSurveyCheckBox);
+ //
+ // allowSurveyCheckBox
+ //
+ this.allowSurveyCheckBox.AutoSize = true;
+ this.allowSurveyCheckBox.Checked = true;
+ this.allowSurveyCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.allowSurveyCheckBox.Location = new System.Drawing.Point(11, 110);
+ this.allowSurveyCheckBox.Name = "allowSurveyCheckBox";
+ this.allowSurveyCheckBox.Size = new System.Drawing.Size(217, 17);
+ this.allowSurveyCheckBox.TabIndex = 10;
+ this.allowSurveyCheckBox.Text = "Enable periodic survey (Recommended).";
+ this.allowSurveyCheckBox.UseVisualStyleBackColor = true;
+ //
+ // descriptionTextBox
+ //
+ this.descriptionTextBox.BackColor = System.Drawing.Color.White;
+ this.descriptionTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
+ this.descriptionTextBox.Location = new System.Drawing.Point(11, 8);
+ this.descriptionTextBox.Name = "descriptionTextBox";
+ this.descriptionTextBox.ReadOnly = true;
+ this.descriptionTextBox.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None;
+ this.descriptionTextBox.Size = new System.Drawing.Size(334, 96);
+ this.descriptionTextBox.TabIndex = 11;
+ this.descriptionTextBox.Text = resources.GetString("descriptionTextBox.Text");
+ //
+ // SurveyConfigPanel
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Name = "SurveyConfigPanel";
+ this.mainPanel.ResumeLayout(false);
+ this.mainPanel.PerformLayout();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.CheckBox allowSurveyCheckBox;
+ private System.Windows.Forms.RichTextBox descriptionTextBox;
+ }
+}
Added: NMail/trunk/NMail.SetupWizard/SurveyConfigPanel.cs
===================================================================
--- NMail/trunk/NMail.SetupWizard/SurveyConfigPanel.cs (rev 0)
+++ NMail/trunk/NMail.SetupWizard/SurveyConfigPanel.cs 2007-05-31 12:10:37 UTC (rev 208)
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2004-2006 Luke Quinane
+ *
+ * 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.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Text;
+using System.ServiceProcess;
+using System.Windows.Forms;
+
+using NMail.Configuration;
+
+namespace NMail.SetupWizard {
+ public partial class SurveyConfigPanel : BasePanel {
+
+ public SurveyConfigPanel(BaseForm baseForm, BasePanel previous)
+ : base(baseForm) {
+ InitializeComponent();
+
+ this.PreviousPanel = previous;
+ this.NextPanel = new ServiceConfigPanel(this.BaseForm, this);
+ }
+
+ protected override void OnNextButtonClick() {
+ // Ensure we are in the list of named services
+ NMailConfiguration nc = NMailConfiguration.Current;
+ bool foundSurveyService = false;
+ IServiceElement currentElement = null;
+
+ for (int i = 0; i < nc.ServiceDetails.Count; i++) {
+ if (nc.ServiceDetails[i].ObjectType == typeof(SurveyService.SurveyService)) {
+ foundSurveyService = true;
+ currentElement = nc.ServiceDetails[i];
+ break;
+ }
+ }
+
+ if (this.allowSurveyCheckBox.Checked) {
+ if (!foundSurveyService) {
+ // Add it
+ IServiceElement element = new IServiceElement();
+ element.ObjectType = typeof(SurveyService.SurveyService);
+ element.AutomaticStart = true;
+ nc.ServiceDetails.Add(element);
+ } else {
+ // Ensure auto-start
+ currentElement.AutomaticStart = true;
+ }
+ } else {
+ if (foundSurveyService) {
+ // Remove it
+ nc.ServiceDetails.Remove(currentElement);
+ }
+ }
+
+ base.OnNextButtonClick();
+ }
+ }
+}
Added: NMail/trunk/NMail.SetupWizard/SurveyConfigPanel.resx
===================================================================
--- NMail/trunk/NMail.SetupWizard/SurveyConfigPanel.resx (rev 0)
+++ NMail/trunk/NMail.SetupWizard/SurveyConfigPanel.resx 2007-05-31 12:10:37 UTC (rev 208)
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="descriptionTextBox.Text" xml:space="preserve">
+ <value>To help better understand what environments NMail is running under, NMail can be configured to periodically send back survey information. More information about what information is collected can be found here: http://nmailserver.sf.net/survey and the privacy policy relating to the use of this information can be found here: http://nmailserver.sf.net/surveyprivacy</value>
+ </data>
+</root>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2007-05-31 12:07:34
|
Revision: 207
http://svn.sourceforge.net/nmailserver/?rev=207&view=rev
Author: tmyroadctfig
Date: 2007-05-31 05:07:34 -0700 (Thu, 31 May 2007)
Log Message:
-----------
Added initial cut of the survey service.
Modified Paths:
--------------
NMail/trunk/NMail.sln
Added Paths:
-----------
NMail/trunk/NMail.SurveyService/
NMail/trunk/NMail.SurveyService/NMail.SurveyService.csproj
NMail/trunk/NMail.SurveyService/Properties/
NMail/trunk/NMail.SurveyService/Properties/AssemblyInfo.cs
NMail/trunk/NMail.SurveyService/SurveyEnvironment.cs
NMail/trunk/NMail.SurveyService/SurveyInformation.cs
NMail/trunk/NMail.SurveyService/SurveyService.cs
Added: NMail/trunk/NMail.SurveyService/NMail.SurveyService.csproj
===================================================================
--- NMail/trunk/NMail.SurveyService/NMail.SurveyService.csproj (rev 0)
+++ NMail/trunk/NMail.SurveyService/NMail.SurveyService.csproj 2007-05-31 12:07:34 UTC (rev 207)
@@ -0,0 +1,55 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{11BFAF65-FA51-4245-8747-F4BA39D10FA3}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>NMail.SurveyService</RootNamespace>
+ <AssemblyName>NMail.SurveyService</AssemblyName>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="SurveyEnvironment.cs" />
+ <Compile Include="SurveyInformation.cs" />
+ <Compile Include="SurveyService.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\NMail\NMail.csproj">
+ <Project>{5A5A5012-B157-49B1-A35F-67EC9680112A}</Project>
+ <Name>NMail</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file
Added: NMail/trunk/NMail.SurveyService/Properties/AssemblyInfo.cs
===================================================================
--- NMail/trunk/NMail.SurveyService/Properties/AssemblyInfo.cs (rev 0)
+++ NMail/trunk/NMail.SurveyService/Properties/AssemblyInfo.cs 2007-05-31 12:07:34 UTC (rev 207)
@@ -0,0 +1,35 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("NMail.SurveyService")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("NMail.SurveyService")]
+[assembly: AssemblyCopyright("Copyright © 2007")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("242626f0-e0a3-49e6-9575-e5fb23a73ce8")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Added: NMail/trunk/NMail.SurveyService/SurveyEnvironment.cs
===================================================================
--- NMail/trunk/NMail.SurveyService/SurveyEnvironment.cs (rev 0)
+++ NMail/trunk/NMail.SurveyService/SurveyEnvironment.cs 2007-05-31 12:07:34 UTC (rev 207)
@@ -0,0 +1,71 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace NMail.SurveyService {
+ /// <summary>
+ /// The environment survey details.
+ /// </summary>
+ public class SurveyEnvironment {
+
+ private string os = System.Environment.OSVersion.ToString();
+
+ /// <summary>
+ /// The OS version.
+ /// </summary>
+ public string OS {
+ get { return os; }
+ set { os = value; }
+ }
+
+ private string environment = System.Environment.Version.ToString();
+
+ /// <summary>
+ /// The .net runtime environment version.
+ /// </summary>
+ public string Environment {
+ get { return environment; }
+ set { environment = value; }
+ }
+
+ private string currentDirectory = System.Environment.CurrentDirectory;
+
+ /// <summary>
+ /// The current directory NMail is running from.
+ /// </summary>
+ public string CurrentDirectory {
+ get { return currentDirectory; }
+ set { currentDirectory = value; }
+ }
+
+ private int processorCount = System.Environment.ProcessorCount;
+
+ /// <summary>
+ /// The number of processors in the machine.
+ /// </summary>
+ public int ProcessorCount {
+ get { return processorCount; }
+ set { processorCount = value; }
+ }
+
+ private int tickCount = System.Environment.TickCount;
+
+ /// <summary>
+ /// The number of milliseconds since the system started.
+ /// </summary>
+ public int TickCount {
+ get { return tickCount; }
+ set { tickCount = value; }
+ }
+
+ private long workingSet = System.Environment.WorkingSet;
+
+ /// <summary>
+ /// The physical memory used by the NMail process.
+ /// </summary>
+ public long WorkingSet {
+ get { return workingSet; }
+ set { workingSet = value; }
+ }
+ }
+}
Added: NMail/trunk/NMail.SurveyService/SurveyInformation.cs
===================================================================
--- NMail/trunk/NMail.SurveyService/SurveyInformation.cs (rev 0)
+++ NMail/trunk/NMail.SurveyService/SurveyInformation.cs 2007-05-31 12:07:34 UTC (rev 207)
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace NMail.SurveyService {
+ /// <summary>
+ /// The survey information.
+ /// </summary>
+ public class SurveyInformation {
+
+ private SurveyEnvironment environment = new SurveyEnvironment();
+
+ /// <summary>
+ /// The environment details.
+ /// </summary>
+ public SurveyEnvironment Environment {
+ get { return environment; }
+ set { environment = value; }
+ }
+ }
+}
Added: NMail/trunk/NMail.SurveyService/SurveyService.cs
===================================================================
--- NMail/trunk/NMail.SurveyService/SurveyService.cs (rev 0)
+++ NMail/trunk/NMail.SurveyService/SurveyService.cs 2007-05-31 12:07:34 UTC (rev 207)
@@ -0,0 +1,92 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+using System.Xml;
+using System.Xml.Serialization;
+
+using Microsoft.Win32;
+
+using NMail.DataTypes.Service;
+
+namespace NMail.SurveyService {
+ /// <summary>
+ /// A service for periodically surveying the server details and reporting back usage stats.
+ /// </summary>
+ public class SurveyService : IService {
+
+ /// <summary>
+ /// Creates a new instance of the service.
+ /// </summary>
+ public SurveyService() {
+ }
+
+ protected XmlDocument GatherData() {
+ //log.Debug("NMail Console Server version: [" + Assembly.GetExecutingAssembly().GetName().Version + "]");
+ // log.Debug("NMail Library version: [" + Assembly.GetAssembly(typeof(NMailConfiguration)).GetName().Version + "]");
+
+ MemoryStream ms = new MemoryStream();
+ XmlSerializer serializer = new XmlSerializer(typeof(SurveyInformation));
+ serializer.Serialize(ms, new SurveyInformation());
+
+ XmlDocument result = new XmlDocument();
+ result.LoadXml(Encoding.Unicode.GetString(ms.ToArray()));
+ return result;
+ }
+
+ #region IService Members
+
+ public void Init() {}
+
+ public void Start() {
+ XmlDocument doc = GatherData();
+
+ }
+
+ public void Stop(bool runCurrentToCompletion) {
+ throw new Exception("The method or operation is not implemented.");
+ }
+
+ public bool SupportsPause {
+ get { return false; }
+ }
+
+ public void Pause() {
+ throw new InvalidOperationException("The method or operation is not implemented.");
+ }
+
+ public void Continue() {
+ throw new InvalidOperationException("The method or operation is not implemented.");
+ }
+
+ public IService ReloadConfiguration() {
+ throw new InvalidOperationException("The method or operation is not implemented.");
+ }
+
+ public bool AllowsReloadConfiguration {
+ get { return false; }
+ }
+
+ public bool Running {
+ get { throw new Exception("The method or operation is not implemented."); }
+ }
+
+ public string Name {
+ get { return "Survey Service"; }
+ }
+
+ public string Description {
+ get { return "Periodically reports survey and usage information."; }
+ }
+
+ public Uri SupportUrl {
+ get { return new Uri("http://nmailserver.sf.net/support/services/survey"); }
+ }
+
+ public event EventHandler Started;
+
+ public event EventHandler Stopped;
+
+ #endregion
+ }
+}
Modified: NMail/trunk/NMail.sln
===================================================================
--- NMail/trunk/NMail.sln 2007-05-27 13:42:04 UTC (rev 206)
+++ NMail/trunk/NMail.sln 2007-05-31 12:07:34 UTC (rev 207)
@@ -50,6 +50,8 @@
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NMail.Icons", "NMail.Icons\NMail.Icons.csproj", "{D7B3712B-CD3B-4D64-8D33-92A81D6921E2}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NMail.SurveyService", "NMail.SurveyService\NMail.SurveyService.csproj", "{11BFAF65-FA51-4245-8747-F4BA39D10FA3}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -258,6 +260,14 @@
{D7B3712B-CD3B-4D64-8D33-92A81D6921E2}.Release|Any CPU.Build.0 = Release|Any CPU
{D7B3712B-CD3B-4D64-8D33-92A81D6921E2}.Release2005|Any CPU.ActiveCfg = Release|Any CPU
{D7B3712B-CD3B-4D64-8D33-92A81D6921E2}.Release2005|Any CPU.Build.0 = Release|Any CPU
+ {11BFAF65-FA51-4245-8747-F4BA39D10FA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {11BFAF65-FA51-4245-8747-F4BA39D10FA3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {11BFAF65-FA51-4245-8747-F4BA39D10FA3}.Debug2005|Any CPU.ActiveCfg = Debug|Any CPU
+ {11BFAF65-FA51-4245-8747-F4BA39D10FA3}.Debug2005|Any CPU.Build.0 = Debug|Any CPU
+ {11BFAF65-FA51-4245-8747-F4BA39D10FA3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {11BFAF65-FA51-4245-8747-F4BA39D10FA3}.Release|Any CPU.Build.0 = Release|Any CPU
+ {11BFAF65-FA51-4245-8747-F4BA39D10FA3}.Release2005|Any CPU.ActiveCfg = Release|Any CPU
+ {11BFAF65-FA51-4245-8747-F4BA39D10FA3}.Release2005|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2007-05-27 13:42:04
|
Revision: 206
http://svn.sourceforge.net/nmailserver/?rev=206&view=rev
Author: tmyroadctfig
Date: 2007-05-27 06:42:04 -0700 (Sun, 27 May 2007)
Log Message:
-----------
Work on the mail domain manager. Also added auth prompt.
Modified Paths:
--------------
NMail/trunk/NMail.Administration.WinForms/MainForm.cs
NMail/trunk/NMail.Administration.WinForms/NMail.Administration.WinForms.csproj
NMail/trunk/NMail.Administration.WinForms/Program.cs
NMail/trunk/NMail.Icons/NMail.Icons.csproj
Added Paths:
-----------
NMail/trunk/NMail.Administration.WinForms/AuthenticationPrompt.Designer.cs
NMail/trunk/NMail.Administration.WinForms/AuthenticationPrompt.cs
NMail/trunk/NMail.Administration.WinForms/AuthenticationPrompt.resx
NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.Designer.cs
NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.cs
NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.resx
NMail/trunk/NMail.Icons/Resources/32x32/apps/password.png
Added: NMail/trunk/NMail.Administration.WinForms/AuthenticationPrompt.Designer.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/AuthenticationPrompt.Designer.cs (rev 0)
+++ NMail/trunk/NMail.Administration.WinForms/AuthenticationPrompt.Designer.cs 2007-05-27 13:42:04 UTC (rev 206)
@@ -0,0 +1,136 @@
+namespace NMail.Administration.WinForms {
+ partial class AuthenticationPrompt {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent() {
+ this.cancelButton = new System.Windows.Forms.Button();
+ this.okButton = new System.Windows.Forms.Button();
+ this.passwordTextBox = new System.Windows.Forms.TextBox();
+ this.userNameTextBox = new System.Windows.Forms.TextBox();
+ this.pictureBox1 = new System.Windows.Forms.PictureBox();
+ this.usernameLabel = new System.Windows.Forms.Label();
+ this.passwordLabel = new System.Windows.Forms.Label();
+ ((System.ComponentModel.ISupportInitialize) (this.pictureBox1)).BeginInit();
+ this.SuspendLayout();
+ //
+ // cancelButton
+ //
+ this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ this.cancelButton.Location = new System.Drawing.Point(172, 79);
+ this.cancelButton.Name = "cancelButton";
+ this.cancelButton.Size = new System.Drawing.Size(75, 23);
+ this.cancelButton.TabIndex = 9;
+ this.cancelButton.Text = "Cancel";
+ this.cancelButton.UseVisualStyleBackColor = true;
+ this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
+ //
+ // okButton
+ //
+ this.okButton.Location = new System.Drawing.Point(91, 79);
+ this.okButton.Name = "okButton";
+ this.okButton.Size = new System.Drawing.Size(75, 23);
+ this.okButton.TabIndex = 8;
+ this.okButton.Text = "Ok";
+ this.okButton.UseVisualStyleBackColor = true;
+ this.okButton.Click += new System.EventHandler(this.okButton_Click);
+ //
+ // passwordTextBox
+ //
+ this.passwordTextBox.Location = new System.Drawing.Point(115, 53);
+ this.passwordTextBox.Name = "passwordTextBox";
+ this.passwordTextBox.PasswordChar = '*';
+ this.passwordTextBox.Size = new System.Drawing.Size(132, 20);
+ this.passwordTextBox.TabIndex = 7;
+ this.passwordTextBox.UseSystemPasswordChar = true;
+ //
+ // userNameTextBox
+ //
+ this.userNameTextBox.Location = new System.Drawing.Point(115, 27);
+ this.userNameTextBox.Name = "userNameTextBox";
+ this.userNameTextBox.Size = new System.Drawing.Size(132, 20);
+ this.userNameTextBox.TabIndex = 6;
+ //
+ // pictureBox1
+ //
+ this.pictureBox1.Location = new System.Drawing.Point(12, 12);
+ this.pictureBox1.Name = "pictureBox1";
+ this.pictureBox1.Size = new System.Drawing.Size(32, 32);
+ this.pictureBox1.TabIndex = 5;
+ this.pictureBox1.TabStop = false;
+ //
+ // usernameLabel
+ //
+ this.usernameLabel.AutoSize = true;
+ this.usernameLabel.Location = new System.Drawing.Point(51, 30);
+ this.usernameLabel.Name = "usernameLabel";
+ this.usernameLabel.Size = new System.Drawing.Size(58, 13);
+ this.usernameLabel.TabIndex = 10;
+ this.usernameLabel.Text = "Username:";
+ //
+ // passwordLabel
+ //
+ this.passwordLabel.AutoSize = true;
+ this.passwordLabel.Location = new System.Drawing.Point(53, 56);
+ this.passwordLabel.Name = "passwordLabel";
+ this.passwordLabel.Size = new System.Drawing.Size(56, 13);
+ this.passwordLabel.TabIndex = 11;
+ this.passwordLabel.Text = "Password:";
+ //
+ // AuthenticationPrompt
+ //
+ this.AcceptButton = this.okButton;
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.CancelButton = this.cancelButton;
+ this.ClientSize = new System.Drawing.Size(259, 112);
+ this.Controls.Add(this.passwordLabel);
+ this.Controls.Add(this.usernameLabel);
+ this.Controls.Add(this.cancelButton);
+ this.Controls.Add(this.okButton);
+ this.Controls.Add(this.passwordTextBox);
+ this.Controls.Add(this.userNameTextBox);
+ this.Controls.Add(this.pictureBox1);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "AuthenticationPrompt";
+ this.ShowInTaskbar = false;
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+ this.Text = "Enter your details";
+ ((System.ComponentModel.ISupportInitialize) (this.pictureBox1)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Button cancelButton;
+ private System.Windows.Forms.Button okButton;
+ private System.Windows.Forms.TextBox passwordTextBox;
+ private System.Windows.Forms.TextBox userNameTextBox;
+ private System.Windows.Forms.PictureBox pictureBox1;
+ private System.Windows.Forms.Label usernameLabel;
+ private System.Windows.Forms.Label passwordLabel;
+ }
+}
\ No newline at end of file
Added: NMail/trunk/NMail.Administration.WinForms/AuthenticationPrompt.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/AuthenticationPrompt.cs (rev 0)
+++ NMail/trunk/NMail.Administration.WinForms/AuthenticationPrompt.cs 2007-05-27 13:42:04 UTC (rev 206)
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2004-2007 Luke Quinane
+ *
+ * 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.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+
+using NMail.Icons;
+
+namespace NMail.Administration.WinForms {
+ public partial class AuthenticationPrompt : Form {
+ public AuthenticationPrompt() {
+ InitializeComponent();
+
+ this.pictureBox1.Image = IconHelper.GetImage("password", "apps", IconSize.s32x32);
+ }
+
+ private void cancelButton_Click(object sender, EventArgs e) {
+ this.DialogResult = DialogResult.Cancel;
+ this.Close();
+ }
+
+ private void okButton_Click(object sender, EventArgs e) {
+ this.DialogResult = DialogResult.OK;
+ this.Close();
+ }
+
+ public string Username {
+ get {
+ return this.userNameTextBox.Text;
+ }
+ }
+
+ public string Password {
+ get {
+ return this.passwordTextBox.Text;
+ }
+ }
+ }
+}
\ No newline at end of file
Added: NMail/trunk/NMail.Administration.WinForms/AuthenticationPrompt.resx
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/AuthenticationPrompt.resx (rev 0)
+++ NMail/trunk/NMail.Administration.WinForms/AuthenticationPrompt.resx 2007-05-27 13:42:04 UTC (rev 206)
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
\ No newline at end of file
Added: NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.Designer.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.Designer.cs (rev 0)
+++ NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.Designer.cs 2007-05-27 13:42:04 UTC (rev 206)
@@ -0,0 +1,116 @@
+namespace NMail.Administration.WinForms.MailDomain {
+ partial class MailDomainManager {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent() {
+ this.mainDomainsListView = new System.Windows.Forms.ListView();
+ this.idColumnHeader = new System.Windows.Forms.ColumnHeader();
+ this.primaryHostColumnHeader = new System.Windows.Forms.ColumnHeader();
+ this.secondaryColumnHeader = new System.Windows.Forms.ColumnHeader();
+ this.editColumnHeader = new System.Windows.Forms.ColumnHeader();
+ this.bottomPanel = new System.Windows.Forms.Panel();
+ this.refreshButton = new System.Windows.Forms.Button();
+ this.bottomPanel.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // mainDomainsListView
+ //
+ this.mainDomainsListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
+ this.idColumnHeader,
+ this.primaryHostColumnHeader,
+ this.secondaryColumnHeader,
+ this.editColumnHeader});
+ this.mainDomainsListView.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.mainDomainsListView.FullRowSelect = true;
+ this.mainDomainsListView.GridLines = true;
+ this.mainDomainsListView.HideSelection = false;
+ this.mainDomainsListView.Location = new System.Drawing.Point(0, 0);
+ this.mainDomainsListView.Name = "mainDomainsListView";
+ this.mainDomainsListView.Size = new System.Drawing.Size(620, 369);
+ this.mainDomainsListView.TabIndex = 1;
+ this.mainDomainsListView.UseCompatibleStateImageBehavior = false;
+ this.mainDomainsListView.View = System.Windows.Forms.View.Details;
+ //
+ // idColumnHeader
+ //
+ this.idColumnHeader.Text = "ID";
+ this.idColumnHeader.Width = 45;
+ //
+ // primaryHostColumnHeader
+ //
+ this.primaryHostColumnHeader.Text = "Primary Host";
+ this.primaryHostColumnHeader.Width = 81;
+ //
+ // secondaryColumnHeader
+ //
+ this.secondaryColumnHeader.Text = "Additional Hosts";
+ this.secondaryColumnHeader.Width = 188;
+ //
+ // editColumnHeader
+ //
+ this.editColumnHeader.Text = "Edit";
+ //
+ // bottomPanel
+ //
+ this.bottomPanel.Controls.Add(this.refreshButton);
+ this.bottomPanel.Dock = System.Windows.Forms.DockStyle.Bottom;
+ this.bottomPanel.Location = new System.Drawing.Point(0, 369);
+ this.bottomPanel.Name = "bottomPanel";
+ this.bottomPanel.Size = new System.Drawing.Size(620, 39);
+ this.bottomPanel.TabIndex = 2;
+ //
+ // refreshButton
+ //
+ this.refreshButton.Location = new System.Drawing.Point(4, 7);
+ this.refreshButton.Name = "refreshButton";
+ this.refreshButton.Size = new System.Drawing.Size(75, 23);
+ this.refreshButton.TabIndex = 0;
+ this.refreshButton.Text = "Refresh";
+ this.refreshButton.UseVisualStyleBackColor = true;
+ this.refreshButton.Click += new System.EventHandler(this.refreshButton_Click);
+ //
+ // MailDomainManager
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.mainDomainsListView);
+ this.Controls.Add(this.bottomPanel);
+ this.Name = "MailDomainManager";
+ this.Size = new System.Drawing.Size(620, 408);
+ this.bottomPanel.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.ListView mainDomainsListView;
+ private System.Windows.Forms.ColumnHeader idColumnHeader;
+ private System.Windows.Forms.ColumnHeader primaryHostColumnHeader;
+ private System.Windows.Forms.ColumnHeader secondaryColumnHeader;
+ private System.Windows.Forms.ColumnHeader editColumnHeader;
+ private System.Windows.Forms.Panel bottomPanel;
+ private System.Windows.Forms.Button refreshButton;
+
+ }
+}
Added: NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.cs (rev 0)
+++ NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.cs 2007-05-27 13:42:04 UTC (rev 206)
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2004-2007 Luke Quinane
+ *
+ * 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.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Text;
+using System.Windows.Forms;
+
+using NMail.DataTypes.LocalStore;
+
+namespace NMail.Administration.WinForms.MailDomain {
+ public partial class MailDomainManager : UserControl {
+ public MailDomainManager(MainForm mainForm) {
+ InitializeComponent();
+
+ this.mainForm = mainForm;
+ }
+
+ MainForm mainForm;
+
+ private void refreshButton_Click(object sender, EventArgs e) {
+ try {
+ // Get a list of mail domains
+ ILocalStore localStore = this.mainForm.RemoteAdministration.NMailServer.LocalStore;
+ IList<NMail.DataTypes.LocalStore.MailDomain> mailDomains = localStore.GetMailDomains(this.mainForm.AuthenticationToken);
+
+ this.mainDomainsListView.Items.Clear();
+
+ // Add them to the list view
+ foreach (NMail.DataTypes.LocalStore.MailDomain mailDomain in mailDomains) {
+
+ }
+
+ } catch (Exception ex) {
+ // Something bad :(
+ Program.ShowExceptionDialog(ex);
+ }
+ }
+ }
+}
Added: NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.resx
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.resx (rev 0)
+++ NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.resx 2007-05-27 13:42:04 UTC (rev 206)
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
\ No newline at end of file
Modified: NMail/trunk/NMail.Administration.WinForms/MainForm.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/MainForm.cs 2007-05-27 13:41:01 UTC (rev 205)
+++ NMail/trunk/NMail.Administration.WinForms/MainForm.cs 2007-05-27 13:42:04 UTC (rev 206)
@@ -34,6 +34,7 @@
using log4net;
using WeifenLuo.WinFormsUI.Docking;
+using NMail.Authentication;
using NMail.Icons;
using NMail.Server;
@@ -52,6 +53,7 @@
InitialiseStatusBrowser();
InitialiseManagementTree();
InitialiseServicesViewer();
+ InitialiseMailDomainManager();
this.connectionStatusLbl.Image = IconHelper.GetImage("connect_no", "actions", IconSize.s16x16);
this.connectMenuItem.Image = IconHelper.GetImage("connect_no", "actions", IconSize.s16x16);
@@ -78,8 +80,53 @@
/// </summary>
public RemoteAdministration RemoteAdministration {
get { return remoteAdministration; }
- }
+ }
+ IAuthenticationToken authToken;
+
+ /// <summary>
+ /// The current authentication token.
+ /// </summary>
+ public IAuthenticationToken AuthenticationToken {
+ get {
+ if (this.remoteAdministration == null) {
+ // No point continuing if we're not connected...
+ return null;
+ }
+
+ AuthenticationPrompt authPrompt = new AuthenticationPrompt();
+
+ while (this.authToken == null) {
+ // Show the auth prompt
+ if (authPrompt.ShowDialog() != DialogResult.OK) {
+ break;
+ }
+
+ // Attempt to authenticate
+ try {
+ IAuthenticationProvider authProvider = remoteAdministration.NMailServer.AuthenticationProvider;
+ this.authToken = authProvider.Authenticate(authPrompt.Username, authPrompt.Password);
+
+ if (authToken == null) {
+ // Auth failed
+ MessageBox.Show(
+ this,
+ "Invalid username or password.",
+ "Authentication Failed",
+ MessageBoxButtons.OK,
+ MessageBoxIcon.Exclamation);
+ }
+
+ } catch (Exception ex) {
+ // Something went wrong... :(
+ Program.ShowExceptionDialog(ex);
+ }
+ }
+
+ return this.authToken;
+ }
+ }
+
#region Connect
/// <summary>
/// Returns true if remote server is connected.
@@ -181,6 +228,7 @@
} else {
this.remoteAdministration = null;
+ this.authToken = null;
UpdateConnectionStatus();
ShowStatusBrowser();
}
@@ -198,6 +246,7 @@
} else {
this.remoteAdministration = null;
+ this.authToken = null;
UpdateConnectionStatus();
// Update status browser
@@ -337,8 +386,45 @@
public void ShowSpoolControl() {
}
+ #region Mail Domain Manager
+ /// <summary>
+ /// The mail domain manager.
+ /// </summary>
+ MailDomain.MailDomainManager mailDomainManager;
+
+ DockContent mailDomainManagerDock;
+
+ protected void InitialiseMailDomainManager() {
+ this.mailDomainManager = new MailDomain.MailDomainManager(this);
+ this.mailDomainManager.Dock = DockStyle.Fill;
+
+ mailDomainManagerDock = new DockContent();
+ mailDomainManagerDock.Controls.Add(this.mailDomainManager);
+ mailDomainManagerDock.Text = "Mail Domains";
+ mailDomainManagerDock.DockPanel = this.dockPanel;
+ mailDomainManagerDock.DockState = DockState.Hidden;
+ mailDomainManagerDock.Icon = IconHelper.GetIcon("server", "actions", IconSize.s16x16);
+ mailDomainManagerDock.FormClosing += new FormClosingEventHandler(mailDomainManagerDock_FormClosing);
+ }
+
+ void mailDomainManagerDock_FormClosing(object sender, FormClosingEventArgs e) {
+ if (e.CloseReason == CloseReason.UserClosing) {
+ e.Cancel = true;
+
+ this.mailDomainManagerDock.DockState = DockState.Hidden;
+ }
+ }
+
public void ShowMailDomainControl() {
+ if (!Connected) {
+ ShowStatusBrowser();
+
+ } else {
+ this.mailDomainManagerDock.DockState = DockState.Document;
+ this.mailDomainManagerDock.DockHandler.DockTo(this.dockPanel.DockWindows[DockState.Document].NestedPanes[0], DockStyle.Fill, 0);
+ }
}
+ #endregion
public void ShowUsersControl() {
}
Modified: NMail/trunk/NMail.Administration.WinForms/NMail.Administration.WinForms.csproj
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/NMail.Administration.WinForms.csproj 2007-05-27 13:41:01 UTC (rev 205)
+++ NMail/trunk/NMail.Administration.WinForms/NMail.Administration.WinForms.csproj 2007-05-27 13:42:04 UTC (rev 206)
@@ -49,6 +49,12 @@
</Reference>
</ItemGroup>
<ItemGroup>
+ <Compile Include="AuthenticationPrompt.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="AuthenticationPrompt.Designer.cs">
+ <DependentUpon>AuthenticationPrompt.cs</DependentUpon>
+ </Compile>
<Compile Include="ConnectForm.cs">
<SubType>Form</SubType>
</Compile>
@@ -61,6 +67,12 @@
<Compile Include="ExceptionDialog.Designer.cs">
<DependentUpon>ExceptionDialog.cs</DependentUpon>
</Compile>
+ <Compile Include="MailDomain\MailDomainManager.cs">
+ <SubType>UserControl</SubType>
+ </Compile>
+ <Compile Include="MailDomain\MailDomainManager.Designer.cs">
+ <DependentUpon>MailDomainManager.cs</DependentUpon>
+ </Compile>
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
@@ -75,6 +87,10 @@
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
+ <EmbeddedResource Include="AuthenticationPrompt.resx">
+ <SubType>Designer</SubType>
+ <DependentUpon>AuthenticationPrompt.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="ConnectForm.resx">
<DependentUpon>ConnectForm.cs</DependentUpon>
<SubType>Designer</SubType>
@@ -83,6 +99,10 @@
<SubType>Designer</SubType>
<DependentUpon>ExceptionDialog.cs</DependentUpon>
</EmbeddedResource>
+ <EmbeddedResource Include="MailDomain\MailDomainManager.resx">
+ <SubType>Designer</SubType>
+ <DependentUpon>MailDomainManager.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="MainForm.resx">
<SubType>Designer</SubType>
<DependentUpon>MainForm.cs</DependentUpon>
@@ -171,10 +191,11 @@
<Project>{45123319-D913-4A92-BB67-C2C9E1A22A17}</Project>
<Name>NMail.Server</Name>
</ProjectReference>
+ <ProjectReference Include="..\NMail\NMail.csproj">
+ <Project>{5A5A5012-B157-49B1-A35F-67EC9680112A}</Project>
+ <Name>NMail</Name>
+ </ProjectReference>
</ItemGroup>
- <ItemGroup>
- <Folder Include="MailDomain\" />
- </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Modified: NMail/trunk/NMail.Administration.WinForms/Program.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/Program.cs 2007-05-27 13:41:01 UTC (rev 205)
+++ NMail/trunk/NMail.Administration.WinForms/Program.cs 2007-05-27 13:42:04 UTC (rev 206)
@@ -22,7 +22,7 @@
using System.Windows.Forms;
namespace NMail.Administration.WinForms {
- static class Program {
+ static internal class Program {
/// <summary>
/// The main entry point for the application.
/// </summary>
@@ -48,10 +48,14 @@
} else {
// Unhandled exception, show the user
- ExceptionDialog ed = new ExceptionDialog();
- ed.SetException(e.Exception);
- ed.ShowDialog();
+ ShowExceptionDialog(e.Exception);
}
}
+
+ internal static void ShowExceptionDialog(Exception ex) {
+ ExceptionDialog ed = new ExceptionDialog();
+ ed.SetException(ex);
+ ed.ShowDialog();
+ }
}
}
\ No newline at end of file
Modified: NMail/trunk/NMail.Icons/NMail.Icons.csproj
===================================================================
--- NMail/trunk/NMail.Icons/NMail.Icons.csproj 2007-05-27 13:41:01 UTC (rev 205)
+++ NMail/trunk/NMail.Icons/NMail.Icons.csproj 2007-05-27 13:42:04 UTC (rev 206)
@@ -56,6 +56,7 @@
<EmbeddedResource Include="Resources\22x22\actions\edit_group.png" />
<EmbeddedResource Include="Resources\22x22\actions\folder.png" />
<EmbeddedResource Include="Resources\22x22\actions\queue.png" />
+ <EmbeddedResource Include="Resources\32x32\apps\password.png" />
<Content Include="Resources\LGPL.txt" />
</ItemGroup>
<ItemGroup>
Added: NMail/trunk/NMail.Icons/Resources/32x32/apps/password.png
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/NMail.Icons/Resources/32x32/apps/password.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2007-05-27 13:41:00
|
Revision: 205
http://svn.sourceforge.net/nmailserver/?rev=205&view=rev
Author: tmyroadctfig
Date: 2007-05-27 06:41:01 -0700 (Sun, 27 May 2007)
Log Message:
-----------
Fixed defect involved updating items with the same name. Added the ability to validate group/mail domain user/group Ids.
Modified Paths:
--------------
NMail/trunk/NMail.LocalStoreData.NHibernate/Mappings/NMail.DataTypes.LocalStore.LocalStoreGroup.hbm.xml
NMail/trunk/NMail.LocalStoreData.NHibernate/Mappings/NMail.DataTypes.LocalStore.MailDomain.hbm.xml
NMail/trunk/NMail.LocalStoreData.NHibernate/NHibernateLocalStoreData.cs
Modified: NMail/trunk/NMail.LocalStoreData.NHibernate/Mappings/NMail.DataTypes.LocalStore.LocalStoreGroup.hbm.xml
===================================================================
--- NMail/trunk/NMail.LocalStoreData.NHibernate/Mappings/NMail.DataTypes.LocalStore.LocalStoreGroup.hbm.xml 2007-05-27 13:38:47 UTC (rev 204)
+++ NMail/trunk/NMail.LocalStoreData.NHibernate/Mappings/NMail.DataTypes.LocalStore.LocalStoreGroup.hbm.xml 2007-05-27 13:41:01 UTC (rev 205)
@@ -12,13 +12,13 @@
<list name="SubGroupIds" table="GroupSubGroups">
<key column="ParentGroupId" />
<index column="ChildIndex" type="Int32" />
- <many-to-many column="GroupId" class="NMail.DataTypes.LocalStore.LocalStoreGroup" />
+ <element column="GroupId" type="Int32" />
</list>
<list name="UserIds" table="GroupUsers">
<key column="GroupId" />
<index column="ChildIndex" type="Int32" />
- <many-to-many column="UserId" class="NMail.DataTypes.LocalStore.LocalStoreUser" />
+ <element column="UserId" type="Int32" />
</list>
</class>
Modified: NMail/trunk/NMail.LocalStoreData.NHibernate/Mappings/NMail.DataTypes.LocalStore.MailDomain.hbm.xml
===================================================================
--- NMail/trunk/NMail.LocalStoreData.NHibernate/Mappings/NMail.DataTypes.LocalStore.MailDomain.hbm.xml 2007-05-27 13:38:47 UTC (rev 204)
+++ NMail/trunk/NMail.LocalStoreData.NHibernate/Mappings/NMail.DataTypes.LocalStore.MailDomain.hbm.xml 2007-05-27 13:41:01 UTC (rev 205)
@@ -12,13 +12,13 @@
<list name="GroupIds" table="MailDomainGroups">
<key column="MailDomainId" />
<index column="ChildIndex" type="Int32" />
- <many-to-many column="GroupId" class="NMail.DataTypes.LocalStore.LocalStoreGroup" />
+ <element column="GroupId" type="Int32" />
</list>
<list name="UserIds" table="MailDomainUsers">
<key column="MailDomainId" />
<index column="ChildIndex" type="Int32" />
- <many-to-many column="UserId" class="NMail.DataTypes.LocalStore.LocalStoreUser" />
+ <element column="UserId" type="Int32" />
</list>
<list name="AdditionalHosts" table="MailDomainHosts">
Modified: NMail/trunk/NMail.LocalStoreData.NHibernate/NHibernateLocalStoreData.cs
===================================================================
--- NMail/trunk/NMail.LocalStoreData.NHibernate/NHibernateLocalStoreData.cs 2007-05-27 13:38:47 UTC (rev 204)
+++ NMail/trunk/NMail.LocalStoreData.NHibernate/NHibernateLocalStoreData.cs 2007-05-27 13:41:01 UTC (rev 205)
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Security.Cryptography;
@@ -1083,15 +1084,27 @@
public void UpdateUser(LocalStoreUser user) {
using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
- // Check if any other user with the same name exists in the system
- IList<LocalStoreUser> existing = session.CreateCriteria(typeof(LocalStoreUser))
- .Add(Expression.Like("Username", user.Username))
- .List<LocalStoreUser>();
- if (existing.Count > 0) {
- throw new DuplicateNameException("User with the same name already exists in the system.");
+ LocalStoreUser current = session.Get<LocalStoreUser>(user.UserId);
+
+ if (current == null) {
+ throw new ArgumentException("Invalid user Id.");
}
+ // Check if the name has changed
+ if (CaseInsensitiveComparer.Default.Compare(user.Username, current.Username) != 0) {
+
+ // Check if any other user with the same name exists in the system
+ IList<LocalStoreUser> existing = session.CreateCriteria(typeof(LocalStoreUser))
+ .Add(Expression.Like("Username", user.Username))
+ .List<LocalStoreUser>();
+
+ if (existing.Count > 0) {
+ throw new DuplicateNameException("User with the same name already exists in the system.");
+ }
+ }
+ session.Evict(current);
+
session.Update(user);
tx.Commit();
@@ -1192,6 +1205,10 @@
throw new DuplicateNameException("Group with the same name already exists in the system.");
}
+ // Validate user and group Ids
+ ValidateGroupIds(group.SubGroupIds, session);
+ ValidateUserIds(group.UserIds, session);
+
session.Save(group);
tx.Commit();
@@ -1230,15 +1247,31 @@
public void UpdateGroup(LocalStoreGroup group) {
using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
- // Check if any other group with the same name exists in the system
- IList<LocalStoreUser> existing = session.CreateCriteria(typeof(LocalStoreGroup))
- .Add(Expression.Like("Name", group.Name))
- .List<LocalStoreUser>();
+
+ LocalStoreGroup current = session.Get<LocalStoreGroup>(group.GroupId);
- if (existing.Count > 0) {
- throw new DuplicateNameException("Group with the same name already exists in the system.");
+ if (current == null) {
+ throw new ArgumentException("Invalid group Id.");
}
+ // Check if the name has changed
+ if (CaseInsensitiveComparer.Default.Compare(group.Name, current.Name) != 0) {
+
+ // Check if any other group with the same name exists in the system
+ IList<LocalStoreGroup> existing = session.CreateCriteria(typeof(LocalStoreGroup))
+ .Add(Expression.Like("Name", group.Name))
+ .List<LocalStoreGroup>();
+
+ if (existing.Count > 0) {
+ throw new DuplicateNameException("Group with the same name already exists in the system.");
+ }
+ }
+ session.Evict(current);
+
+ // Validate user and group Ids
+ ValidateGroupIds(group.SubGroupIds, session);
+ ValidateUserIds(group.UserIds, session);
+
session.Update(group);
tx.Commit();
@@ -1449,6 +1482,10 @@
throw new DuplicateNameException("Mail domain with the same primary host already exists in the system.");
}
+ // Validate user and group Ids
+ ValidateGroupIds(mailDomain.GroupIds, session);
+ ValidateUserIds(mailDomain.UserIds, session);
+
session.Save(mailDomain);
tx.Commit();
@@ -1486,15 +1523,31 @@
public void UpdateMailDomain(MailDomain updatedMailDomain) {
using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
- // Check if any other group with the same name exists in the system
- IList<MailDomain> existing = session.CreateCriteria(typeof(MailDomain))
- .Add(Expression.Like("PrimaryHost", updatedMailDomain.PrimaryHost))
- .List<MailDomain>();
- if (existing.Count > 0) {
- throw new DuplicateNameException("Mail domain with the same primary host already exists in the system.");
+ MailDomain current = session.Get<MailDomain>(updatedMailDomain.MailDomainId);
+
+ if (current == null) {
+ throw new ArgumentException("Invalid mail domain Id.");
}
+ // Check if the primary host has changed
+ if (current.PrimaryHost != updatedMailDomain.PrimaryHost) {
+
+ // Check if any other group with the same name exists in the system
+ IList<MailDomain> existing = session.CreateCriteria(typeof(MailDomain))
+ .Add(Expression.Like("PrimaryHost", updatedMailDomain.PrimaryHost))
+ .List<MailDomain>();
+
+ if (existing.Count > 0) {
+ throw new DuplicateNameException("Mail domain with the same primary host already exists in the system.");
+ }
+ }
+ session.Evict(current);
+
+ // Validate user and group Ids
+ ValidateGroupIds(updatedMailDomain.GroupIds, session);
+ ValidateUserIds(updatedMailDomain.UserIds, session);
+
session.Update(updatedMailDomain);
tx.Commit();
@@ -1832,8 +1885,50 @@
LocalStoreUser administrator = new LocalStoreUser();
administrator.Username = "Administrator"; // TODO: get from a global admin name or something
CreateUser(administrator);
+
+ LocalStoreGroup adminGroup = new LocalStoreGroup();
+ adminGroup.Name = "Administrators"; // TODO: get from a global admin name or something
+ CreateGroup(adminGroup);
+
+ MailDomain localMailDomain = new MailDomain();
+ localMailDomain.PrimaryHost = new Host(Domain.LocalHost);
+ localMailDomain.UserIds.Add(administrator.UserId);
+ localMailDomain.GroupIds.Add(adminGroup.GroupId);
+ CreateMailDomain(localMailDomain);
}
#endregion
+
+ protected void ValidateUserIds(IList<int> userIds, ISession session) {
+ // Ensure session has started a transaction
+ if (!session.Transaction.IsActive) {
+ throw new InvalidOperationException("A transaction is required for this operation.");
+ }
+
+ // Validate each user Id
+ foreach (int userId in userIds) {
+ LocalStoreUser user = session.Get<LocalStoreUser>(userId);
+
+ if (user == null) {
+ throw new ArgumentException("Invalid user Id.");
+ }
+ }
+ }
+
+ protected void ValidateGroupIds(IList<int> groupIds, ISession session) {
+ // Ensure session has started a transaction
+ if (!session.Transaction.IsActive) {
+ throw new InvalidOperationException("A transaction is required for this operation.");
+ }
+
+ // Validate each group Id
+ foreach (int groupId in groupIds) {
+ LocalStoreGroup group = session.Get<LocalStoreGroup>(groupId);
+
+ if (group == null) {
+ throw new ArgumentException("Invalid group Id.");
+ }
+ }
+ }
#endregion
/// <summary>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2007-05-27 13:38:48
|
Revision: 204
http://svn.sourceforge.net/nmailserver/?rev=204&view=rev
Author: tmyroadctfig
Date: 2007-05-27 06:38:47 -0700 (Sun, 27 May 2007)
Log Message:
-----------
Added ability to set administrator password.
Modified Paths:
--------------
NMail/trunk/NMail.SetupWizard/ServiceConfigPanel.Designer.cs
NMail/trunk/NMail.SetupWizard/ServiceConfigPanel.cs
Modified: NMail/trunk/NMail.SetupWizard/ServiceConfigPanel.Designer.cs
===================================================================
--- NMail/trunk/NMail.SetupWizard/ServiceConfigPanel.Designer.cs 2007-05-27 13:37:42 UTC (rev 203)
+++ NMail/trunk/NMail.SetupWizard/ServiceConfigPanel.Designer.cs 2007-05-27 13:38:47 UTC (rev 204)
@@ -26,6 +26,11 @@
this.systemStartCheckBox = new System.Windows.Forms.CheckBox();
this.descriptionTextBox = new System.Windows.Forms.TextBox();
this.startNowCheckBox = new System.Windows.Forms.CheckBox();
+ this.resetAdminPassCheckBox = new System.Windows.Forms.CheckBox();
+ this.adminPasswordTextBox = new System.Windows.Forms.TextBox();
+ this.passwordLbl = new System.Windows.Forms.Label();
+ this.confimLbl = new System.Windows.Forms.Label();
+ this.confirmPasswordTextBox = new System.Windows.Forms.TextBox();
this.mainPanel.SuspendLayout();
this.SuspendLayout();
//
@@ -36,6 +41,11 @@
//
// mainPanel
//
+ this.mainPanel.Controls.Add(this.confirmPasswordTextBox);
+ this.mainPanel.Controls.Add(this.confimLbl);
+ this.mainPanel.Controls.Add(this.passwordLbl);
+ this.mainPanel.Controls.Add(this.adminPasswordTextBox);
+ this.mainPanel.Controls.Add(this.resetAdminPassCheckBox);
this.mainPanel.Controls.Add(this.startNowCheckBox);
this.mainPanel.Controls.Add(this.descriptionTextBox);
this.mainPanel.Controls.Add(this.systemStartCheckBox);
@@ -74,6 +84,55 @@
this.startNowCheckBox.Text = "Start NMail service now.";
this.startNowCheckBox.UseVisualStyleBackColor = true;
//
+ // resetAdminPassCheckBox
+ //
+ this.resetAdminPassCheckBox.AutoSize = true;
+ this.resetAdminPassCheckBox.Checked = true;
+ this.resetAdminPassCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.resetAdminPassCheckBox.Location = new System.Drawing.Point(35, 141);
+ this.resetAdminPassCheckBox.Name = "resetAdminPassCheckBox";
+ this.resetAdminPassCheckBox.Size = new System.Drawing.Size(168, 17);
+ this.resetAdminPassCheckBox.TabIndex = 4;
+ this.resetAdminPassCheckBox.Text = "Reset Administrator password.";
+ this.resetAdminPassCheckBox.UseVisualStyleBackColor = true;
+ this.resetAdminPassCheckBox.CheckedChanged += new System.EventHandler(this.resetAdminPassCheckBox_CheckedChanged);
+ //
+ // adminPasswordTextBox
+ //
+ this.adminPasswordTextBox.Location = new System.Drawing.Point(97, 162);
+ this.adminPasswordTextBox.Name = "adminPasswordTextBox";
+ this.adminPasswordTextBox.PasswordChar = '*';
+ this.adminPasswordTextBox.Size = new System.Drawing.Size(106, 20);
+ this.adminPasswordTextBox.TabIndex = 5;
+ this.adminPasswordTextBox.UseSystemPasswordChar = true;
+ //
+ // passwordLbl
+ //
+ this.passwordLbl.AutoSize = true;
+ this.passwordLbl.Location = new System.Drawing.Point(35, 165);
+ this.passwordLbl.Name = "passwordLbl";
+ this.passwordLbl.Size = new System.Drawing.Size(56, 13);
+ this.passwordLbl.TabIndex = 6;
+ this.passwordLbl.Text = "Password:";
+ //
+ // confimLbl
+ //
+ this.confimLbl.AutoSize = true;
+ this.confimLbl.Location = new System.Drawing.Point(46, 191);
+ this.confimLbl.Name = "confimLbl";
+ this.confimLbl.Size = new System.Drawing.Size(45, 13);
+ this.confimLbl.TabIndex = 7;
+ this.confimLbl.Text = "Confirm:";
+ //
+ // confirmPasswordTextBox
+ //
+ this.confirmPasswordTextBox.Location = new System.Drawing.Point(97, 188);
+ this.confirmPasswordTextBox.Name = "confirmPasswordTextBox";
+ this.confirmPasswordTextBox.PasswordChar = '*';
+ this.confirmPasswordTextBox.Size = new System.Drawing.Size(106, 20);
+ this.confirmPasswordTextBox.TabIndex = 8;
+ this.confirmPasswordTextBox.UseSystemPasswordChar = true;
+ //
// ServiceConfigPanel
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -90,5 +149,10 @@
private System.Windows.Forms.CheckBox systemStartCheckBox;
private System.Windows.Forms.TextBox descriptionTextBox;
private System.Windows.Forms.CheckBox startNowCheckBox;
+ private System.Windows.Forms.Label passwordLbl;
+ private System.Windows.Forms.TextBox adminPasswordTextBox;
+ private System.Windows.Forms.CheckBox resetAdminPassCheckBox;
+ private System.Windows.Forms.TextBox confirmPasswordTextBox;
+ private System.Windows.Forms.Label confimLbl;
}
}
Modified: NMail/trunk/NMail.SetupWizard/ServiceConfigPanel.cs
===================================================================
--- NMail/trunk/NMail.SetupWizard/ServiceConfigPanel.cs 2007-05-27 13:37:42 UTC (rev 203)
+++ NMail/trunk/NMail.SetupWizard/ServiceConfigPanel.cs 2007-05-27 13:38:47 UTC (rev 204)
@@ -20,6 +20,7 @@
// Setup the tasks for this panel
this.configServiceTask = new Task("Configure NMail service startup.", new TaskDelegate(configureServiceStartup));
this.startNMailTask = new Task("Start the NMail service.", new TaskDelegate(startNMailNow));
+ this.setAdminPasswordTask = new Task("Reset the administrator password.", new TaskDelegate(setAdminPassword));
// Find the NMail service controller
ServiceController[] services = ServiceController.GetServices();
@@ -31,7 +32,42 @@
}
}
}
+
+ private void resetAdminPassCheckBox_CheckedChanged(object sender, EventArgs e) {
+ this.adminPasswordTextBox.Enabled = this.resetAdminPassCheckBox.Checked;
+ this.confirmPasswordTextBox.Enabled = this.resetAdminPassCheckBox.Checked;
+ }
+ private Task setAdminPasswordTask;
+
+ /// <summary>
+ /// The task delegate used to reset the administrator password.
+ /// </summary>
+ /// <param name="message">An error message if any problems occur.</param>
+ /// <returns>The result of the start attempt.</returns>
+ private TaskResult setAdminPassword(out string message) {
+ try {
+ NMail.Authentication.IAuthenticationProvider authProvider = NMail.Configuration.NMailConfiguration.Current.AuthenticationProvider;
+ NMail.Authentication.IAuthenticationToken authToken = authProvider.CreateAuthToken("Administrator");
+
+ if (authProvider.ChangePassword(authToken, this.adminPasswordTextBox.Text)) {
+ authProvider.ResetLockOut("Administrator");
+ authProvider.SetEnabled("Administrator", true);
+
+ message = null;
+ return TaskResult.Ok;
+
+ } else {
+ message = "Failed to successfully set the administrator password.";
+ return TaskResult.Error;
+ }
+
+ } catch (Exception e) {
+ message = "Error setting administrator password: " + e.Message;
+ return TaskResult.Error;
+ }
+ }
+
private ServiceController nmailServiceController;
private Task startNMailTask;
@@ -40,7 +76,7 @@
/// The task delegate used to start the NMail service.
/// </summary>
/// <param name="message">An error message if any problems occur.</param>
- /// <returns>The result of hte start attempt.</returns>
+ /// <returns>The result of the start attempt.</returns>
private TaskResult startNMailNow(out string message) {
try {
if (this.nmailServiceController.Status == ServiceControllerStatus.Stopped) {
@@ -94,13 +130,42 @@
this.BaseForm.Tasks.Add(this.startNMailTask);
}
+ if (this.resetAdminPassCheckBox.Checked) {
+ if (this.adminPasswordTextBox.Text == string.Empty) {
+ MessageBox.Show(
+ this,
+ "Invalid password.",
+ "Error",
+ MessageBoxButtons.OK,
+ MessageBoxIcon.Error);
+
+ // Can't pass go & collect $200
+ return;
+
+ } else if (this.adminPasswordTextBox.Text != this.confirmPasswordTextBox.Text) {
+ MessageBox.Show(
+ this,
+ "Passwords don't match.",
+ "Error",
+ MessageBoxButtons.OK,
+ MessageBoxIcon.Error);
+
+ // Can't pass go & collect $200
+ return;
+
+ } else if (!this.BaseForm.Tasks.Contains(this.setAdminPasswordTask)) {
+ this.BaseForm.Tasks.Add(this.setAdminPasswordTask);
+ }
+ }
+
base.OnNextButtonClick();
}
protected override void OnBackButtonClick() {
this.BaseForm.Tasks.Remove(this.startNMailTask);
this.BaseForm.Tasks.Remove(this.configServiceTask);
-
+ this.BaseForm.Tasks.Remove(this.setAdminPasswordTask);
+
base.OnBackButtonClick();
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2007-05-27 13:37:41
|
Revision: 203
http://svn.sourceforge.net/nmailserver/?rev=203&view=rev
Author: tmyroadctfig
Date: 2007-05-27 06:37:42 -0700 (Sun, 27 May 2007)
Log Message:
-----------
Work on unit tests.
Modified Paths:
--------------
NMail/trunk/NMail.UnitTests/LocalStoreData/DeleteMailDomainTest1.cs
NMail/trunk/NMail.UnitTests/NMail.UnitTests.csproj
Added Paths:
-----------
NMail/trunk/NMail.UnitTests/LocalStoreData/AddUserToGroupTest1.cs
NMail/trunk/NMail.UnitTests/LocalStoreData/AddUserToMailDomainTest1.cs
Added: NMail/trunk/NMail.UnitTests/LocalStoreData/AddUserToGroupTest1.cs
===================================================================
--- NMail/trunk/NMail.UnitTests/LocalStoreData/AddUserToGroupTest1.cs (rev 0)
+++ NMail/trunk/NMail.UnitTests/LocalStoreData/AddUserToGroupTest1.cs 2007-05-27 13:37:42 UTC (rev 203)
@@ -0,0 +1,41 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Text;
+
+using NUnit.Framework;
+
+using NMail.Configuration;
+using NMail.DataTypes.Calendar;
+using NMail.DataTypes.LocalStore;
+
+namespace NMail.UnitTests.LocalStoreData {
+ /// <summary>
+ /// Tests adding a user to a group.
+ /// </summary>
+ [TestFixture]
+ public class AddUserToGroupTest1 : BaseLocalStoreDataTest {
+
+ [ExpectedException(typeof(ArgumentException))]
+ [Test]
+ public void TestUpdateGroup() {
+ LocalStoreGroup group1 = new LocalStoreGroup();
+ group1.Name = "Test";
+ this.localStoreData.CreateGroup(group1);
+
+ Assert.IsTrue(group1.GroupId > 0, "Valid group Id.");
+
+ LocalStoreUser user1 = new LocalStoreUser();
+ user1.Username = "Test";
+ this.localStoreData.CreateUser(user1);
+
+ Assert.IsTrue(user1.UserId > 0, "Valid user Id.");
+
+ group1.UserIds.Add(user1.UserId);
+ this.localStoreData.UpdateGroup(group1);
+
+ group1.UserIds.Add(-1);
+ this.localStoreData.UpdateGroup(group1);
+ }
+ }
+}
Added: NMail/trunk/NMail.UnitTests/LocalStoreData/AddUserToMailDomainTest1.cs
===================================================================
--- NMail/trunk/NMail.UnitTests/LocalStoreData/AddUserToMailDomainTest1.cs (rev 0)
+++ NMail/trunk/NMail.UnitTests/LocalStoreData/AddUserToMailDomainTest1.cs 2007-05-27 13:37:42 UTC (rev 203)
@@ -0,0 +1,41 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Text;
+
+using NUnit.Framework;
+
+using NMail.Configuration;
+using NMail.DataTypes.Calendar;
+using NMail.DataTypes.LocalStore;
+
+namespace NMail.UnitTests.LocalStoreData {
+ /// <summary>
+ /// Tests adding a user to a mail domain.
+ /// </summary>
+ [TestFixture]
+ public class AddUserToMailDomainTest1 : BaseLocalStoreDataTest {
+
+ [ExpectedException(typeof(ArgumentException))]
+ [Test]
+ public void TestUpdateMailDomain() {
+ MailDomain md1 = new MailDomain();
+ md1.PrimaryHost = new NMail.DataTypes.Host("test.tld");
+ this.localStoreData.CreateMailDomain(md1);
+
+ Assert.IsTrue(md1.MailDomainId > 0, "Valid mail domain Id.");
+
+ LocalStoreUser user1 = new LocalStoreUser();
+ user1.Username = "Test";
+ this.localStoreData.CreateUser(user1);
+
+ Assert.IsTrue(user1.UserId > 0, "Valid user Id.");
+
+ md1.UserIds.Add(user1.UserId);
+ this.localStoreData.UpdateMailDomain(md1);
+
+ md1.UserIds.Add(-1);
+ this.localStoreData.UpdateMailDomain(md1);
+ }
+ }
+}
Modified: NMail/trunk/NMail.UnitTests/LocalStoreData/DeleteMailDomainTest1.cs
===================================================================
--- NMail/trunk/NMail.UnitTests/LocalStoreData/DeleteMailDomainTest1.cs 2007-05-27 13:34:27 UTC (rev 202)
+++ NMail/trunk/NMail.UnitTests/LocalStoreData/DeleteMailDomainTest1.cs 2007-05-27 13:37:42 UTC (rev 203)
@@ -26,11 +26,11 @@
Assert.IsTrue(m1.MailDomainId > 0, "Valid mail domain Id.");
- Assert.IsTrue(localStoreData.GetMailDomains().Count > 0, "Mail domain exists.");
+ Assert.IsTrue(localStoreData.GetMailDomains().Count > 1, "Mail domains exist.");
localStoreData.DeleteMailDomain(m1.MailDomainId);
- Assert.IsTrue(localStoreData.GetMailDomains().Count == 0, "No mail domains exist.");
+ Assert.IsTrue(localStoreData.GetMailDomains().Count == 1, "One mail domain exists.");
}
}
}
Modified: NMail/trunk/NMail.UnitTests/NMail.UnitTests.csproj
===================================================================
--- NMail/trunk/NMail.UnitTests/NMail.UnitTests.csproj 2007-05-27 13:34:27 UTC (rev 202)
+++ NMail/trunk/NMail.UnitTests/NMail.UnitTests.csproj 2007-05-27 13:37:42 UTC (rev 203)
@@ -54,6 +54,8 @@
<Compile Include="DataTypes\Helper\MimeHelperTests.cs" />
<Compile Include="DataTypes\Helper\StringTokenizerTests.cs" />
<Compile Include="LocalStoreData\BaseLocalStoreDataTest.cs" />
+ <Compile Include="LocalStoreData\AddUserToGroupTest1.cs" />
+ <Compile Include="LocalStoreData\AddUserToMailDomainTest1.cs" />
<Compile Include="LocalStoreData\GetSetRemoveUserGroupAdminAceTest1.cs" />
<Compile Include="LocalStoreData\GetSetRemoveSystemAceTest1.cs" />
<Compile Include="LocalStoreData\LoadSaveObjectTest1.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2007-05-27 13:34:28
|
Revision: 202
http://svn.sourceforge.net/nmailserver/?rev=202&view=rev
Author: tmyroadctfig
Date: 2007-05-27 06:34:27 -0700 (Sun, 27 May 2007)
Log Message:
-----------
Fixed a defect in auth provider.
Modified Paths:
--------------
NMail/trunk/NMail.LocalStoreData.NHibernate/NHibernateAuthProvider.cs
Modified: NMail/trunk/NMail.LocalStoreData.NHibernate/NHibernateAuthProvider.cs
===================================================================
--- NMail/trunk/NMail.LocalStoreData.NHibernate/NHibernateAuthProvider.cs 2007-05-27 13:31:36 UTC (rev 201)
+++ NMail/trunk/NMail.LocalStoreData.NHibernate/NHibernateAuthProvider.cs 2007-05-27 13:34:27 UTC (rev 202)
@@ -310,7 +310,7 @@
BasicAuthToken authToken = null;
- if (password == user.Password) {
+ if (user != null && password == user.Password) {
authToken = createValidatedToken(user, session);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2007-05-27 13:31:37
|
Revision: 201
http://svn.sourceforge.net/nmailserver/?rev=201&view=rev
Author: tmyroadctfig
Date: 2007-05-27 06:31:36 -0700 (Sun, 27 May 2007)
Log Message:
-----------
Changed base type to int to prevent exception in NHibernate.
Modified Paths:
--------------
NMail/trunk/NMail/DataTypes/ACLs/MailDomainPrivilege.cs
NMail/trunk/NMail/DataTypes/ACLs/StoreFolderPrivilege.cs
NMail/trunk/NMail/DataTypes/ACLs/UserGroupAdminPrivilege.cs
Modified: NMail/trunk/NMail/DataTypes/ACLs/MailDomainPrivilege.cs
===================================================================
--- NMail/trunk/NMail/DataTypes/ACLs/MailDomainPrivilege.cs 2007-05-27 02:56:24 UTC (rev 200)
+++ NMail/trunk/NMail/DataTypes/ACLs/MailDomainPrivilege.cs 2007-05-27 13:31:36 UTC (rev 201)
@@ -7,7 +7,7 @@
/// The possible privileges that can be listed on a mail domain ACL entry.
/// </summary>
[FlagsAttribute]
- public enum MailDomainPrivilege : uint {
+ public enum MailDomainPrivilege : int {
/// <summary>
/// No rights are granted.
/// </summary>
Modified: NMail/trunk/NMail/DataTypes/ACLs/StoreFolderPrivilege.cs
===================================================================
--- NMail/trunk/NMail/DataTypes/ACLs/StoreFolderPrivilege.cs 2007-05-27 02:56:24 UTC (rev 200)
+++ NMail/trunk/NMail/DataTypes/ACLs/StoreFolderPrivilege.cs 2007-05-27 13:31:36 UTC (rev 201)
@@ -24,7 +24,7 @@
/// The possible privileges that can be listed on a store folder ACL entry.
/// </summary>
[FlagsAttribute]
- public enum StoreFolderPrivilege : uint {
+ public enum StoreFolderPrivilege : int {
/// <summary>
/// No rights are granted.
/// </summary>
Modified: NMail/trunk/NMail/DataTypes/ACLs/UserGroupAdminPrivilege.cs
===================================================================
--- NMail/trunk/NMail/DataTypes/ACLs/UserGroupAdminPrivilege.cs 2007-05-27 02:56:24 UTC (rev 200)
+++ NMail/trunk/NMail/DataTypes/ACLs/UserGroupAdminPrivilege.cs 2007-05-27 13:31:36 UTC (rev 201)
@@ -8,7 +8,7 @@
/// groups.
/// </summary>
[FlagsAttribute]
- public enum UserGroupAdminPrivilege : uint {
+ public enum UserGroupAdminPrivilege : int {
/// <summary>
/// No rights are granted.
/// </summary>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2007-05-27 02:56:25
|
Revision: 200
http://svn.sourceforge.net/nmailserver/?rev=200&view=rev
Author: tmyroadctfig
Date: 2007-05-26 19:56:24 -0700 (Sat, 26 May 2007)
Log Message:
-----------
More work on windows administration tool.
Modified Paths:
--------------
NMail/trunk/NMail.Administration.WinForms/MainForm.Designer.cs
NMail/trunk/NMail.Administration.WinForms/MainForm.cs
NMail/trunk/NMail.Administration.WinForms/NMail.Administration.WinForms.csproj
NMail/trunk/NMail.Administration.WinForms/Resources/ConnectFailed.html
NMail/trunk/NMail.Administration.WinForms/Resources/NotConnected.html
NMail/trunk/NMail.Administration.WinForms/Resources/Welcome.html
Added Paths:
-----------
NMail/trunk/NMail.Administration.WinForms/Resources/Connected.html
NMail/trunk/NMail.Administration.WinForms/Resources/LGPL/
NMail/trunk/NMail.Administration.WinForms/Resources/LGPL/LGPL.txt
NMail/trunk/NMail.Administration.WinForms/Resources/LGPL/connect_no.png
NMail/trunk/NMail.Administration.WinForms/Resources/LGPL/disconnect.png
NMail/trunk/NMail.Administration.WinForms/Resources/LGPL/edit_group.png
NMail/trunk/NMail.Administration.WinForms/Resources/LGPL/exec.png
NMail/trunk/NMail.Administration.WinForms/Resources/LGPL/folder.png
NMail/trunk/NMail.Administration.WinForms/Resources/LGPL/kcmdf.png
NMail/trunk/NMail.Administration.WinForms/Resources/LGPL/queue.png
NMail/trunk/NMail.Administration.WinForms/Resources/LGPL/server.png
NMail/trunk/NMail.Administration.WinForms/Resources/style.css
NMail/trunk/NMail.Icons/Resources/32x32/actions/edit_group.png
NMail/trunk/NMail.Icons/Resources/32x32/actions/exec.png
NMail/trunk/NMail.Icons/Resources/32x32/actions/queue.png
NMail/trunk/NMail.Icons/Resources/32x32/actions/server.png
NMail/trunk/NMail.Icons/Resources/32x32/filesystems/
NMail/trunk/NMail.Icons/Resources/32x32/filesystems/folder.png
Modified: NMail/trunk/NMail.Administration.WinForms/MainForm.Designer.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/MainForm.Designer.cs 2007-05-21 10:55:56 UTC (rev 199)
+++ NMail/trunk/NMail.Administration.WinForms/MainForm.Designer.cs 2007-05-27 02:56:24 UTC (rev 200)
@@ -29,12 +29,12 @@
this.disconnectMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.exitMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.loadingCircle1 = new MRG.Controls.UI.LoadingCircleToolStripMenuItem();
this.statusStrip = new System.Windows.Forms.StatusStrip();
this.serverNameLbl = new System.Windows.Forms.ToolStripStatusLabel();
this.connectionStatusLbl = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripContainer = new System.Windows.Forms.ToolStripContainer();
this.dockPanel = new WeifenLuo.WinFormsUI.Docking.DockPanel();
- this.loadingCircle1 = new MRG.Controls.UI.LoadingCircleToolStripMenuItem();
this.menuStrip.SuspendLayout();
this.statusStrip.SuspendLayout();
this.toolStripContainer.ContentPanel.SuspendLayout();
@@ -89,6 +89,33 @@
this.exitMenuItem.Text = "Exit";
this.exitMenuItem.Click += new System.EventHandler(this.exitMenuItem_Click);
//
+ // loadingCircle1
+ //
+ this.loadingCircle1.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
+ this.loadingCircle1.BackColor = System.Drawing.Color.Transparent;
+ this.loadingCircle1.Enabled = false;
+ //
+ // loadingCircle1
+ //
+ this.loadingCircle1.LoadingCircleControl.AccessibleName = "loadingCircle1";
+ this.loadingCircle1.LoadingCircleControl.Active = false;
+ this.loadingCircle1.LoadingCircleControl.BackColor = System.Drawing.Color.Transparent;
+ this.loadingCircle1.LoadingCircleControl.Color = System.Drawing.Color.Black;
+ this.loadingCircle1.LoadingCircleControl.Enabled = false;
+ this.loadingCircle1.LoadingCircleControl.InnerCircleRadius = 4;
+ this.loadingCircle1.LoadingCircleControl.Location = new System.Drawing.Point(697, 3);
+ this.loadingCircle1.LoadingCircleControl.Name = "loadingCircle1";
+ this.loadingCircle1.LoadingCircleControl.NumberSpoke = 10;
+ this.loadingCircle1.LoadingCircleControl.OuterCircleRadius = 7;
+ this.loadingCircle1.LoadingCircleControl.RotationSpeed = 100;
+ this.loadingCircle1.LoadingCircleControl.Size = new System.Drawing.Size(18, 17);
+ this.loadingCircle1.LoadingCircleControl.SpokeThickness = 2;
+ this.loadingCircle1.LoadingCircleControl.TabIndex = 1;
+ this.loadingCircle1.LoadingCircleControl.TabStop = false;
+ this.loadingCircle1.Name = "loadingCircle1";
+ this.loadingCircle1.Overflow = System.Windows.Forms.ToolStripItemOverflow.Never;
+ this.loadingCircle1.Size = new System.Drawing.Size(18, 17);
+ //
// statusStrip
//
this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -136,33 +163,6 @@
this.dockPanel.Size = new System.Drawing.Size(715, 446);
this.dockPanel.TabIndex = 0;
//
- // loadingCircle1
- //
- this.loadingCircle1.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
- this.loadingCircle1.BackColor = System.Drawing.Color.Transparent;
- this.loadingCircle1.Enabled = false;
- //
- // loadingCircle1
- //
- this.loadingCircle1.LoadingCircleControl.AccessibleName = "loadingCircle1";
- this.loadingCircle1.LoadingCircleControl.Active = false;
- this.loadingCircle1.LoadingCircleControl.BackColor = System.Drawing.Color.Transparent;
- this.loadingCircle1.LoadingCircleControl.Color = System.Drawing.Color.Black;
- this.loadingCircle1.LoadingCircleControl.Enabled = false;
- this.loadingCircle1.LoadingCircleControl.InnerCircleRadius = 4;
- this.loadingCircle1.LoadingCircleControl.Location = new System.Drawing.Point(697, 3);
- this.loadingCircle1.LoadingCircleControl.Name = "loadingCircle1";
- this.loadingCircle1.LoadingCircleControl.NumberSpoke = 10;
- this.loadingCircle1.LoadingCircleControl.OuterCircleRadius = 7;
- this.loadingCircle1.LoadingCircleControl.RotationSpeed = 100;
- this.loadingCircle1.LoadingCircleControl.Size = new System.Drawing.Size(18, 17);
- this.loadingCircle1.LoadingCircleControl.SpokeThickness = 2;
- this.loadingCircle1.LoadingCircleControl.TabIndex = 1;
- this.loadingCircle1.LoadingCircleControl.TabStop = false;
- this.loadingCircle1.Name = "loadingCircle1";
- this.loadingCircle1.Overflow = System.Windows.Forms.ToolStripItemOverflow.Never;
- this.loadingCircle1.Size = new System.Drawing.Size(18, 17);
- //
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
Modified: NMail/trunk/NMail.Administration.WinForms/MainForm.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/MainForm.cs 2007-05-21 10:55:56 UTC (rev 199)
+++ NMail/trunk/NMail.Administration.WinForms/MainForm.cs 2007-05-27 02:56:24 UTC (rev 200)
@@ -57,6 +57,9 @@
this.connectMenuItem.Image = IconHelper.GetImage("connect_no", "actions", IconSize.s16x16);
}
+ /// <summary>
+ /// Sets up remoting to use the correct channel, setttings and formatter.
+ /// </summary>
protected virtual void InitialiseRemoting() {
// Set up the required formatter
BinaryClientFormatterSinkProvider provider = new BinaryClientFormatterSinkProvider();
@@ -159,6 +162,11 @@
// Update status label
this.connectionStatusLbl.Image = IconHelper.GetImage("connect_established", "actions", IconSize.s16x16);
this.connectionStatusLbl.Text = "Connected";
+
+ // Update status browser
+ string path = Directory.GetCurrentDirectory() + "\\Resources\\Connected.html";
+ statusBrowswer.Navigate(path);
+ statusBrowserDock.Text = "Connected";
}
this.loadingCircle1.LoadingCircleControl.Active = false;
@@ -230,10 +238,36 @@
}
void notConnectedBrowser_Navigating(object sender, WebBrowserNavigatingEventArgs e) {
- if (e.Url.ToString() == "connect:") {
+ string urlString = e.Url.ToString().ToLower();
+
+ if (urlString == "connect:") {
this.connectMenuItem_Click(this, new EventArgs());
+ e.Cancel = true;
+ } else if (urlString == "disconnect:") {
+ this.disconnectMenuItem_Click(this, new EventArgs());
e.Cancel = true;
+
+ } else if (urlString == "services:") {
+ this.ShowServicesControl();
+ e.Cancel = true;
+
+ } else if (urlString == "spool:") {
+ this.ShowSpoolControl();
+ e.Cancel = true;
+
+ } else if (urlString == "maildomains:") {
+ this.ShowMailDomainControl();
+ e.Cancel = true;
+
+ } else if (urlString == "users:") {
+ this.ShowUsersControl();
+ e.Cancel = true;
+
+ } else if (urlString == "folders:") {
+ this.ShowFoldersControl();
+ e.Cancel = true;
+
}
}
@@ -274,20 +308,28 @@
servicesDock = new DockContent();
servicesDock.Controls.Add(services);
- servicesDock.CloseButton = false;
servicesDock.Text = "Services";
servicesDock.DockPanel = this.dockPanel;
- servicesDock.DockState = DockState.Document;
+ servicesDock.DockState = DockState.Hidden;
servicesDock.Icon = IconHelper.GetIcon("exec", "actions", IconSize.s16x16);
- servicesDock.Visible = false;
+ servicesDock.FormClosing += new FormClosingEventHandler(servicesDock_FormClosing);
}
+ void servicesDock_FormClosing(object sender, FormClosingEventArgs e) {
+ if (e.CloseReason == CloseReason.UserClosing) {
+ e.Cancel = true;
+
+ this.servicesDock.DockState = DockState.Hidden;
+ }
+ }
+
public void ShowServicesControl() {
if (!Connected) {
ShowStatusBrowser();
} else {
-
+ this.servicesDock.DockState = DockState.Document;
+ this.servicesDock.DockHandler.DockTo(this.dockPanel.DockWindows[DockState.Document].NestedPanes[0], DockStyle.Fill, 0);
}
}
#endregion
Modified: NMail/trunk/NMail.Administration.WinForms/NMail.Administration.WinForms.csproj
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/NMail.Administration.WinForms.csproj 2007-05-21 10:55:56 UTC (rev 199)
+++ NMail/trunk/NMail.Administration.WinForms/NMail.Administration.WinForms.csproj 2007-05-27 02:56:24 UTC (rev 200)
@@ -124,6 +124,37 @@
<Content Include="Resources\ConnectFailed.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
+ <Content Include="Resources\Connected.html">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="Resources\LGPL\connect_no.png">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="Resources\LGPL\disconnect.png">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="Resources\LGPL\edit_group.png">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="Resources\LGPL\exec.png">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="Resources\LGPL\folder.png">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="Resources\LGPL\kcmdf.png">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="Resources\LGPL\LGPL.txt" />
+ <Content Include="Resources\LGPL\queue.png">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="Resources\LGPL\server.png">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <None Include="Resources\style.css">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
<Content Include="Resources\Welcome.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Modified: NMail/trunk/NMail.Administration.WinForms/Resources/ConnectFailed.html
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/Resources/ConnectFailed.html 2007-05-21 10:55:56 UTC (rev 199)
+++ NMail/trunk/NMail.Administration.WinForms/Resources/ConnectFailed.html 2007-05-27 02:56:24 UTC (rev 200)
@@ -2,13 +2,20 @@
<HTML>
<head>
<title></title>
- <style>body{FONT-FAMILY: Arial, Sans-Serif}
- h1{FONT-WEIGHT: normal}
+ <link type='text/css' rel='Stylesheet' href='style.css' />
</style>
</head>
<body>
- <h1>Connection Failed</h1>
+ <h1>
+ <img src="LGPL/disconnect.png" />
+ Connection Failed
+ </h1>
<p>The administration tool failed to connect to the server.
- <p><a href="connect:">Click here to reconnect.</a></p>
+ <p>
+ <a href="connect:">
+ <img src="LGPL/connect_no.png" />
+ Click here to reconnect.
+ </a>
+ </p>
</body>
</HTML>
Added: NMail/trunk/NMail.Administration.WinForms/Resources/Connected.html
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/Resources/Connected.html (rev 0)
+++ NMail/trunk/NMail.Administration.WinForms/Resources/Connected.html 2007-05-27 02:56:24 UTC (rev 200)
@@ -0,0 +1,52 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+ <head>
+ <title></title>
+ <link type='text/css' rel='Stylesheet' href='style.css' />
+ </head>
+ <body>
+ <h1>Connected</h1>
+ <p>
+ The administration tool is currently connected to a NMail server. You can now perform
+ the following:
+ </p>
+
+ <div style="padding-left: 2em">
+ <p>
+ <a href="services:">
+ <img src="LGPL/exec.png"/> Manage services.
+ </a>
+ </p>
+
+ <p>
+ <a href="spool:">
+ <img src="LGPL/queue.png"/> Manage the outgoing message spool.
+ </a>
+ </p>
+
+ <p>
+ <a href="maildomains:">
+ <img src="LGPL/server.png"/> Manage mail domains.
+ </a>
+ </p>
+
+ <p>
+ <a href="users:">
+ <img src="LGPL/edit_group.png"/> Manage users and groups.
+ </a>
+ </p>
+
+ <p>
+ <a href="folders:">
+ <img src="LGPL/folder.png"/> Manage folders.
+ </a>
+ </p>
+
+ <p>
+ <a href="disconnect:">
+ <img src="LGPL/disconnect.png"/> Disconnect.
+ </a>
+ </p>
+ </div>
+ </body>
+</HTML>
Added: NMail/trunk/NMail.Administration.WinForms/Resources/LGPL/LGPL.txt
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/Resources/LGPL/LGPL.txt (rev 0)
+++ NMail/trunk/NMail.Administration.WinForms/Resources/LGPL/LGPL.txt 2007-05-27 02:56:24 UTC (rev 200)
@@ -0,0 +1,504 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
Added: NMail/trunk/NMail.Administration.WinForms/Resources/LGPL/connect_no.png
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/NMail.Administration.WinForms/Resources/LGPL/connect_no.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: NMail/trunk/NMail.Administration.WinForms/Resources/LGPL/disconnect.png
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/NMail.Administration.WinForms/Resources/LGPL/disconnect.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: NMail/trunk/NMail.Administration.WinForms/Resources/LGPL/edit_group.png
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/NMail.Administration.WinForms/Resources/LGPL/edit_group.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: NMail/trunk/NMail.Administration.WinForms/Resources/LGPL/exec.png
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/NMail.Administration.WinForms/Resources/LGPL/exec.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: NMail/trunk/NMail.Administration.WinForms/Resources/LGPL/folder.png
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/NMail.Administration.WinForms/Resources/LGPL/folder.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: NMail/trunk/NMail.Administration.WinForms/Resources/LGPL/kcmdf.png
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/NMail.Administration.WinForms/Resources/LGPL/kcmdf.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: NMail/trunk/NMail.Administration.WinForms/Resources/LGPL/queue.png
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/NMail.Administration.WinForms/Resources/LGPL/queue.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: NMail/trunk/NMail.Administration.WinForms/Resources/LGPL/server.png
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/NMail.Administration.WinForms/Resources/LGPL/server.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: NMail/trunk/NMail.Administration.WinForms/Resources/NotConnected.html
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/Resources/NotConnected.html 2007-05-21 10:55:56 UTC (rev 199)
+++ NMail/trunk/NMail.Administration.WinForms/Resources/NotConnected.html 2007-05-27 02:56:24 UTC (rev 200)
@@ -2,13 +2,20 @@
<HTML>
<head>
<title></title>
- <style>body{FONT-FAMILY: Arial, Sans-Serif}
- h1{FONT-WEIGHT: normal}
- </style>
+ <link type='text/css' rel='Stylesheet' href='style.css' />
</head>
<body>
- <h1>Not Connected</h1>
+ <h1>
+ <img src="LGPL/disconnect.png" />
+ Not Connected
+ </h1>
+
<p>The administration tool is currently not connected to any NMail server.</p>
- <p><a href="connect:">Click here to connect.</a></p>
+ <p>
+ <a href="connect:">
+ <img src="LGPL/connect_no.png" />
+ Click here to connect.
+ </a>
+ </p>
</body>
</HTML>
Modified: NMail/trunk/NMail.Administration.WinForms/Resources/Welcome.html
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/Resources/Welcome.html 2007-05-21 10:55:56 UTC (rev 199)
+++ NMail/trunk/NMail.Administration.WinForms/Resources/Welcome.html 2007-05-27 02:56:24 UTC (rev 200)
@@ -2,12 +2,14 @@
<HTML>
<head>
<title></title>
- <style>body{FONT-FAMILY: Arial, Sans-Serif}
- h1{FONT-WEIGHT: normal}
+ <link type='text/css' rel='Stylesheet' href='style.css' />
</style>
</head>
<body>
- <h1>Welcome</h1>
+ <h1>
+ <img src="LGPL/kcmdf.png"/> Welcome
+ </h1>
+
<p>The administration tool is currently not connected to any NMail server.</p>
<p><a href="connect:">Click here to connect.</a></p>
</body>
Added: NMail/trunk/NMail.Administration.WinForms/Resources/style.css
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/Resources/style.css (rev 0)
+++ NMail/trunk/NMail.Administration.WinForms/Resources/style.css 2007-05-27 02:56:24 UTC (rev 200)
@@ -0,0 +1,23 @@
+body
+{
+ font-family: Arial, Sans-Serif
+}
+
+img
+{
+ border-top-style: none;
+ border-right-style: none;
+ border-left-style: none;
+ border-bottom-style: none;
+}
+
+a
+{
+ color: black;
+ text-decoration: none;
+}
+
+a:hover
+{
+ text-decoration: underline;
+}
\ No newline at end of file
Added: NMail/trunk/NMail.Icons/Resources/32x32/actions/edit_group.png
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/NMail.Icons/Resources/32x32/actions/edit_group.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: NMail/trunk/NMail.Icons/Resources/32x32/actions/exec.png
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/NMail.Icons/Resources/32x32/actions/exec.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: NMail/trunk/NMail.Icons/Resources/32x32/actions/queue.png
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/NMail.Icons/Resources/32x32/actions/queue.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: NMail/trunk/NMail.Icons/Resources/32x32/actions/server.png
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/NMail.Icons/Resources/32x32/actions/server.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: NMail/trunk/NMail.Icons/Resources/32x32/filesystems/folder.png
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/NMail.Icons/Resources/32x32/filesystems/folder.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2007-05-21 10:55:56
|
Revision: 199
http://svn.sourceforge.net/nmailserver/?rev=199&view=rev
Author: tmyroadctfig
Date: 2007-05-21 03:55:56 -0700 (Mon, 21 May 2007)
Log Message:
-----------
Further work on administration tool.
Modified Paths:
--------------
NMail/trunk/NMail.Administration.WinForms/MainForm.Designer.cs
NMail/trunk/NMail.Administration.WinForms/MainForm.cs
NMail/trunk/NMail.Administration.WinForms/ManagementTree/ManagementTree.Designer.cs
NMail/trunk/NMail.Administration.WinForms/ManagementTree/ManagementTree.cs
NMail/trunk/NMail.Administration.WinForms/NMail.Administration.WinForms.csproj
NMail/trunk/NMail.Administration.WinForms/Services/ServicesViewer.cs
NMail/trunk/NMail.Icons/NMail.Icons.csproj
Added Paths:
-----------
NMail/trunk/NMail.Administration.WinForms/Resources/
NMail/trunk/NMail.Administration.WinForms/Resources/ConnectFailed.html
NMail/trunk/NMail.Administration.WinForms/Resources/NotConnected.html
NMail/trunk/NMail.Administration.WinForms/Resources/Welcome.html
NMail/trunk/NMail.Icons/Resources/22x22/actions/edit_group.png
NMail/trunk/NMail.Icons/Resources/22x22/actions/exec.png
NMail/trunk/NMail.Icons/Resources/22x22/actions/folder.png
NMail/trunk/NMail.Icons/Resources/22x22/actions/queue.png
NMail/trunk/NMail.Icons/Resources/22x22/actions/server.png
NMail/trunk/References/MRG.Controls.UI.dll
Modified: NMail/trunk/NMail.Administration.WinForms/MainForm.Designer.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/MainForm.Designer.cs 2007-05-20 23:58:57 UTC (rev 198)
+++ NMail/trunk/NMail.Administration.WinForms/MainForm.Designer.cs 2007-05-21 10:55:56 UTC (rev 199)
@@ -26,14 +26,15 @@
this.menuStrip = new System.Windows.Forms.MenuStrip();
this.fileMenu = new System.Windows.Forms.ToolStripMenuItem();
this.connectMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.disconnectMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.exitMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.statusStrip = new System.Windows.Forms.StatusStrip();
this.serverNameLbl = new System.Windows.Forms.ToolStripStatusLabel();
this.connectionStatusLbl = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripContainer = new System.Windows.Forms.ToolStripContainer();
this.dockPanel = new WeifenLuo.WinFormsUI.Docking.DockPanel();
- this.disconnectMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
+ this.loadingCircle1 = new MRG.Controls.UI.LoadingCircleToolStripMenuItem();
this.menuStrip.SuspendLayout();
this.statusStrip.SuspendLayout();
this.toolStripContainer.ContentPanel.SuspendLayout();
@@ -43,7 +44,8 @@
// menuStrip
//
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.fileMenu});
+ this.fileMenu,
+ this.loadingCircle1});
this.menuStrip.Location = new System.Drawing.Point(0, 0);
this.menuStrip.Name = "menuStrip";
this.menuStrip.Size = new System.Drawing.Size(715, 24);
@@ -64,14 +66,26 @@
// connectMenuItem
//
this.connectMenuItem.Name = "connectMenuItem";
- this.connectMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.connectMenuItem.Size = new System.Drawing.Size(137, 22);
this.connectMenuItem.Text = "Connect";
this.connectMenuItem.Click += new System.EventHandler(this.connectMenuItem_Click);
//
+ // disconnectMenuItem
+ //
+ this.disconnectMenuItem.Name = "disconnectMenuItem";
+ this.disconnectMenuItem.Size = new System.Drawing.Size(137, 22);
+ this.disconnectMenuItem.Text = "Disconnect";
+ this.disconnectMenuItem.Click += new System.EventHandler(this.disconnectMenuItem_Click);
+ //
+ // toolStripSeparator1
+ //
+ this.toolStripSeparator1.Name = "toolStripSeparator1";
+ this.toolStripSeparator1.Size = new System.Drawing.Size(134, 6);
+ //
// exitMenuItem
//
this.exitMenuItem.Name = "exitMenuItem";
- this.exitMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.exitMenuItem.Size = new System.Drawing.Size(137, 22);
this.exitMenuItem.Text = "Exit";
this.exitMenuItem.Click += new System.EventHandler(this.exitMenuItem_Click);
//
@@ -122,17 +136,32 @@
this.dockPanel.Size = new System.Drawing.Size(715, 446);
this.dockPanel.TabIndex = 0;
//
- // disconnectMenuItem
+ // loadingCircle1
//
- this.disconnectMenuItem.Name = "disconnectMenuItem";
- this.disconnectMenuItem.Size = new System.Drawing.Size(152, 22);
- this.disconnectMenuItem.Text = "Disconnect";
- this.disconnectMenuItem.Click += new System.EventHandler(this.disconnectMenuItem_Click);
+ this.loadingCircle1.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
+ this.loadingCircle1.BackColor = System.Drawing.Color.Transparent;
+ this.loadingCircle1.Enabled = false;
//
- // toolStripSeparator1
+ // loadingCircle1
//
- this.toolStripSeparator1.Name = "toolStripSeparator1";
- this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6);
+ this.loadingCircle1.LoadingCircleControl.AccessibleName = "loadingCircle1";
+ this.loadingCircle1.LoadingCircleControl.Active = false;
+ this.loadingCircle1.LoadingCircleControl.BackColor = System.Drawing.Color.Transparent;
+ this.loadingCircle1.LoadingCircleControl.Color = System.Drawing.Color.Black;
+ this.loadingCircle1.LoadingCircleControl.Enabled = false;
+ this.loadingCircle1.LoadingCircleControl.InnerCircleRadius = 4;
+ this.loadingCircle1.LoadingCircleControl.Location = new System.Drawing.Point(697, 3);
+ this.loadingCircle1.LoadingCircleControl.Name = "loadingCircle1";
+ this.loadingCircle1.LoadingCircleControl.NumberSpoke = 10;
+ this.loadingCircle1.LoadingCircleControl.OuterCircleRadius = 7;
+ this.loadingCircle1.LoadingCircleControl.RotationSpeed = 100;
+ this.loadingCircle1.LoadingCircleControl.Size = new System.Drawing.Size(18, 17);
+ this.loadingCircle1.LoadingCircleControl.SpokeThickness = 2;
+ this.loadingCircle1.LoadingCircleControl.TabIndex = 1;
+ this.loadingCircle1.LoadingCircleControl.TabStop = false;
+ this.loadingCircle1.Name = "loadingCircle1";
+ this.loadingCircle1.Overflow = System.Windows.Forms.ToolStripItemOverflow.Never;
+ this.loadingCircle1.Size = new System.Drawing.Size(18, 17);
//
// MainForm
//
@@ -172,6 +201,7 @@
private System.Windows.Forms.ToolStripMenuItem connectMenuItem;
private System.Windows.Forms.ToolStripMenuItem disconnectMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
+ private MRG.Controls.UI.LoadingCircleToolStripMenuItem loadingCircle1;
}
}
Modified: NMail/trunk/NMail.Administration.WinForms/MainForm.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/MainForm.cs 2007-05-20 23:58:57 UTC (rev 198)
+++ NMail/trunk/NMail.Administration.WinForms/MainForm.cs 2007-05-21 10:55:56 UTC (rev 199)
@@ -21,6 +21,8 @@
using System.ComponentModel;
using System.Data;
using System.Drawing;
+using System.IO;
+using System.Net.Sockets;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
@@ -47,17 +49,10 @@
InitialiseRemoting();
- ManagementTree.ManagementTree managementTree = new ManagementTree.ManagementTree();
- managementTree.Dock = DockStyle.Fill;
+ InitialiseStatusBrowser();
+ InitialiseManagementTree();
+ InitialiseServicesViewer();
- DockContent managementTreeDock = new DockContent();
- managementTreeDock.Controls.Add(managementTree);
- managementTreeDock.CloseButton = false;
- managementTreeDock.Text = "Management Tree";
- managementTreeDock.DockPanel = this.dockPanel;
- managementTreeDock.DockState = DockState.DockLeft;
- managementTreeDock.Icon = IconHelper.GetIcon("tree", "apps", IconSize.s16x16);
-
this.connectionStatusLbl.Image = IconHelper.GetImage("connect_no", "actions", IconSize.s16x16);
this.connectMenuItem.Image = IconHelper.GetImage("connect_no", "actions", IconSize.s16x16);
}
@@ -83,11 +78,20 @@
}
#region Connect
+ /// <summary>
+ /// Returns true if remote server is connected.
+ /// </summary>
+ public bool Connected {
+ get {
+ return this.remoteAdministration != null;
+ }
+ }
protected void BeginConnect(string host) {
this.serverNameLbl.Text = host;
this.connectionStatusLbl.Image = IconHelper.GetImage("connect_creating", "actions", IconSize.s16x16);
this.connectionStatusLbl.Text = "Connecting...";
+ this.loadingCircle1.LoadingCircleControl.Active = true;
ThreadPool.QueueUserWorkItem(new WaitCallback(Connect), host);
}
@@ -95,12 +99,22 @@
protected void Connect(object o) {
string host = o as string;
- string url = string.Format("tcp://{0}:7877/RemoteAdministration.rem", host);
- this.remoteAdministration = (RemoteAdministration) RemotingServices.Connect(typeof(RemoteAdministration), url);
+ try {
+ string url = string.Format("tcp://{0}:7877/RemoteAdministration.rem", host);
+ this.remoteAdministration = (RemoteAdministration) RemotingServices.Connect(typeof(RemoteAdministration), url);
- // Force the connection to come up
- log.Debug("Remote server assembly version: " + this.remoteAdministration.Version);
+ // Force the connection to come up
+ log.Debug("Remote server assembly version: " + this.remoteAdministration.Version);
+ } catch (SocketException) {
+ this.ConnectFailed();
+ return;
+
+ } catch (IOException) {
+ this.ConnectFailed();
+ return;
+ }
+
this.Invoke(new MethodInvoker(UpdateConnectionStatus));
}
@@ -132,24 +146,35 @@
protected void UpdateConnectionStatus() {
if (this.remoteAdministration == null) {
+ // Update status label
this.connectionStatusLbl.Image = IconHelper.GetImage("connect_no", "actions", IconSize.s16x16);
this.connectionStatusLbl.Text = "Disconnected";
+
+ // Update status browser
+ string path = Directory.GetCurrentDirectory() + "\\Resources\\NotConnected.html";
+ statusBrowswer.Navigate(path);
+ statusBrowserDock.Text = "Not connected";
} else {
+ // Update status label
this.connectionStatusLbl.Image = IconHelper.GetImage("connect_established", "actions", IconSize.s16x16);
this.connectionStatusLbl.Text = "Connected";
}
+
+ this.loadingCircle1.LoadingCircleControl.Active = false;
}
#region Disconnect
public void Disconnect() {
- this.remoteAdministration = null;
+ // Reinvoke if required
+ if (InvokeRequired) {
+ Invoke(new MethodInvoker(Disconnect));
- if (InvokeRequired) {
- Invoke(new MethodInvoker(UpdateConnectionStatus));
} else {
+ this.remoteAdministration = null;
UpdateConnectionStatus();
+ ShowStatusBrowser();
}
}
@@ -158,6 +183,127 @@
}
#endregion
+ public void ConnectFailed() {
+ // Reinvoke if required
+ if (InvokeRequired) {
+ Invoke(new MethodInvoker(ConnectFailed));
+
+ } else {
+ this.remoteAdministration = null;
+ UpdateConnectionStatus();
+
+ // Update status browser
+ string path = Directory.GetCurrentDirectory() + "\\Resources\\ConnectFailed.html";
+ statusBrowswer.Navigate(path);
+ statusBrowserDock.Text = "Connection failed";
+
+ ShowStatusBrowser();
+ }
+ }
+
+ #region Status Browser
+ /// <summary>
+ /// The services viewer.
+ /// </summary>
+ WebBrowser statusBrowswer;
+
+ DockContent statusBrowserDock;
+
+ protected void InitialiseStatusBrowser() {
+ statusBrowswer = new WebBrowser();
+ statusBrowswer.AllowWebBrowserDrop = false;
+ statusBrowswer.IsWebBrowserContextMenuEnabled = false;
+ statusBrowswer.WebBrowserShortcutsEnabled = false;
+ statusBrowswer.Dock = DockStyle.Fill;
+ statusBrowswer.Navigating += new WebBrowserNavigatingEventHandler(notConnectedBrowser_Navigating);
+
+ string path = Directory.GetCurrentDirectory() + "\\Resources\\Welcome.html";
+ statusBrowswer.Navigate(path);
+
+ statusBrowserDock = new DockContent();
+ statusBrowserDock.Controls.Add(statusBrowswer);
+ statusBrowserDock.CloseButton = false;
+ statusBrowserDock.Text = "Welcome";
+ statusBrowserDock.DockPanel = this.dockPanel;
+ statusBrowserDock.DockState = DockState.Document;
+ statusBrowserDock.Icon = IconHelper.GetIcon("connect_no", "actions", IconSize.s16x16);
+ }
+
+ void notConnectedBrowser_Navigating(object sender, WebBrowserNavigatingEventArgs e) {
+ if (e.Url.ToString() == "connect:") {
+ this.connectMenuItem_Click(this, new EventArgs());
+
+ e.Cancel = true;
+ }
+ }
+
+ protected void ShowStatusBrowser() {
+ }
+ #endregion
+
+ #region Management Tree
+
+ protected void InitialiseManagementTree() {
+ ManagementTree.ManagementTree managementTree = new ManagementTree.ManagementTree(this);
+ managementTree.Dock = DockStyle.Fill;
+
+ DockContent managementTreeDock = new DockContent();
+ managementTreeDock.Controls.Add(managementTree);
+ managementTreeDock.CloseButton = false;
+ managementTreeDock.Text = "Management Tree";
+ managementTreeDock.DockPanel = this.dockPanel;
+ managementTreeDock.DockState = DockState.DockLeft;
+ managementTreeDock.Icon = IconHelper.GetIcon("tree", "apps", IconSize.s16x16);
+ }
+ #endregion
+
+ public void ShowNMailDetails() {
+ }
+
+ #region Services Viewer
+ /// <summary>
+ /// The services viewer.
+ /// </summary>
+ Services.ServicesViewer services;
+
+ DockContent servicesDock;
+
+ protected void InitialiseServicesViewer() {
+ this.services = new Services.ServicesViewer(this);
+ this.services.Dock = DockStyle.Fill;
+
+ servicesDock = new DockContent();
+ servicesDock.Controls.Add(services);
+ servicesDock.CloseButton = false;
+ servicesDock.Text = "Services";
+ servicesDock.DockPanel = this.dockPanel;
+ servicesDock.DockState = DockState.Document;
+ servicesDock.Icon = IconHelper.GetIcon("exec", "actions", IconSize.s16x16);
+ servicesDock.Visible = false;
+ }
+
+ public void ShowServicesControl() {
+ if (!Connected) {
+ ShowStatusBrowser();
+
+ } else {
+
+ }
+ }
+ #endregion
+
+ public void ShowSpoolControl() {
+ }
+
+ public void ShowMailDomainControl() {
+ }
+
+ public void ShowUsersControl() {
+ }
+
+ public void ShowFoldersControl() {
+ }
+
private void exitMenuItem_Click(object sender, EventArgs e) {
this.Close();
}
Modified: NMail/trunk/NMail.Administration.WinForms/ManagementTree/ManagementTree.Designer.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/ManagementTree/ManagementTree.Designer.cs 2007-05-20 23:58:57 UTC (rev 198)
+++ NMail/trunk/NMail.Administration.WinForms/ManagementTree/ManagementTree.Designer.cs 2007-05-21 10:55:56 UTC (rev 199)
@@ -39,11 +39,12 @@
this.treeView.SelectedImageIndex = 0;
this.treeView.Size = new System.Drawing.Size(150, 150);
this.treeView.TabIndex = 0;
+ this.treeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView_AfterSelect);
//
// imageList
//
this.imageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
- this.imageList.ImageSize = new System.Drawing.Size(16, 16);
+ this.imageList.ImageSize = new System.Drawing.Size(22, 22);
this.imageList.TransparentColor = System.Drawing.Color.Transparent;
//
// ManagementTree
Modified: NMail/trunk/NMail.Administration.WinForms/ManagementTree/ManagementTree.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/ManagementTree/ManagementTree.cs 2007-05-20 23:58:57 UTC (rev 198)
+++ NMail/trunk/NMail.Administration.WinForms/ManagementTree/ManagementTree.cs 2007-05-21 10:55:56 UTC (rev 199)
@@ -30,36 +30,74 @@
/// Provides a tree view of possible management options.
/// </summary>
public partial class ManagementTree : UserControl {
- public ManagementTree() {
+ public ManagementTree(MainForm mainForm) {
InitializeComponent();
+ this.mainForm = mainForm;
+
// Setup the image list
this.imageList.Images.Add(IconHelper.GetImage("nmail", "apps", IconSize.s16x16));
- this.imageList.Images.Add(IconHelper.GetImage("exec", "actions", IconSize.s16x16));
- this.imageList.Images.Add(IconHelper.GetImage("server", "actions", IconSize.s16x16));
- this.imageList.Images.Add(IconHelper.GetImage("edit_group", "actions", IconSize.s16x16));
- this.imageList.Images.Add(IconHelper.GetImage("folder", "actions", IconSize.s16x16));
- this.imageList.Images.Add(IconHelper.GetImage("queue", "actions", IconSize.s16x16));
+ this.imageList.Images.Add(IconHelper.GetImage("exec", "actions", IconSize.s22x22));
+ this.imageList.Images.Add(IconHelper.GetImage("server", "actions", IconSize.s22x22));
+ this.imageList.Images.Add(IconHelper.GetImage("edit_group", "actions", IconSize.s22x22));
+ this.imageList.Images.Add(IconHelper.GetImage("folder", "actions", IconSize.s22x22));
+ this.imageList.Images.Add(IconHelper.GetImage("queue", "actions", IconSize.s22x22));
- TreeNode nmailNode = new TreeNode("NMail", 0, 0);
- this.treeView.Nodes.Add(nmailNode);
+ this.nmailNode = new TreeNode("NMail", 0, 0);
+ this.treeView.Nodes.Add(this.nmailNode);
- TreeNode servicesNode = new TreeNode("Services", 1, 1);
- nmailNode.Nodes.Add(servicesNode);
+ this.servicesNode = new TreeNode("Services", 1, 1);
+ this.nmailNode.Nodes.Add(this.servicesNode);
- TreeNode spoolNode = new TreeNode("Smtp Spool", 5, 5);
- nmailNode.Nodes.Add(spoolNode);
+ this.spoolNode = new TreeNode("Smtp Spool", 5, 5);
+ this.nmailNode.Nodes.Add(this.spoolNode);
- TreeNode mailDomainNode = new TreeNode("Mail Domains", 2, 2);
- nmailNode.Nodes.Add(mailDomainNode);
+ this.mailDomainNode = new TreeNode("Mail Domains", 2, 2);
+ this.nmailNode.Nodes.Add(this.mailDomainNode);
- TreeNode usersNode = new TreeNode("Users", 3, 3);
- nmailNode.Nodes.Add(usersNode);
+ this.usersNode = new TreeNode("Users", 3, 3);
+ this.nmailNode.Nodes.Add(this.usersNode);
- TreeNode foldersNode = new TreeNode("Folders", 4, 4);
- nmailNode.Nodes.Add(foldersNode);
+ this.foldersNode = new TreeNode("Folders", 4, 4);
+ this.nmailNode.Nodes.Add(this.foldersNode);
this.treeView.ExpandAll();
}
+
+ MainForm mainForm;
+
+ TreeNode nmailNode;
+
+ TreeNode servicesNode;
+
+ TreeNode spoolNode;
+
+ TreeNode mailDomainNode;
+
+ TreeNode usersNode;
+
+ TreeNode foldersNode;
+
+ private void treeView_AfterSelect(object sender, TreeViewEventArgs e) {
+ if (e.Node == nmailNode) {
+ this.mainForm.ShowNMailDetails();
+
+ } else if (e.Node == servicesNode) {
+ this.mainForm.ShowServicesControl();
+
+ } else if (e.Node == servicesNode) {
+ this.mainForm.ShowServicesControl();
+
+ } else if (e.Node == mailDomainNode) {
+ this.mainForm.ShowMailDomainControl();
+
+ } else if (e.Node == usersNode) {
+ this.mainForm.ShowUsersControl();
+
+ } else if (e.Node == foldersNode) {
+ this.mainForm.ShowFoldersControl();
+
+ }
+ }
}
}
Modified: NMail/trunk/NMail.Administration.WinForms/NMail.Administration.WinForms.csproj
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/NMail.Administration.WinForms.csproj 2007-05-20 23:58:57 UTC (rev 198)
+++ NMail/trunk/NMail.Administration.WinForms/NMail.Administration.WinForms.csproj 2007-05-21 10:55:56 UTC (rev 199)
@@ -32,6 +32,10 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\References\log4net.dll</HintPath>
</Reference>
+ <Reference Include="MRG.Controls.UI, Version=1.0.2601.14400, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\References\MRG.Controls.UI.dll</HintPath>
+ </Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
@@ -104,7 +108,6 @@
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
- <None Include="Resources\ErrorConnecting.mht" />
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
@@ -118,8 +121,15 @@
</Compile>
</ItemGroup>
<ItemGroup>
- <Content Include="Resources\Connecting.html" />
- <Content Include="Resources\ErrorConnecting.html" />
+ <Content Include="Resources\ConnectFailed.html">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="Resources\Welcome.html">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="Resources\NotConnected.html">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NMail.Icons\NMail.Icons.csproj">
Added: NMail/trunk/NMail.Administration.WinForms/Resources/ConnectFailed.html
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/Resources/ConnectFailed.html (rev 0)
+++ NMail/trunk/NMail.Administration.WinForms/Resources/ConnectFailed.html 2007-05-21 10:55:56 UTC (rev 199)
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+ <head>
+ <title></title>
+ <style>body{FONT-FAMILY: Arial, Sans-Serif}
+ h1{FONT-WEIGHT: normal}
+ </style>
+ </head>
+ <body>
+ <h1>Connection Failed</h1>
+ <p>The administration tool failed to connect to the server.
+ <p><a href="connect:">Click here to reconnect.</a></p>
+ </body>
+</HTML>
Added: NMail/trunk/NMail.Administration.WinForms/Resources/NotConnected.html
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/Resources/NotConnected.html (rev 0)
+++ NMail/trunk/NMail.Administration.WinForms/Resources/NotConnected.html 2007-05-21 10:55:56 UTC (rev 199)
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+ <head>
+ <title></title>
+ <style>body{FONT-FAMILY: Arial, Sans-Serif}
+ h1{FONT-WEIGHT: normal}
+ </style>
+ </head>
+ <body>
+ <h1>Not Connected</h1>
+ <p>The administration tool is currently not connected to any NMail server.</p>
+ <p><a href="connect:">Click here to connect.</a></p>
+ </body>
+</HTML>
Added: NMail/trunk/NMail.Administration.WinForms/Resources/Welcome.html
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/Resources/Welcome.html (rev 0)
+++ NMail/trunk/NMail.Administration.WinForms/Resources/Welcome.html 2007-05-21 10:55:56 UTC (rev 199)
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+ <head>
+ <title></title>
+ <style>body{FONT-FAMILY: Arial, Sans-Serif}
+ h1{FONT-WEIGHT: normal}
+ </style>
+ </head>
+ <body>
+ <h1>Welcome</h1>
+ <p>The administration tool is currently not connected to any NMail server.</p>
+ <p><a href="connect:">Click here to connect.</a></p>
+ </body>
+</HTML>
Modified: NMail/trunk/NMail.Administration.WinForms/Services/ServicesViewer.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/Services/ServicesViewer.cs 2007-05-20 23:58:57 UTC (rev 198)
+++ NMail/trunk/NMail.Administration.WinForms/Services/ServicesViewer.cs 2007-05-21 10:55:56 UTC (rev 199)
@@ -25,7 +25,7 @@
namespace NMail.Administration.WinForms.Services {
public partial class ServicesViewer : UserControl {
- public ServicesViewer() {
+ public ServicesViewer(MainForm mainForm) {
InitializeComponent();
}
}
Modified: NMail/trunk/NMail.Icons/NMail.Icons.csproj
===================================================================
--- NMail/trunk/NMail.Icons/NMail.Icons.csproj 2007-05-20 23:58:57 UTC (rev 198)
+++ NMail/trunk/NMail.Icons/NMail.Icons.csproj 2007-05-21 10:55:56 UTC (rev 199)
@@ -51,13 +51,17 @@
<EmbeddedResource Include="Resources\16x16\actions\exec.png" />
<EmbeddedResource Include="Resources\16x16\actions\folder.png" />
<EmbeddedResource Include="Resources\16x16\actions\queue.png" />
+ <EmbeddedResource Include="Resources\22x22\actions\exec.png" />
+ <EmbeddedResource Include="Resources\22x22\actions\server.png" />
+ <EmbeddedResource Include="Resources\22x22\actions\edit_group.png" />
+ <EmbeddedResource Include="Resources\22x22\actions\folder.png" />
+ <EmbeddedResource Include="Resources\22x22\actions\queue.png" />
<Content Include="Resources\LGPL.txt" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\16x16\devices\" />
<Folder Include="Resources\16x16\filesystems\" />
<Folder Include="Resources\16x16\mimetypes\" />
- <Folder Include="Resources\22x22\actions\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Added: NMail/trunk/NMail.Icons/Resources/22x22/actions/edit_group.png
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/NMail.Icons/Resources/22x22/actions/edit_group.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: NMail/trunk/NMail.Icons/Resources/22x22/actions/exec.png
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/NMail.Icons/Resources/22x22/actions/exec.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: NMail/trunk/NMail.Icons/Resources/22x22/actions/folder.png
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/NMail.Icons/Resources/22x22/actions/folder.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: NMail/trunk/NMail.Icons/Resources/22x22/actions/queue.png
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/NMail.Icons/Resources/22x22/actions/queue.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: NMail/trunk/NMail.Icons/Resources/22x22/actions/server.png
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/NMail.Icons/Resources/22x22/actions/server.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: NMail/trunk/References/MRG.Controls.UI.dll
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/References/MRG.Controls.UI.dll
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2007-05-20 23:58:56
|
Revision: 198
http://svn.sourceforge.net/nmailserver/?rev=198&view=rev
Author: tmyroadctfig
Date: 2007-05-20 16:58:57 -0700 (Sun, 20 May 2007)
Log Message:
-----------
Added logging to aid with install dir registry problems.
Modified Paths:
--------------
NMail/trunk/NMail.Server/NMailServer.cs
Modified: NMail/trunk/NMail.Server/NMailServer.cs
===================================================================
--- NMail/trunk/NMail.Server/NMailServer.cs 2007-05-12 14:26:56 UTC (rev 197)
+++ NMail/trunk/NMail.Server/NMailServer.cs 2007-05-20 23:58:57 UTC (rev 198)
@@ -329,10 +329,17 @@
if (nmailServerKey != null) {
installDirectory = nmailServerKey.GetValue("InstallDirectory") as string;
+ nmailServerKey.Close();
- nmailServerKey.Close();
+ if (installDirectory == null) {
+ log.Warn("No value for InstallDirectory found in NMail server registry key.");
+ }
+
+ } else {
+ log.Warn("No NMail server registry key found.");
}
+ log.Debug("Installation directory: " + installDirectory);
return installDirectory;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2007-05-12 14:27:16
|
Revision: 197
http://svn.sourceforge.net/nmailserver/?rev=197&view=rev
Author: tmyroadctfig
Date: 2007-05-12 07:26:56 -0700 (Sat, 12 May 2007)
Log Message:
-----------
Added some missing files. Added things to ignore lists. Corrected license details.
Modified Paths:
--------------
NMail/trunk/Installer/NMail-Installer.wxs
NMail/trunk/NMail.Administration.WinForms/ConnectForm.cs
NMail/trunk/NMail.Administration.WinForms/MainForm.cs
NMail/trunk/NMail.Administration.WinForms/ManagementTree/ManagementTree.cs
NMail/trunk/NMail.Administration.WinForms/Program.cs
NMail/trunk/NMail.Administration.WinForms/Services/ServicesViewer.cs
NMail/trunk/NMail.Icons/Licence.txt
Added Paths:
-----------
NMail/trunk/NMail.Administration.WinForms/ExceptionDialog.Designer.cs
NMail/trunk/NMail.Administration.WinForms/ExceptionDialog.cs
NMail/trunk/NMail.Administration.WinForms/ExceptionDialog.resx
NMail/trunk/NMail.Administration.WinForms/MailDomain/
NMail/trunk/NMail.Icons/Resources/16x16/filesystems/
NMail/trunk/NMail.Icons/Resources/16x16/mimetypes/
NMail/trunk/NMail.Icons/Resources/22x22/apps/
NMail/trunk/NMail.Icons/Resources/22x22/devices/
NMail/trunk/NMail.Icons/Resources/22x22/filesystems/
NMail/trunk/NMail.Icons/Resources/22x22/kdm/
NMail/trunk/NMail.Icons/Resources/22x22/mimetypes/
NMail/trunk/NMail.Icons/Resources/32x32/devices/
NMail/trunk/NMail.Icons/Resources/32x32/kdm/
NMail/trunk/NMail.Icons/Resources/32x32/mimetypes/
NMail/trunk/References/WeifenLuo.WinFormsUI.Docking.dll
Property Changed:
----------------
NMail/trunk/NMail.Administration.WinForms/
NMail/trunk/NMail.Icons/
Modified: NMail/trunk/Installer/NMail-Installer.wxs
===================================================================
--- NMail/trunk/Installer/NMail-Installer.wxs 2007-05-12 14:18:59 UTC (rev 196)
+++ NMail/trunk/Installer/NMail-Installer.wxs 2007-05-12 14:26:56 UTC (rev 197)
@@ -1,11 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2003/01/wi">
- <Product Id="3EEDBE2D-3E7A-44b1-B4AA-1DDD2EB0068E" UpgradeCode="01CC30D2-B022-4e6c-A63B-7DD7ACCCCCE2" Name="NMail Server 1.0" Language="1033" Version="1.0.0.0" Manufacturer="NMailServer.SourceForge.net">
- <Package Id="????????-????-????-????-????????????" Description="NMail Server 1.0 Installer." InstallerVersion="200" Compressed="yes" />
+ <Product Id="1C70D04F-5D19-4578-AFCB-17A2B345B54D" UpgradeCode="B452E72B-B675-4cdd-B23C-AB9FFE39F731" Name="NMail Server 1.1" Language="1033" Version="1.1.0.0" Manufacturer="NMailServer.SourceForge.net">
+ <Package Id="????????-????-????-????-????????????" Description="NMail Server 1.1 Installer." InstallerVersion="200" Compressed="yes" />
<Media Id="1" Cabinet="Product.cab" EmbedCab="yes" />
- <!-- <Upgrade Id="01CC30D2-B022-4e6c-A63B-7DD7ACCCCCE2">
- <UpgradeVersion />
+
+ <!-- <Upgrade Id="533CCFA3-388F-4aa5-AE26-F1F6D66F11B5">
+ <UpgradeVersion OnlyDetect='yes' Property='PATCHFOUND' IncludeMinimum='yes' Minimum='1.0.0.0' />
</Upgrade> -->
+
<!--
==
== Conditions
@@ -60,7 +62,7 @@
<Component Id="C_WebAdminVirtualDir" Guid="D793585B-2BF2-42c3-8C7C-2185ED579048">
<WebSite Id="Ws_WebAdminDefault" Description="Default Web Site" Directory="D_NMail.Administration.Web">
- <WebAddress Id="WA_NMailWebAdmin" Port="443" />
+ <WebAddress Id="AllUnassigned" Port="443" />
</WebSite>
<WebVirtualDir Id="Wvd_NMailWebAdmin" Alias="NMailWebAdmin" Directory="D_NMail.Administration.Web" WebSite="Ws_WebAdminDefault" />
</Component>
Property changes on: NMail/trunk/NMail.Administration.WinForms
___________________________________________________________________
Name: svn:ignore
+ bin
NMail.Administration.WinForms.csproj.user
obj
Modified: NMail/trunk/NMail.Administration.WinForms/ConnectForm.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/ConnectForm.cs 2007-05-12 14:18:59 UTC (rev 196)
+++ NMail/trunk/NMail.Administration.WinForms/ConnectForm.cs 2007-05-12 14:26:56 UTC (rev 197)
@@ -1,3 +1,20 @@
+/*
+ * Copyright 2004-2007 Luke Quinane
+ *
+ * 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.Generic;
using System.ComponentModel;
Added: NMail/trunk/NMail.Administration.WinForms/ExceptionDialog.Designer.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/ExceptionDialog.Designer.cs (rev 0)
+++ NMail/trunk/NMail.Administration.WinForms/ExceptionDialog.Designer.cs 2007-05-12 14:26:56 UTC (rev 197)
@@ -0,0 +1,104 @@
+namespace NMail.Administration.WinForms {
+ partial class ExceptionDialog {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent() {
+ this.okButton = new System.Windows.Forms.Button();
+ this.exceptionDetailBox = new System.Windows.Forms.TextBox();
+ this.errorIcon = new System.Windows.Forms.PictureBox();
+ this.exitButton = new System.Windows.Forms.Button();
+ ((System.ComponentModel.ISupportInitialize) (this.errorIcon)).BeginInit();
+ this.SuspendLayout();
+ //
+ // okButton
+ //
+ this.okButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ this.okButton.Location = new System.Drawing.Point(221, 125);
+ this.okButton.Name = "okButton";
+ this.okButton.Size = new System.Drawing.Size(75, 23);
+ this.okButton.TabIndex = 0;
+ this.okButton.Text = "Continue";
+ this.okButton.UseVisualStyleBackColor = true;
+ this.okButton.Click += new System.EventHandler(this.okButton_Click);
+ //
+ // exceptionDetailBox
+ //
+ this.exceptionDetailBox.Location = new System.Drawing.Point(50, 12);
+ this.exceptionDetailBox.Multiline = true;
+ this.exceptionDetailBox.Name = "exceptionDetailBox";
+ this.exceptionDetailBox.ReadOnly = true;
+ this.exceptionDetailBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
+ this.exceptionDetailBox.Size = new System.Drawing.Size(327, 107);
+ this.exceptionDetailBox.TabIndex = 1;
+ this.exceptionDetailBox.WordWrap = false;
+ //
+ // errorIcon
+ //
+ this.errorIcon.Location = new System.Drawing.Point(12, 12);
+ this.errorIcon.Name = "errorIcon";
+ this.errorIcon.Size = new System.Drawing.Size(32, 32);
+ this.errorIcon.TabIndex = 2;
+ this.errorIcon.TabStop = false;
+ //
+ // exitButton
+ //
+ this.exitButton.Location = new System.Drawing.Point(302, 125);
+ this.exitButton.Name = "exitButton";
+ this.exitButton.Size = new System.Drawing.Size(75, 23);
+ this.exitButton.TabIndex = 3;
+ this.exitButton.Text = "Exit";
+ this.exitButton.UseVisualStyleBackColor = true;
+ this.exitButton.Click += new System.EventHandler(this.exitButton_Click);
+ //
+ // ExceptionDialog
+ //
+ this.AcceptButton = this.okButton;
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.CancelButton = this.okButton;
+ this.ClientSize = new System.Drawing.Size(391, 159);
+ this.Controls.Add(this.exitButton);
+ this.Controls.Add(this.errorIcon);
+ this.Controls.Add(this.exceptionDetailBox);
+ this.Controls.Add(this.okButton);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "ExceptionDialog";
+ this.ShowInTaskbar = false;
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+ this.Text = "NMail Administration - Error";
+ ((System.ComponentModel.ISupportInitialize) (this.errorIcon)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Button okButton;
+ private System.Windows.Forms.TextBox exceptionDetailBox;
+ private System.Windows.Forms.PictureBox errorIcon;
+ private System.Windows.Forms.Button exitButton;
+ }
+}
\ No newline at end of file
Added: NMail/trunk/NMail.Administration.WinForms/ExceptionDialog.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/ExceptionDialog.cs (rev 0)
+++ NMail/trunk/NMail.Administration.WinForms/ExceptionDialog.cs 2007-05-12 14:26:56 UTC (rev 197)
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2004-2007 Luke Quinane
+ *
+ * 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.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+
+using NMail.Icons;
+
+namespace NMail.Administration.WinForms {
+ /// <summary>
+ /// A form for displaying an exception to the user.
+ /// </summary>
+ public partial class ExceptionDialog : Form {
+ public ExceptionDialog() {
+ InitializeComponent();
+
+ this.errorIcon.Image = IconHelper.GetImage("core", "apps", IconSize.s32x32);
+ }
+
+ /// <summary>
+ /// Displays the given exception in the form.
+ /// </summary>
+ /// <param name="ex">The exception to display.</param>
+ public void SetException(Exception ex) {
+ Exception inner = ex.InnerException;
+ StringBuilder message = new StringBuilder();
+
+ message.Append(string.Format(
+ "Unhandled exception:\r\n" +
+ "{0}\r\n" +
+ "----------------------------------------\r\n" +
+ "{1}",
+ ex.Message,
+ ex.StackTrace));
+
+ while (inner != null) {
+ message.Append(string.Format(
+ "\r\n" +
+ "Inner exception:\r\n" +
+ "{0}\r\n" +
+ "----------------------------------------\r\n" +
+ "{1}",
+ inner.Message,
+ inner.StackTrace));
+
+ inner = inner.InnerException;
+ }
+
+ this.exceptionDetailBox.Text = message.ToString();
+ }
+
+ private void okButton_Click(object sender, EventArgs e) {
+ this.Close();
+ }
+
+ private void exitButton_Click(object sender, EventArgs e) {
+ Application.Exit();
+ }
+ }
+}
\ No newline at end of file
Added: NMail/trunk/NMail.Administration.WinForms/ExceptionDialog.resx
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/ExceptionDialog.resx (rev 0)
+++ NMail/trunk/NMail.Administration.WinForms/ExceptionDialog.resx 2007-05-12 14:26:56 UTC (rev 197)
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
\ No newline at end of file
Modified: NMail/trunk/NMail.Administration.WinForms/MainForm.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/MainForm.cs 2007-05-12 14:18:59 UTC (rev 196)
+++ NMail/trunk/NMail.Administration.WinForms/MainForm.cs 2007-05-12 14:26:56 UTC (rev 197)
@@ -1,3 +1,20 @@
+/*
+ * Copyright 2004-2007 Luke Quinane
+ *
+ * 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 System.Collections.Generic;
Modified: NMail/trunk/NMail.Administration.WinForms/ManagementTree/ManagementTree.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/ManagementTree/ManagementTree.cs 2007-05-12 14:18:59 UTC (rev 196)
+++ NMail/trunk/NMail.Administration.WinForms/ManagementTree/ManagementTree.cs 2007-05-12 14:26:56 UTC (rev 197)
@@ -1,3 +1,20 @@
+/*
+ * Copyright 2004-2007 Luke Quinane
+ *
+ * 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.Generic;
using System.ComponentModel;
Modified: NMail/trunk/NMail.Administration.WinForms/Program.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/Program.cs 2007-05-12 14:18:59 UTC (rev 196)
+++ NMail/trunk/NMail.Administration.WinForms/Program.cs 2007-05-12 14:26:56 UTC (rev 197)
@@ -1,3 +1,20 @@
+/*
+ * Copyright 2004-2007 Luke Quinane
+ *
+ * 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.Generic;
using System.IO;
Modified: NMail/trunk/NMail.Administration.WinForms/Services/ServicesViewer.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/Services/ServicesViewer.cs 2007-05-12 14:18:59 UTC (rev 196)
+++ NMail/trunk/NMail.Administration.WinForms/Services/ServicesViewer.cs 2007-05-12 14:26:56 UTC (rev 197)
@@ -1,3 +1,20 @@
+/*
+ * Copyright 2004-2007 Luke Quinane
+ *
+ * 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.Generic;
using System.ComponentModel;
Property changes on: NMail/trunk/NMail.Icons
___________________________________________________________________
Name: svn:ignore
+ bin
obj
NMail.Icons.csproj.user
Modified: NMail/trunk/NMail.Icons/Licence.txt
===================================================================
--- NMail/trunk/NMail.Icons/Licence.txt 2007-05-12 14:18:59 UTC (rev 196)
+++ NMail/trunk/NMail.Icons/Licence.txt 2007-05-12 14:26:56 UTC (rev 197)
@@ -1 +1,5 @@
-Currently all the icons in this project are covered by the GNU public license (see GPL.txt in this directory). The code in this project is covered by the BSD license.
\ No newline at end of file
+Currently all the icons in the NMail.Icons project are covered by the GNU
+Lesser General Public License (see LGPL.txt in the Resources directory).
+
+All of the code in this project is covered by the Apache License, version 2.0.
+See http://www.apache.org/licenses/LICENSE-2.0 for a copy of that license.
\ No newline at end of file
Added: NMail/trunk/References/WeifenLuo.WinFormsUI.Docking.dll
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/References/WeifenLuo.WinFormsUI.Docking.dll
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2007-05-12 14:19:02
|
Revision: 196
http://svn.sourceforge.net/nmailserver/?rev=196&view=rev
Author: tmyroadctfig
Date: 2007-05-12 07:18:59 -0700 (Sat, 12 May 2007)
Log Message:
-----------
Added a winforms management interface.
Modified Paths:
--------------
NMail/trunk/NMail.Server/RemoteAdministration.cs
NMail/trunk/NMail.sln
Added Paths:
-----------
NMail/trunk/NMail.Administration.WinForms/
NMail/trunk/NMail.Administration.WinForms/ConnectForm.Designer.cs
NMail/trunk/NMail.Administration.WinForms/ConnectForm.cs
NMail/trunk/NMail.Administration.WinForms/ConnectForm.resx
NMail/trunk/NMail.Administration.WinForms/MainForm.Designer.cs
NMail/trunk/NMail.Administration.WinForms/MainForm.cs
NMail/trunk/NMail.Administration.WinForms/MainForm.resx
NMail/trunk/NMail.Administration.WinForms/ManagementTree/
NMail/trunk/NMail.Administration.WinForms/ManagementTree/ManagementTree.Designer.cs
NMail/trunk/NMail.Administration.WinForms/ManagementTree/ManagementTree.cs
NMail/trunk/NMail.Administration.WinForms/ManagementTree/ManagementTree.resx
NMail/trunk/NMail.Administration.WinForms/NMail.Administration.WinForms.csproj
NMail/trunk/NMail.Administration.WinForms/Program.cs
NMail/trunk/NMail.Administration.WinForms/Properties/
NMail/trunk/NMail.Administration.WinForms/Properties/AssemblyInfo.cs
NMail/trunk/NMail.Administration.WinForms/Properties/Resources.Designer.cs
NMail/trunk/NMail.Administration.WinForms/Properties/Resources.resx
NMail/trunk/NMail.Administration.WinForms/Properties/Settings.Designer.cs
NMail/trunk/NMail.Administration.WinForms/Properties/Settings.settings
NMail/trunk/NMail.Administration.WinForms/Services/
NMail/trunk/NMail.Administration.WinForms/Services/ServicesViewer.Designer.cs
NMail/trunk/NMail.Administration.WinForms/Services/ServicesViewer.cs
NMail/trunk/NMail.Administration.WinForms/Services/ServicesViewer.resx
NMail/trunk/NMail.Icons/
NMail/trunk/NMail.Icons/IconHelper.cs
NMail/trunk/NMail.Icons/Licence.txt
NMail/trunk/NMail.Icons/NMail.Icons.csproj
NMail/trunk/NMail.Icons/Properties/
NMail/trunk/NMail.Icons/Properties/AssemblyInfo.cs
NMail/trunk/NMail.Icons/Resources/
NMail/trunk/NMail.Icons/Resources/16x16/
NMail/trunk/NMail.Icons/Resources/16x16/actions/
NMail/trunk/NMail.Icons/Resources/16x16/actions/connect_creating.png
NMail/trunk/NMail.Icons/Resources/16x16/actions/connect_established.png
NMail/trunk/NMail.Icons/Resources/16x16/actions/connect_no.png
NMail/trunk/NMail.Icons/Resources/16x16/actions/folder.png
NMail/trunk/NMail.Icons/Resources/16x16/actions/server.png
NMail/trunk/NMail.Icons/Resources/16x16/apps/
NMail/trunk/NMail.Icons/Resources/16x16/apps/nmail.png
NMail/trunk/NMail.Icons/Resources/16x16/apps/tree.png
NMail/trunk/NMail.Icons/Resources/22x22/
NMail/trunk/NMail.Icons/Resources/22x22/actions/
NMail/trunk/NMail.Icons/Resources/32x32/
NMail/trunk/NMail.Icons/Resources/32x32/actions/
NMail/trunk/NMail.Icons/Resources/32x32/actions/connect_no.png
NMail/trunk/NMail.Icons/Resources/32x32/apps/
NMail/trunk/NMail.Icons/Resources/32x32/apps/core.png
NMail/trunk/NMail.Icons/Resources/LGPL.txt
Added: NMail/trunk/NMail.Administration.WinForms/ConnectForm.Designer.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/ConnectForm.Designer.cs (rev 0)
+++ NMail/trunk/NMail.Administration.WinForms/ConnectForm.Designer.cs 2007-05-12 14:18:59 UTC (rev 196)
@@ -0,0 +1,101 @@
+namespace NMail.Administration.WinForms {
+ partial class ConnectForm {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent() {
+ this.connectBtn = new System.Windows.Forms.Button();
+ this.cancelBtn = new System.Windows.Forms.Button();
+ this.mainIcon = new System.Windows.Forms.PictureBox();
+ this.hostnameTextBox = new System.Windows.Forms.TextBox();
+ ((System.ComponentModel.ISupportInitialize) (this.mainIcon)).BeginInit();
+ this.SuspendLayout();
+ //
+ // connectBtn
+ //
+ this.connectBtn.Location = new System.Drawing.Point(90, 49);
+ this.connectBtn.Name = "connectBtn";
+ this.connectBtn.Size = new System.Drawing.Size(75, 23);
+ this.connectBtn.TabIndex = 0;
+ this.connectBtn.Text = "Connect";
+ this.connectBtn.UseVisualStyleBackColor = true;
+ this.connectBtn.Click += new System.EventHandler(this.connectBtn_Click);
+ //
+ // cancelBtn
+ //
+ this.cancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ this.cancelBtn.Location = new System.Drawing.Point(171, 49);
+ this.cancelBtn.Name = "cancelBtn";
+ this.cancelBtn.Size = new System.Drawing.Size(75, 23);
+ this.cancelBtn.TabIndex = 1;
+ this.cancelBtn.Text = "Cancel";
+ this.cancelBtn.UseVisualStyleBackColor = true;
+ this.cancelBtn.Click += new System.EventHandler(this.cancelBtn_Click);
+ //
+ // mainIcon
+ //
+ this.mainIcon.Location = new System.Drawing.Point(12, 12);
+ this.mainIcon.Name = "mainIcon";
+ this.mainIcon.Size = new System.Drawing.Size(32, 32);
+ this.mainIcon.TabIndex = 2;
+ this.mainIcon.TabStop = false;
+ //
+ // hostnameTextBox
+ //
+ this.hostnameTextBox.Location = new System.Drawing.Point(51, 23);
+ this.hostnameTextBox.Name = "hostnameTextBox";
+ this.hostnameTextBox.Size = new System.Drawing.Size(195, 20);
+ this.hostnameTextBox.TabIndex = 3;
+ this.hostnameTextBox.Text = "localhost";
+ //
+ // ConnectForm
+ //
+ this.AcceptButton = this.connectBtn;
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.CancelButton = this.cancelBtn;
+ this.ClientSize = new System.Drawing.Size(256, 82);
+ this.ControlBox = false;
+ this.Controls.Add(this.hostnameTextBox);
+ this.Controls.Add(this.mainIcon);
+ this.Controls.Add(this.cancelBtn);
+ this.Controls.Add(this.connectBtn);
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "ConnectForm";
+ this.ShowInTaskbar = false;
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+ this.Text = "Connect to a server";
+ ((System.ComponentModel.ISupportInitialize) (this.mainIcon)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Button connectBtn;
+ private System.Windows.Forms.Button cancelBtn;
+ private System.Windows.Forms.PictureBox mainIcon;
+ private System.Windows.Forms.TextBox hostnameTextBox;
+ }
+}
\ No newline at end of file
Added: NMail/trunk/NMail.Administration.WinForms/ConnectForm.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/ConnectForm.cs (rev 0)
+++ NMail/trunk/NMail.Administration.WinForms/ConnectForm.cs 2007-05-12 14:18:59 UTC (rev 196)
@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+
+using NMail.Icons;
+
+namespace NMail.Administration.WinForms {
+ /// <summary>
+ /// A form prompting the user for connection details.
+ /// </summary>
+ public partial class ConnectForm : Form {
+ public ConnectForm() {
+ InitializeComponent();
+
+ this.mainIcon.Image = IconHelper.GetImage("connect_no", "actions", IconSize.s32x32);
+ }
+
+ /// <summary>
+ /// The hostname the user selected.
+ /// </summary>
+ public string Hostname {
+ get { return this.hostnameTextBox.Text; }
+ set { this.hostnameTextBox.Text = value; }
+ }
+
+ private void connectBtn_Click(object sender, EventArgs e) {
+ this.DialogResult = DialogResult.OK;
+ this.Close();
+ }
+
+ private void cancelBtn_Click(object sender, EventArgs e) {
+ this.DialogResult = DialogResult.Cancel;
+ this.Close();
+ }
+ }
+}
\ No newline at end of file
Added: NMail/trunk/NMail.Administration.WinForms/ConnectForm.resx
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/ConnectForm.resx (rev 0)
+++ NMail/trunk/NMail.Administration.WinForms/ConnectForm.resx 2007-05-12 14:18:59 UTC (rev 196)
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
\ No newline at end of file
Added: NMail/trunk/NMail.Administration.WinForms/MainForm.Designer.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/MainForm.Designer.cs (rev 0)
+++ NMail/trunk/NMail.Administration.WinForms/MainForm.Designer.cs 2007-05-12 14:18:59 UTC (rev 196)
@@ -0,0 +1,177 @@
+namespace NMail.Administration.WinForms {
+ partial class MainForm {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent() {
+ this.menuStrip = new System.Windows.Forms.MenuStrip();
+ this.fileMenu = new System.Windows.Forms.ToolStripMenuItem();
+ this.connectMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.exitMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.statusStrip = new System.Windows.Forms.StatusStrip();
+ this.serverNameLbl = new System.Windows.Forms.ToolStripStatusLabel();
+ this.connectionStatusLbl = new System.Windows.Forms.ToolStripStatusLabel();
+ this.toolStripContainer = new System.Windows.Forms.ToolStripContainer();
+ this.dockPanel = new WeifenLuo.WinFormsUI.Docking.DockPanel();
+ this.disconnectMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
+ this.menuStrip.SuspendLayout();
+ this.statusStrip.SuspendLayout();
+ this.toolStripContainer.ContentPanel.SuspendLayout();
+ this.toolStripContainer.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // menuStrip
+ //
+ this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.fileMenu});
+ this.menuStrip.Location = new System.Drawing.Point(0, 0);
+ this.menuStrip.Name = "menuStrip";
+ this.menuStrip.Size = new System.Drawing.Size(715, 24);
+ this.menuStrip.TabIndex = 0;
+ this.menuStrip.Text = "menuStrip1";
+ //
+ // fileMenu
+ //
+ this.fileMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.connectMenuItem,
+ this.disconnectMenuItem,
+ this.toolStripSeparator1,
+ this.exitMenuItem});
+ this.fileMenu.Name = "fileMenu";
+ this.fileMenu.Size = new System.Drawing.Size(35, 20);
+ this.fileMenu.Text = "File";
+ //
+ // connectMenuItem
+ //
+ this.connectMenuItem.Name = "connectMenuItem";
+ this.connectMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.connectMenuItem.Text = "Connect";
+ this.connectMenuItem.Click += new System.EventHandler(this.connectMenuItem_Click);
+ //
+ // exitMenuItem
+ //
+ this.exitMenuItem.Name = "exitMenuItem";
+ this.exitMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.exitMenuItem.Text = "Exit";
+ this.exitMenuItem.Click += new System.EventHandler(this.exitMenuItem_Click);
+ //
+ // statusStrip
+ //
+ this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.serverNameLbl,
+ this.connectionStatusLbl});
+ this.statusStrip.Location = new System.Drawing.Point(0, 495);
+ this.statusStrip.Name = "statusStrip";
+ this.statusStrip.Size = new System.Drawing.Size(715, 22);
+ this.statusStrip.TabIndex = 1;
+ this.statusStrip.Text = "statusStrip1";
+ //
+ // serverNameLbl
+ //
+ this.serverNameLbl.Name = "serverNameLbl";
+ this.serverNameLbl.Size = new System.Drawing.Size(0, 17);
+ //
+ // connectionStatusLbl
+ //
+ this.connectionStatusLbl.Name = "connectionStatusLbl";
+ this.connectionStatusLbl.Size = new System.Drawing.Size(71, 17);
+ this.connectionStatusLbl.Text = "Disconnected";
+ //
+ // toolStripContainer
+ //
+ //
+ // toolStripContainer.ContentPanel
+ //
+ this.toolStripContainer.ContentPanel.Controls.Add(this.dockPanel);
+ this.toolStripContainer.ContentPanel.Size = new System.Drawing.Size(715, 446);
+ this.toolStripContainer.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.toolStripContainer.Location = new System.Drawing.Point(0, 24);
+ this.toolStripContainer.Name = "toolStripContainer";
+ this.toolStripContainer.Size = new System.Drawing.Size(715, 471);
+ this.toolStripContainer.TabIndex = 2;
+ this.toolStripContainer.Text = "toolStripContainer1";
+ //
+ // dockPanel
+ //
+ this.dockPanel.ActiveAutoHideContent = null;
+ this.dockPanel.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.dockPanel.DocumentStyle = WeifenLuo.WinFormsUI.Docking.DocumentStyle.DockingWindow;
+ this.dockPanel.Font = new System.Drawing.Font("Tahoma", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World);
+ this.dockPanel.Location = new System.Drawing.Point(0, 0);
+ this.dockPanel.Name = "dockPanel";
+ this.dockPanel.Size = new System.Drawing.Size(715, 446);
+ this.dockPanel.TabIndex = 0;
+ //
+ // disconnectMenuItem
+ //
+ this.disconnectMenuItem.Name = "disconnectMenuItem";
+ this.disconnectMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.disconnectMenuItem.Text = "Disconnect";
+ this.disconnectMenuItem.Click += new System.EventHandler(this.disconnectMenuItem_Click);
+ //
+ // toolStripSeparator1
+ //
+ this.toolStripSeparator1.Name = "toolStripSeparator1";
+ this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6);
+ //
+ // MainForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(715, 517);
+ this.Controls.Add(this.toolStripContainer);
+ this.Controls.Add(this.statusStrip);
+ this.Controls.Add(this.menuStrip);
+ this.IsMdiContainer = true;
+ this.MainMenuStrip = this.menuStrip;
+ this.MinimumSize = new System.Drawing.Size(200, 200);
+ this.Name = "MainForm";
+ this.Text = "NMail Administration";
+ this.menuStrip.ResumeLayout(false);
+ this.menuStrip.PerformLayout();
+ this.statusStrip.ResumeLayout(false);
+ this.statusStrip.PerformLayout();
+ this.toolStripContainer.ContentPanel.ResumeLayout(false);
+ this.toolStripContainer.ResumeLayout(false);
+ this.toolStripContainer.PerformLayout();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.MenuStrip menuStrip;
+ private System.Windows.Forms.ToolStripMenuItem fileMenu;
+ private System.Windows.Forms.ToolStripMenuItem exitMenuItem;
+ private System.Windows.Forms.StatusStrip statusStrip;
+ private System.Windows.Forms.ToolStripContainer toolStripContainer;
+ private System.Windows.Forms.ToolStripStatusLabel serverNameLbl;
+ private System.Windows.Forms.ToolStripStatusLabel connectionStatusLbl;
+ private WeifenLuo.WinFormsUI.Docking.DockPanel dockPanel;
+ private System.Windows.Forms.ToolStripMenuItem connectMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem disconnectMenuItem;
+ private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
+ }
+}
+
Added: NMail/trunk/NMail.Administration.WinForms/MainForm.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/MainForm.cs (rev 0)
+++ NMail/trunk/NMail.Administration.WinForms/MainForm.cs 2007-05-12 14:18:59 UTC (rev 196)
@@ -0,0 +1,148 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.Remoting.Channels.Tcp;
+using System.Runtime.Serialization.Formatters;
+using System.Text;
+using System.Threading;
+using System.Windows.Forms;
+
+using log4net;
+using WeifenLuo.WinFormsUI.Docking;
+
+using NMail.Icons;
+using NMail.Server;
+
+namespace NMail.Administration.WinForms {
+ public partial class MainForm : Form {
+ /// <summary>
+ /// Logging support for this class
+ /// </summary>
+ private static ILog log = LogManager.GetLogger(typeof(MainForm));
+
+ public MainForm() {
+ InitializeComponent();
+
+ InitialiseRemoting();
+
+ ManagementTree.ManagementTree managementTree = new ManagementTree.ManagementTree();
+ managementTree.Dock = DockStyle.Fill;
+
+ DockContent managementTreeDock = new DockContent();
+ managementTreeDock.Controls.Add(managementTree);
+ managementTreeDock.CloseButton = false;
+ managementTreeDock.Text = "Management Tree";
+ managementTreeDock.DockPanel = this.dockPanel;
+ managementTreeDock.DockState = DockState.DockLeft;
+ managementTreeDock.Icon = IconHelper.GetIcon("tree", "apps", IconSize.s16x16);
+
+ this.connectionStatusLbl.Image = IconHelper.GetImage("connect_no", "actions", IconSize.s16x16);
+ this.connectMenuItem.Image = IconHelper.GetImage("connect_no", "actions", IconSize.s16x16);
+ }
+
+ protected virtual void InitialiseRemoting() {
+ // Set up the required formatter
+ BinaryClientFormatterSinkProvider provider = new BinaryClientFormatterSinkProvider();
+
+ // Set up a client channel.
+ IDictionary props = new Hashtable();
+ props["secure"] = true;
+ TcpClientChannel clientChannel = new TcpClientChannel(props, provider);
+ ChannelServices.RegisterChannel(clientChannel, true);
+ }
+
+ private RemoteAdministration remoteAdministration;
+
+ /// <summary>
+ /// The NMail remote administration object.
+ /// </summary>
+ public RemoteAdministration RemoteAdministration {
+ get { return remoteAdministration; }
+ }
+
+ #region Connect
+
+ protected void BeginConnect(string host) {
+ this.serverNameLbl.Text = host;
+ this.connectionStatusLbl.Image = IconHelper.GetImage("connect_creating", "actions", IconSize.s16x16);
+ this.connectionStatusLbl.Text = "Connecting...";
+
+ ThreadPool.QueueUserWorkItem(new WaitCallback(Connect), host);
+ }
+
+ protected void Connect(object o) {
+ string host = o as string;
+
+ string url = string.Format("tcp://{0}:7877/RemoteAdministration.rem", host);
+ this.remoteAdministration = (RemoteAdministration) RemotingServices.Connect(typeof(RemoteAdministration), url);
+
+ // Force the connection to come up
+ log.Debug("Remote server assembly version: " + this.remoteAdministration.Version);
+
+ this.Invoke(new MethodInvoker(UpdateConnectionStatus));
+ }
+
+ private void connectMenuItem_Click(object sender, EventArgs e) {
+ // Prompt if already connected
+ if (this.remoteAdministration != null) {
+ DialogResult result = MessageBox.Show(
+ this,
+ "NMail Administration",
+ "Disconnect?",
+ MessageBoxButtons.YesNo,
+ MessageBoxIcon.Question,
+ MessageBoxDefaultButton.Button2);
+
+ if (result != DialogResult.Yes) {
+ return;
+ }
+ }
+
+ // Get the connection details
+ ConnectForm connectionForm = new ConnectForm();
+
+ if (connectionForm.ShowDialog(this) == DialogResult.OK) {
+ // Attempt to connect
+ BeginConnect(connectionForm.Hostname);
+ }
+ }
+ #endregion
+
+ protected void UpdateConnectionStatus() {
+ if (this.remoteAdministration == null) {
+ this.connectionStatusLbl.Image = IconHelper.GetImage("connect_no", "actions", IconSize.s16x16);
+ this.connectionStatusLbl.Text = "Disconnected";
+
+ } else {
+ this.connectionStatusLbl.Image = IconHelper.GetImage("connect_established", "actions", IconSize.s16x16);
+ this.connectionStatusLbl.Text = "Connected";
+ }
+ }
+
+ #region Disconnect
+
+ public void Disconnect() {
+ this.remoteAdministration = null;
+
+ if (InvokeRequired) {
+ Invoke(new MethodInvoker(UpdateConnectionStatus));
+ } else {
+ UpdateConnectionStatus();
+ }
+ }
+
+ private void disconnectMenuItem_Click(object sender, EventArgs e) {
+ Disconnect();
+ }
+ #endregion
+
+ private void exitMenuItem_Click(object sender, EventArgs e) {
+ this.Close();
+ }
+ }
+}
\ No newline at end of file
Added: NMail/trunk/NMail.Administration.WinForms/MainForm.resx
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/MainForm.resx (rev 0)
+++ NMail/trunk/NMail.Administration.WinForms/MainForm.resx 2007-05-12 14:18:59 UTC (rev 196)
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
+ <metadata name="statusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>126, 17</value>
+ </metadata>
+</root>
\ No newline at end of file
Added: NMail/trunk/NMail.Administration.WinForms/ManagementTree/ManagementTree.Designer.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/ManagementTree/ManagementTree.Designer.cs (rev 0)
+++ NMail/trunk/NMail.Administration.WinForms/ManagementTree/ManagementTree.Designer.cs 2007-05-12 14:18:59 UTC (rev 196)
@@ -0,0 +1,64 @@
+namespace NMail.Administration.WinForms.ManagementTree {
+ partial class ManagementTree {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent() {
+ this.components = new System.ComponentModel.Container();
+ this.treeView = new System.Windows.Forms.TreeView();
+ this.imageList = new System.Windows.Forms.ImageList(this.components);
+ this.SuspendLayout();
+ //
+ // treeView
+ //
+ this.treeView.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.treeView.HideSelection = false;
+ this.treeView.ImageIndex = 0;
+ this.treeView.ImageList = this.imageList;
+ this.treeView.Location = new System.Drawing.Point(0, 0);
+ this.treeView.Name = "treeView";
+ this.treeView.SelectedImageIndex = 0;
+ this.treeView.Size = new System.Drawing.Size(150, 150);
+ this.treeView.TabIndex = 0;
+ //
+ // imageList
+ //
+ this.imageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
+ this.imageList.ImageSize = new System.Drawing.Size(16, 16);
+ this.imageList.TransparentColor = System.Drawing.Color.Transparent;
+ //
+ // ManagementTree
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.treeView);
+ this.Name = "ManagementTree";
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.TreeView treeView;
+ private System.Windows.Forms.ImageList imageList;
+ }
+}
Added: NMail/trunk/NMail.Administration.WinForms/ManagementTree/ManagementTree.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/ManagementTree/ManagementTree.cs (rev 0)
+++ NMail/trunk/NMail.Administration.WinForms/ManagementTree/ManagementTree.cs 2007-05-12 14:18:59 UTC (rev 196)
@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Text;
+using System.Windows.Forms;
+
+using NMail.Icons;
+
+namespace NMail.Administration.WinForms.ManagementTree {
+ /// <summary>
+ /// Provides a tree view of possible management options.
+ /// </summary>
+ public partial class ManagementTree : UserControl {
+ public ManagementTree() {
+ InitializeComponent();
+
+ // Setup the image list
+ this.imageList.Images.Add(IconHelper.GetImage("nmail", "apps", IconSize.s16x16));
+ this.imageList.Images.Add(IconHelper.GetImage("exec", "actions", IconSize.s16x16));
+ this.imageList.Images.Add(IconHelper.GetImage("server", "actions", IconSize.s16x16));
+ this.imageList.Images.Add(IconHelper.GetImage("edit_group", "actions", IconSize.s16x16));
+ this.imageList.Images.Add(IconHelper.GetImage("folder", "actions", IconSize.s16x16));
+ this.imageList.Images.Add(IconHelper.GetImage("queue", "actions", IconSize.s16x16));
+
+ TreeNode nmailNode = new TreeNode("NMail", 0, 0);
+ this.treeView.Nodes.Add(nmailNode);
+
+ TreeNode servicesNode = new TreeNode("Services", 1, 1);
+ nmailNode.Nodes.Add(servicesNode);
+
+ TreeNode spoolNode = new TreeNode("Smtp Spool", 5, 5);
+ nmailNode.Nodes.Add(spoolNode);
+
+ TreeNode mailDomainNode = new TreeNode("Mail Domains", 2, 2);
+ nmailNode.Nodes.Add(mailDomainNode);
+
+ TreeNode usersNode = new TreeNode("Users", 3, 3);
+ nmailNode.Nodes.Add(usersNode);
+
+ TreeNode foldersNode = new TreeNode("Folders", 4, 4);
+ nmailNode.Nodes.Add(foldersNode);
+
+ this.treeView.ExpandAll();
+ }
+ }
+}
Added: NMail/trunk/NMail.Administration.WinForms/ManagementTree/ManagementTree.resx
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/ManagementTree/ManagementTree.resx (rev 0)
+++ NMail/trunk/NMail.Administration.WinForms/ManagementTree/ManagementTree.resx 2007-05-12 14:18:59 UTC (rev 196)
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <metadata name="imageList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
+</root>
\ No newline at end of file
Added: NMail/trunk/NMail.Administration.WinForms/NMail.Administration.WinForms.csproj
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/NMail.Administration.WinForms.csproj (rev 0)
+++ NMail/trunk/NMail.Administration.WinForms/NMail.Administration.WinForms.csproj 2007-05-12 14:18:59 UTC (rev 196)
@@ -0,0 +1,145 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{2F9186A2-CAAC-436C-99C9-F41F929261F0}</ProjectGuid>
+ <OutputType>WinExe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>NMail.Administration.WinForms</RootNamespace>
+ <AssemblyName>NMail.Administration.WinForms</AssemblyName>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\References\log4net.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Deployment" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Runtime.Remoting" />
+ <Reference Include="System.Windows.Forms" />
+ <Reference Include="System.Xml" />
+ <Reference Include="WeifenLuo.WinFormsUI.Docking, Version=2.0.2649.16786, Culture=neutral, PublicKeyToken=d481317c817cec47, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\References\WeifenLuo.WinFormsUI.Docking.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="ConnectForm.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="ConnectForm.Designer.cs">
+ <DependentUpon>ConnectForm.cs</DependentUpon>
+ </Compile>
+ <Compile Include="ExceptionDialog.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="ExceptionDialog.Designer.cs">
+ <DependentUpon>ExceptionDialog.cs</DependentUpon>
+ </Compile>
+ <Compile Include="MainForm.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="MainForm.Designer.cs">
+ <DependentUpon>MainForm.cs</DependentUpon>
+ </Compile>
+ <Compile Include="ManagementTree\ManagementTree.cs">
+ <SubType>UserControl</SubType>
+ </Compile>
+ <Compile Include="ManagementTree\ManagementTree.Designer.cs">
+ <DependentUpon>ManagementTree.cs</DependentUpon>
+ </Compile>
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <EmbeddedResource Include="ConnectForm.resx">
+ <DependentUpon>ConnectForm.cs</DependentUpon>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
+ <EmbeddedResource Include="ExceptionDialog.resx">
+ <SubType>Designer</SubType>
+ <DependentUpon>ExceptionDialog.cs</DependentUpon>
+ </EmbeddedResource>
+ <EmbeddedResource Include="MainForm.resx">
+ <SubType>Designer</SubType>
+ <DependentUpon>MainForm.cs</DependentUpon>
+ </EmbeddedResource>
+ <EmbeddedResource Include="ManagementTree\ManagementTree.resx">
+ <SubType>Designer</SubType>
+ <DependentUpon>ManagementTree.cs</DependentUpon>
+ </EmbeddedResource>
+ <EmbeddedResource Include="Properties\Resources.resx">
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
+ <EmbeddedResource Include="Services\ServicesViewer.resx">
+ <SubType>Designer</SubType>
+ <DependentUpon>ServicesViewer.cs</DependentUpon>
+ </EmbeddedResource>
+ <Compile Include="Properties\Resources.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Resources.resx</DependentUpon>
+ </Compile>
+ <None Include="Properties\Settings.settings">
+ <Generator>SettingsSingleFileGenerator</Generator>
+ <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+ </None>
+ <None Include="Resources\ErrorConnecting.mht" />
+ <Compile Include="Properties\Settings.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Settings.settings</DependentUpon>
+ <DesignTimeSharedInput>True</DesignTimeSharedInput>
+ </Compile>
+ <Compile Include="Services\ServicesViewer.cs">
+ <SubType>UserControl</SubType>
+ </Compile>
+ <Compile Include="Services\ServicesViewer.Designer.cs">
+ <DependentUpon>ServicesViewer.cs</DependentUpon>
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="Resources\Connecting.html" />
+ <Content Include="Resources\ErrorConnecting.html" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\NMail.Icons\NMail.Icons.csproj">
+ <Project>{D7B3712B-CD3B-4D64-8D33-92A81D6921E2}</Project>
+ <Name>NMail.Icons</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\NMail.Server\NMail.Server.csproj">
+ <Project>{45123319-D913-4A92-BB67-C2C9E1A22A17}</Project>
+ <Name>NMail.Server</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <Folder Include="MailDomain\" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file
Added: NMail/trunk/NMail.Administration.WinForms/Program.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/Program.cs (rev 0)
+++ NMail/trunk/NMail.Administration.WinForms/Program.cs 2007-05-12 14:18:59 UTC (rev 196)
@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Net.Sockets;
+using System.Windows.Forms;
+
+namespace NMail.Administration.WinForms {
+ static class Program {
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static void Main() {
+
+ log4net.Config.XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo("logging.xml"));
+
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
+ currentMainForm = new MainForm();
+ Application.Run(currentMainForm);
+ }
+
+ static MainForm currentMainForm;
+
+ static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) {
+
+ if (e.Exception is IOException || e.Exception is SocketException) {
+ // Remoting exception, disconnect
+ currentMainForm.Disconnect();
+
+ } else {
+ // Unhandled exception, show the user
+ ExceptionDialog ed = new ExceptionDialog();
+ ed.SetException(e.Exception);
+ ed.ShowDialog();
+ }
+ }
+ }
+}
\ No newline at end of file
Added: NMail/trunk/NMail.Administration.WinForms/Properties/AssemblyInfo.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/Properties/AssemblyInfo.cs (rev 0)
+++ NMail/trunk/NMail.Administration.WinForms/Properties/AssemblyInfo.cs 2007-05-12 14:18:59 UTC (rev 196)
@@ -0,0 +1,33 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("NMail.Administration.WinForms")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("NMail.Administration.WinForms")]
+[assembly: AssemblyCopyright("Copyright © 2007")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("7d10e0fa-b0be-44d0-9d4f-dc23de9d6a68")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Added: NMail/trunk/NMail.Administration.WinForms/Properties/Resources.Designer.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/Properties/Resources.Designer.cs (rev 0)
+++ NMail/trunk/NMail.Administration.WinForms/Properties/Resources.Designer.cs 2007-05-12 14:18:59 UTC (rev 196)
@@ -0,0 +1,62 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.42
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace NMail.Administration.WinForms.Properties {
+
+
+ /// <summary>
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ /// </summary>
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ /// <summary>
+ /// Returns the cached ResourceManager instance used by this class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if ((resourceMan == null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("NMail.Administration.WinForms.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
Added: NMail/trunk/NMail.Administration.WinForms/Properties/Resources.resx
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/Properties/Resources.resx (rev 0)
+++ NMail/trunk/NMail.Administration.WinForms/Properties/Resources.resx 2007-05-12 14:18:59 UTC (rev 196)
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with...
[truncated message content] |
|
From: <tmy...@us...> - 2007-05-12 14:17:13
|
Revision: 195
http://svn.sourceforge.net/nmailserver/?rev=195&view=rev
Author: tmyroadctfig
Date: 2007-05-12 07:17:12 -0700 (Sat, 12 May 2007)
Log Message:
-----------
Changed the logging to use a XML configuration file.
Modified Paths:
--------------
NMail/trunk/NMail.Server.Console/NMail.Server.Console.csproj
NMail/trunk/NMail.Server.Console/NMail.config
NMail/trunk/NMail.Server.Console/NMailConsoleServer.cs
NMail/trunk/NMail.Server.Service/NMailService.cs
Added Paths:
-----------
NMail/trunk/NMail.Server.Console/logging.xml
Modified: NMail/trunk/NMail.Server.Console/NMail.Server.Console.csproj
===================================================================
--- NMail/trunk/NMail.Server.Console/NMail.Server.Console.csproj 2007-05-10 12:27:30 UTC (rev 194)
+++ NMail/trunk/NMail.Server.Console/NMail.Server.Console.csproj 2007-05-12 14:17:12 UTC (rev 195)
@@ -176,6 +176,9 @@
<Content Include="Bounce.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
+ <Content Include="logging.xml">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
<Content Include="NMail.Server.Console.build" />
<Content Include="Warning.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
Modified: NMail/trunk/NMail.Server.Console/NMail.config
===================================================================
--- NMail/trunk/NMail.Server.Console/NMail.config 2007-05-10 12:27:30 UTC (rev 194)
+++ NMail/trunk/NMail.Server.Console/NMail.config 2007-05-12 14:17:12 UTC (rev 195)
@@ -15,7 +15,7 @@
<section name="NMail.LocalStoreData.NHibernate" type="NMail.LocalStoreData.NHibernate.Configuration, NMail.LocalStoreData.NHibernate" />
<section name="NMail.SpoolData.NHibernate" type="NMail.SpoolData.NHibernate.Configuration, NMail.SpoolData.NHibernate" />
</configSections>
-
+
<NMail>
<Services>
<Service Type="NMail.SmtpService.SmtpService, NMail.SmtpService" />
@@ -40,7 +40,7 @@
</NMail>
<NMail.Server
- RemoteAdminAuthorizedUsers="niknak\luke">
+ RemoteAdminAuthorizedUsers="octerbar\luke">
<RemoteAdminClients>
<Client Match="127.0.0.1/32" />
Modified: NMail/trunk/NMail.Server.Console/NMailConsoleServer.cs
===================================================================
--- NMail/trunk/NMail.Server.Console/NMailConsoleServer.cs 2007-05-10 12:27:30 UTC (rev 194)
+++ NMail/trunk/NMail.Server.Console/NMailConsoleServer.cs 2007-05-12 14:17:12 UTC (rev 195)
@@ -41,7 +41,7 @@
Thread.CurrentThread.Name = "ServerMain";
// configure logging
- log4net.Config.BasicConfigurator.Configure();
+ log4net.Config.XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo("logging.xml"));
try {
// output our platform details
@@ -61,22 +61,14 @@
// start the server
server.Start();
- switch ((int) Environment.OSVersion.Platform) {
- case 128: // detect Mono
+ switch (Environment.OSVersion.Platform) {
+ case PlatformID.Unix:
// drop our root privileges
MonoPrivileges.MonoPrivileges.SetUser(8);
MonoPrivileges.MonoPrivileges.SetGroup(12);
log.Debug("Current user id:" + MonoPrivileges.MonoPrivileges.GetUser());
log.Debug("Current group id:" + MonoPrivileges.MonoPrivileges.GetGroup());
break;
-
- default: // Windows
- // Change logging to file
- log.Debug("Switching to file log...");
- log4net.Layout.ILayout layout = new log4net.Layout.SimpleLayout();
- log4net.Appender.IAppender appender = new log4net.Appender.FileAppender(layout, "NMail.log", true);
- log4net.Config.BasicConfigurator.Configure(appender);
- break;
}
// wait for line to be read (signalling a close)
Added: NMail/trunk/NMail.Server.Console/logging.xml
===================================================================
--- NMail/trunk/NMail.Server.Console/logging.xml (rev 0)
+++ NMail/trunk/NMail.Server.Console/logging.xml 2007-05-12 14:17:12 UTC (rev 195)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<log4net>
+ <!-- Console appender for console based servers -->
+ <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
+ <layout type="log4net.Layout.PatternLayout">
+ <conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
+ </layout>
+ </appender>
+
+ <!-- A catch-all rolling file appender -->
+ <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
+ <file value="NMail.log" />
+ <appendToFile value="true" />
+ <rollingStyle value="Size" />
+ <maxSizeRollBackups value="10" />
+ <maximumFileSize value="1000KB" />
+ <staticLogFileName value="true" />
+ <layout type="log4net.Layout.PatternLayout">
+ <conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
+ </layout>
+ </appender>
+
+ <!-- A selective event log appender -->
+ <appender name="EventLogAppender" type="log4net.Appender.EventLogAppender" >
+ <applicationName value="NMail" />
+
+ <filter type="log4net.Filter.LevelRangeFilter">
+ <levelMin value="INFO" />
+ <levelMax value="FATAL" />
+ </filter>
+
+ <layout type="log4net.Layout.PatternLayout">
+ <conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
+ </layout>
+ </appender>
+
+ <!-- The base logging configuration -->
+ <root>
+ <!-- <level value="INFO" /> -->
+ <appender-ref ref="ConsoleAppender" />
+ <appender-ref ref="RollingFileAppender" />
+ <appender-ref ref="EventLogAppender" />
+ </root>
+
+ <!-- Print only messages of level WARN or above in the package NHibernate -->
+ <logger name="NHibernate">
+ <level value="WARN" />
+ </logger>
+</log4net>
\ No newline at end of file
Modified: NMail/trunk/NMail.Server.Service/NMailService.cs
===================================================================
--- NMail/trunk/NMail.Server.Service/NMailService.cs 2007-05-10 12:27:30 UTC (rev 194)
+++ NMail/trunk/NMail.Server.Service/NMailService.cs 2007-05-12 14:17:12 UTC (rev 195)
@@ -40,13 +40,6 @@
// Change the working directory from System32 to our install directory
Environment.CurrentDirectory = NMailServer.GetInstallDirectory();
- log.Debug("Switching to event log...");
- log4net.Layout.ILayout layout = new log4net.Layout.SimpleLayout();
- log4net.Appender.IAppender appender = new log4net.Appender.FileAppender(layout, "NMail.log", true);
- //log4net.Appender.IAppender appender = new log4net.Appender.EventLogAppender(layout);
- log4net.Config.BasicConfigurator.Configure(appender);
- log.Debug("Now logging to event log.");
-
// output our platform details
log.Debug("NMail Console Server version: [" + Assembly.GetExecutingAssembly().GetName().Version + "]");
log.Debug("NMail Library version: [" + Assembly.GetAssembly(typeof(NMailConfiguration)).GetName().Version + "]");
@@ -80,7 +73,7 @@
Thread.CurrentThread.Name = "ServerMain";
// configure logging
- log4net.Config.BasicConfigurator.Configure();
+ log4net.Config.XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo("logging.xml"));
ServiceBase.Run(new NMailService());
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2007-05-10 12:27:29
|
Revision: 194
http://svn.sourceforge.net/nmailserver/?rev=194&view=rev
Author: tmyroadctfig
Date: 2007-05-10 05:27:30 -0700 (Thu, 10 May 2007)
Log Message:
-----------
Fixed the database configuration panel and added a sidebar picture.
Modified Paths:
--------------
NMail/trunk/NMail.SetupWizard/BaseForm.Designer.cs
NMail/trunk/NMail.SetupWizard/BasePanel.Designer.cs
NMail/trunk/NMail.SetupWizard/DatabaseConfigPanel.cs
NMail/trunk/NMail.SetupWizard/NMail.SetupWizard.csproj
NMail/trunk/NMail.SetupWizard/Properties/Resources.Designer.cs
NMail/trunk/NMail.SetupWizard/Properties/Resources.resx
Added Paths:
-----------
NMail/trunk/NMail.SetupWizard/Resources/sidebar.png
Modified: NMail/trunk/NMail.SetupWizard/BaseForm.Designer.cs
===================================================================
--- NMail/trunk/NMail.SetupWizard/BaseForm.Designer.cs 2007-05-09 13:01:26 UTC (rev 193)
+++ NMail/trunk/NMail.SetupWizard/BaseForm.Designer.cs 2007-05-10 12:27:30 UTC (rev 194)
@@ -30,7 +30,7 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
- this.ClientSize = new System.Drawing.Size(457, 355);
+ this.ClientSize = new System.Drawing.Size(457, 375);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.Name = "BaseForm";
Modified: NMail/trunk/NMail.SetupWizard/BasePanel.Designer.cs
===================================================================
--- NMail/trunk/NMail.SetupWizard/BasePanel.Designer.cs 2007-05-09 13:01:26 UTC (rev 193)
+++ NMail/trunk/NMail.SetupWizard/BasePanel.Designer.cs 2007-05-10 12:27:30 UTC (rev 194)
@@ -31,7 +31,10 @@
this.cancelButton = new System.Windows.Forms.Button();
this.leftPanel = new System.Windows.Forms.Panel();
this.buttonPanel = new System.Windows.Forms.Panel();
+ this.bottomBorderPanel = new System.Windows.Forms.Panel();
+ this.sideBorderPanel = new System.Windows.Forms.Panel();
this.topPanel.SuspendLayout();
+ this.leftPanel.SuspendLayout();
this.buttonPanel.SuspendLayout();
this.SuspendLayout();
//
@@ -96,7 +99,8 @@
// leftPanel
//
this.leftPanel.BackColor = System.Drawing.SystemColors.Control;
- this.leftPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.leftPanel.BackgroundImage = global::NMail.SetupWizard.Properties.Resources.sidebar;
+ this.leftPanel.Controls.Add(this.sideBorderPanel);
this.leftPanel.Dock = System.Windows.Forms.DockStyle.Left;
this.leftPanel.Location = new System.Drawing.Point(0, 0);
this.leftPanel.Name = "leftPanel";
@@ -106,7 +110,7 @@
// buttonPanel
//
this.buttonPanel.BackColor = System.Drawing.SystemColors.Control;
- this.buttonPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.buttonPanel.Controls.Add(this.bottomBorderPanel);
this.buttonPanel.Controls.Add(this.backButton);
this.buttonPanel.Controls.Add(this.nextButton);
this.buttonPanel.Controls.Add(this.cancelButton);
@@ -116,6 +120,24 @@
this.buttonPanel.Size = new System.Drawing.Size(463, 35);
this.buttonPanel.TabIndex = 6;
//
+ // bottomBorderPanel
+ //
+ this.bottomBorderPanel.BackColor = System.Drawing.Color.Black;
+ this.bottomBorderPanel.Dock = System.Windows.Forms.DockStyle.Top;
+ this.bottomBorderPanel.Location = new System.Drawing.Point(0, 0);
+ this.bottomBorderPanel.Name = "bottomBorderPanel";
+ this.bottomBorderPanel.Size = new System.Drawing.Size(463, 1);
+ this.bottomBorderPanel.TabIndex = 3;
+ //
+ // sideBorderPanel
+ //
+ this.sideBorderPanel.BackColor = System.Drawing.Color.Black;
+ this.sideBorderPanel.Dock = System.Windows.Forms.DockStyle.Right;
+ this.sideBorderPanel.Location = new System.Drawing.Point(99, 0);
+ this.sideBorderPanel.Name = "sideBorderPanel";
+ this.sideBorderPanel.Size = new System.Drawing.Size(1, 352);
+ this.sideBorderPanel.TabIndex = 0;
+ //
// BasePanel
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -129,6 +151,7 @@
this.Size = new System.Drawing.Size(463, 387);
this.topPanel.ResumeLayout(false);
this.topPanel.PerformLayout();
+ this.leftPanel.ResumeLayout(false);
this.buttonPanel.ResumeLayout(false);
this.ResumeLayout(false);
@@ -144,5 +167,7 @@
protected System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Panel leftPanel;
private System.Windows.Forms.Panel buttonPanel;
+ private System.Windows.Forms.Panel sideBorderPanel;
+ private System.Windows.Forms.Panel bottomBorderPanel;
}
}
Modified: NMail/trunk/NMail.SetupWizard/DatabaseConfigPanel.cs
===================================================================
--- NMail/trunk/NMail.SetupWizard/DatabaseConfigPanel.cs 2007-05-09 13:01:26 UTC (rev 193)
+++ NMail/trunk/NMail.SetupWizard/DatabaseConfigPanel.cs 2007-05-10 12:27:30 UTC (rev 194)
@@ -20,6 +20,7 @@
using System.ComponentModel;
using System.Drawing;
using System.Data;
+using System.IO;
using System.Text;
using System.Windows.Forms;
@@ -50,8 +51,9 @@
NMail.SpoolData.NHibernate.Configuration nhsdc = NMail.SpoolData.NHibernate.Configuration.Current;
- // TODO: save filename to config, save file
- throw new NotImplementedException();
+ using (StreamWriter spoolXml = new StreamWriter(nhsdc.ConfigurationFile)) {
+ spoolXml.Write(this.spoolHibernateTextBox.Text);
+ }
} else {
// Remove the configuration
@@ -64,8 +66,9 @@
NMail.LocalStoreData.NHibernate.Configuration nhlsdc = NMail.LocalStoreData.NHibernate.Configuration.Current;
- // TODO: save filename to config, save file
- throw new NotImplementedException();
+ using (StreamWriter storeXml = new StreamWriter(nhlsdc.ConfigurationFile)) {
+ storeXml.Write(this.localStoreHibernateTextBox.Text);
+ }
} else {
// Remove the configuration
@@ -77,8 +80,30 @@
NMail.LocalStoreData.NHibernate.Configuration nhlsdc = NMail.LocalStoreData.NHibernate.Configuration.Current;
NMail.SpoolData.NHibernate.Configuration nhsdc = NMail.SpoolData.NHibernate.Configuration.Current;
- // TODO: Populate the widgets with the current config
- throw new NotImplementedException();
+ // Ensure valid file names
+ if (nhlsdc.ConfigurationFile == null || nhlsdc.ConfigurationFile.Trim() == string.Empty) {
+ nhlsdc.ConfigurationFile = "hibernate-store-configuration.xml";
+ }
+ if (nhlsdc.ConfigurationFile == null || nhlsdc.ConfigurationFile.Trim() == string.Empty) {
+ nhlsdc.ConfigurationFile = "hibernate-spool-configuration.xml";
+ }
+
+ // Attempt to load the configuration
+ try {
+ using (StreamReader storeXml = new StreamReader(nhlsdc.ConfigurationFile)) {
+ this.localStoreHibernateTextBox.Text = storeXml.ReadToEnd();
+ }
+ } catch (Exception) {
+ this.localStoreHibernateTextBox.Text = EmptyHibernateConfig;
+ }
+
+ try {
+ using (StreamReader spoolXml = new StreamReader(nhsdc.ConfigurationFile)) {
+ this.spoolHibernateTextBox.Text = spoolXml.ReadToEnd();
+ }
+ } catch (Exception) {
+ this.spoolHibernateTextBox.Text = EmptyHibernateConfig;
+ }
}
protected override void OnNextButtonClick() {
@@ -94,7 +119,14 @@
}
private void descriptionTextBox_LinkClicked(object sender, LinkClickedEventArgs e) {
- System.Diagnostics.Process.Start(e.LinkText);
+ try {
+ System.Diagnostics.Process.Start(e.LinkText);
+
+ } catch (Exception) {
+ // Ignore
+ }
}
+
+ public const string EmptyHibernateConfig = "<hibernate-configuration xmlns=\"urn:nhibernate-configuration-2.0\">\r\n</hibernate-configuration>";
}
}
Modified: NMail/trunk/NMail.SetupWizard/NMail.SetupWizard.csproj
===================================================================
--- NMail/trunk/NMail.SetupWizard/NMail.SetupWizard.csproj 2007-05-09 13:01:26 UTC (rev 193)
+++ NMail/trunk/NMail.SetupWizard/NMail.SetupWizard.csproj 2007-05-10 12:27:30 UTC (rev 194)
@@ -219,6 +219,9 @@
<ItemGroup>
<None Include="Resources\pending.png" />
</ItemGroup>
+ <ItemGroup>
+ <None Include="Resources\sidebar.png" />
+ </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Modified: NMail/trunk/NMail.SetupWizard/Properties/Resources.Designer.cs
===================================================================
--- NMail/trunk/NMail.SetupWizard/Properties/Resources.Designer.cs 2007-05-09 13:01:26 UTC (rev 193)
+++ NMail/trunk/NMail.SetupWizard/Properties/Resources.Designer.cs 2007-05-10 12:27:30 UTC (rev 194)
@@ -81,6 +81,13 @@
}
}
+ internal static System.Drawing.Bitmap sidebar {
+ get {
+ object obj = ResourceManager.GetObject("sidebar", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
internal static System.Drawing.Bitmap warning {
get {
object obj = ResourceManager.GetObject("warning", resourceCulture);
Modified: NMail/trunk/NMail.SetupWizard/Properties/Resources.resx
===================================================================
--- NMail/trunk/NMail.SetupWizard/Properties/Resources.resx 2007-05-09 13:01:26 UTC (rev 193)
+++ NMail/trunk/NMail.SetupWizard/Properties/Resources.resx 2007-05-10 12:27:30 UTC (rev 194)
@@ -118,16 +118,19 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ <data name="ok" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Resources\ok.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
<data name="error" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\error.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
- <data name="ok" type="System.Resources.ResXFileRef, System.Windows.Forms">
- <value>..\Resources\ok.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ <data name="warning" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Resources\warning.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="pending" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\pending.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
- <data name="warning" type="System.Resources.ResXFileRef, System.Windows.Forms">
- <value>..\Resources\warning.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ <data name="sidebar" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Resources\sidebar.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
\ No newline at end of file
Added: NMail/trunk/NMail.SetupWizard/Resources/sidebar.png
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/NMail.SetupWizard/Resources/sidebar.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2007-05-09 13:01:25
|
Revision: 193
http://svn.sourceforge.net/nmailserver/?rev=193&view=rev
Author: tmyroadctfig
Date: 2007-05-09 06:01:26 -0700 (Wed, 09 May 2007)
Log Message:
-----------
Minor change not picked up by Tortoise SVN.
Modified Paths:
--------------
NMail/trunk/NMail.UnitTests/Helper/MimeHelperTests.cs
Modified: NMail/trunk/NMail.UnitTests/Helper/MimeHelperTests.cs
===================================================================
--- NMail/trunk/NMail.UnitTests/Helper/MimeHelperTests.cs 2007-05-09 12:58:27 UTC (rev 192)
+++ NMail/trunk/NMail.UnitTests/Helper/MimeHelperTests.cs 2007-05-09 13:01:26 UTC (rev 193)
@@ -22,6 +22,7 @@
using NUnit.Framework;
using NMail.DataTypes;
+using NMail.DataTypes.Message;
using NMail.Helper;
namespace NMail.UnitTests.Helper {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2007-05-09 12:58:25
|
Revision: 192
http://svn.sourceforge.net/nmailserver/?rev=192&view=rev
Author: tmyroadctfig
Date: 2007-05-09 05:58:27 -0700 (Wed, 09 May 2007)
Log Message:
-----------
Remove old projects.
Removed Paths:
-------------
NMail/trunk/NMail.Administration.Console/
NMail/trunk/NMail.LocalStoreData.MySql/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2007-05-09 12:56:43
|
Revision: 191
http://svn.sourceforge.net/nmailserver/?rev=191&view=rev
Author: tmyroadctfig
Date: 2007-05-09 05:56:42 -0700 (Wed, 09 May 2007)
Log Message:
-----------
Added ACLs to most local store functions. Some work on setup wizard.
Modified Paths:
--------------
NMail/trunk/NMail/DataTypes/ACLs/SystemPrivilege.cs
NMail/trunk/NMail/DataTypes/LocalStore/ILocalStore.cs
NMail/trunk/NMail.LocalStore/LocalStore.cs
NMail/trunk/NMail.SetupWizard/DatabaseConfigPanel.Designer.cs
NMail/trunk/NMail.SetupWizard/DatabaseConfigPanel.cs
NMail/trunk/NMail.SetupWizard/LocalStoreConfigPanel.cs
NMail/trunk/NMail.SetupWizard/NMail.SetupWizard.csproj
NMail/trunk/NMail.SetupWizard/SmtpSubSysConfigPanel.cs
NMail/trunk/NMail.sln
Removed Paths:
-------------
NMail/trunk/NMail.SetupWizard/MySqlHelper.cs
Modified: NMail/trunk/NMail/DataTypes/ACLs/SystemPrivilege.cs
===================================================================
--- NMail/trunk/NMail/DataTypes/ACLs/SystemPrivilege.cs 2007-05-08 13:20:38 UTC (rev 190)
+++ NMail/trunk/NMail/DataTypes/ACLs/SystemPrivilege.cs 2007-05-09 12:56:42 UTC (rev 191)
@@ -31,6 +31,21 @@
/// <summary>
/// The right to create a new mail domain.
/// </summary>
- CreateMailDomain = 8
+ CreateMailDomain = 8,
+
+ /// <summary>
+ /// The right to view mail domains.
+ /// </summary>
+ ViewMailDomains = 16,
+
+ /// <summary>
+ /// The right to alter mail domains.
+ /// </summary>
+ UpdateMailDomain = 32,
+
+ /// <summary>
+ /// The right to delete mail domains.
+ /// </summary>
+ DeleteMailDomain = 64
}
}
Modified: NMail/trunk/NMail/DataTypes/LocalStore/ILocalStore.cs
===================================================================
--- NMail/trunk/NMail/DataTypes/LocalStore/ILocalStore.cs 2007-05-08 13:20:38 UTC (rev 190)
+++ NMail/trunk/NMail/DataTypes/LocalStore/ILocalStore.cs 2007-05-09 12:56:42 UTC (rev 191)
@@ -566,7 +566,7 @@
/// </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);
+ void SetAdministrationAce(IAuthenticationToken authToken, GenericAce<UserGroupAdminPrivilege> ace);
/// <summary>
/// Removes any ACE associated with the given identifier.
Modified: NMail/trunk/NMail.LocalStore/LocalStore.cs
===================================================================
--- NMail/trunk/NMail.LocalStore/LocalStore.cs 2007-05-08 13:20:38 UTC (rev 190)
+++ NMail/trunk/NMail.LocalStore/LocalStore.cs 2007-05-09 12:56:42 UTC (rev 191)
@@ -1044,7 +1044,7 @@
return LocalStoreData.GetUsers();
}
- return List<LocalStoreUser>();
+ return new List<LocalStoreUser>();
}
public void CreateUser(IAuthenticationToken authToken, LocalStoreUser user) {
@@ -1246,19 +1246,25 @@
/// <param name="authToken">The authentication credentials.</param>
/// <returns>The mail domains.</returns>
public IList<MailDomain> GetMailDomains(IAuthenticationToken authToken) {
+ if (hasSystemPrivilege(authToken.Username, SystemPrivilege.ViewMailDomains)) {
+ return this.LocalStoreData.GetMailDomains();
+ }
- // TODO: check acls
- return this.LocalStoreData.GetMailDomains();
+ return new List<MailDomain>();
}
+
/// <summary>
/// Creates a new mail domain for the given host.
/// </summary>
/// <param name="authToken">The authentication credentials.</param>
/// <param name="mailDomain">The mail domain to create.</param>
public void CreateMailDomain(IAuthenticationToken authToken, MailDomain mailDomain) {
- // TODO: check ACLs
+ if (hasSystemPrivilege(authToken.Username, SystemPrivilege.CreateMailDomain)) {
+ this.LocalStoreData.CreateMailDomain(mailDomain);
- this.LocalStoreData.CreateMailDomain(mailDomain);
+ } else {
+ throw new InvalidOperationException("Not permitted to create a mail domain.");
+ }
}
/// <summary>
@@ -1267,9 +1273,12 @@
/// <param name="authToken">The authentication credentials.</param>
/// <param name="mailDomainId">The Id of the mail domain to delete.</param>
public void DeleteMailDomain(IAuthenticationToken authToken, int mailDomainId) {
+ if (hasSystemPrivilege(authToken.Username, SystemPrivilege.DeleteMailDomain)) {
+ this.LocalStoreData.DeleteMailDomain(mailDomainId);
- // TODO: check acls
- this.LocalStoreData.DeleteMailDomain(mailDomainId);
+ } else {
+ throw new InvalidOperationException("Not permitted to delete a mail domain.");
+ }
}
/// <summary>
@@ -1278,9 +1287,12 @@
/// <param name="authToken">The authentication credentials.</param>
/// <param name="mailDomain">The mail domain to update.</param>
public void UpdateMailDomain(IAuthenticationToken authToken, MailDomain mailDomain) {
+ if (hasSystemPrivilege(authToken.Username, SystemPrivilege.UpdateMailDomain)) {
+ this.LocalStoreData.UpdateMailDomain(mailDomain);
- // TODO: check acls
- this.LocalStoreData.UpdateMailDomain(mailDomain);
+ } else {
+ throw new InvalidOperationException("Not permitted to alter a mail domain.");
+ }
}
#endregion
@@ -1333,7 +1345,11 @@
/// <param name="user">The user trying to get the admin ACL.</param>
/// <returns>The ACL or null if insufficient privileges.</returns>
public GenericAcl<UserGroupAdminPrivilege> GetAdministrationAcl(IAuthenticationToken user) {
- throw new NotImplementedException();
+ if (hasSystemPrivilege(user.Username, SystemPrivilege.ViewSystemPrivileges)) {
+ return LocalStoreData.GetUserGroupAdminPrivilegeAcl();
+ }
+
+ return null;
}
/// <summary>
@@ -1342,8 +1358,13 @@
/// </summary>
/// <param name="authToken">The authentication credentials.</param>
/// <param name="ace">The privileges and the identifier to put.</param>
- public void SetAdministrationAce(IAuthenticationToken authToken, GenericAce<SystemPrivilege> ace) {
- throw new NotImplementedException();
+ public void SetAdministrationAce(IAuthenticationToken authToken, GenericAce<UserGroupAdminPrivilege> ace) {
+ if (hasSystemPrivilege(authToken.Username, SystemPrivilege.ModifySystemPrivileges)) {
+ LocalStoreData.SetUserGroupAdminPrivilegeAce(ace);
+
+ } else {
+ throw new InvalidOperationException("Not permitted to alter administration ACL.");
+ }
}
/// <summary>
@@ -1352,7 +1373,12 @@
/// <param name="authToken">The authentication credentials.</param>
/// <param name="identifier">The identifier to remove from the ACL.</param>
public void RemoveAdministrationAce(IAuthenticationToken authToken, string identifier) {
- throw new NotImplementedException();
+ if (hasSystemPrivilege(authToken.Username, SystemPrivilege.ModifySystemPrivileges)) {
+ LocalStoreData.RemoveUserGroupAdminPrivilegeAce(identifier);
+
+ } else {
+ throw new InvalidOperationException("Not permitted to alter administration ACL.");
+ }
}
#endregion
Modified: NMail/trunk/NMail.SetupWizard/DatabaseConfigPanel.Designer.cs
===================================================================
--- NMail/trunk/NMail.SetupWizard/DatabaseConfigPanel.Designer.cs 2007-05-08 13:20:38 UTC (rev 190)
+++ NMail/trunk/NMail.SetupWizard/DatabaseConfigPanel.Designer.cs 2007-05-09 12:56:42 UTC (rev 191)
@@ -23,15 +23,11 @@
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
- this.descriptionTextBox = new System.Windows.Forms.TextBox();
- this.hostname = new System.Windows.Forms.TextBox();
- this.username = new System.Windows.Forms.TextBox();
- this.password = new System.Windows.Forms.TextBox();
- this.createDbUserCheckBox = new System.Windows.Forms.CheckBox();
- this.autoPassCheckBox = new System.Windows.Forms.CheckBox();
- this.hostLbl = new System.Windows.Forms.Label();
- this.usernameLbl = new System.Windows.Forms.Label();
- this.passwordLbl = new System.Windows.Forms.Label();
+ this.descriptionTextBox = new System.Windows.Forms.RichTextBox();
+ this.spoolHibernateTextBox = new System.Windows.Forms.TextBox();
+ this.localStoreHibernateTextBox = new System.Windows.Forms.TextBox();
+ this.spoolLabel = new System.Windows.Forms.Label();
+ this.localStoreLabel = new System.Windows.Forms.Label();
this.mainPanel.SuspendLayout();
this.SuspendLayout();
//
@@ -42,14 +38,10 @@
//
// mainPanel
//
- this.mainPanel.Controls.Add(this.passwordLbl);
- this.mainPanel.Controls.Add(this.usernameLbl);
- this.mainPanel.Controls.Add(this.autoPassCheckBox);
- this.mainPanel.Controls.Add(this.hostLbl);
- this.mainPanel.Controls.Add(this.password);
- this.mainPanel.Controls.Add(this.createDbUserCheckBox);
- this.mainPanel.Controls.Add(this.username);
- this.mainPanel.Controls.Add(this.hostname);
+ this.mainPanel.Controls.Add(this.localStoreLabel);
+ this.mainPanel.Controls.Add(this.spoolLabel);
+ this.mainPanel.Controls.Add(this.localStoreHibernateTextBox);
+ this.mainPanel.Controls.Add(this.spoolHibernateTextBox);
this.mainPanel.Controls.Add(this.descriptionTextBox);
this.mainPanel.Size = new System.Drawing.Size(357, 273);
//
@@ -58,92 +50,54 @@
this.descriptionTextBox.BackColor = System.Drawing.Color.White;
this.descriptionTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.descriptionTextBox.Location = new System.Drawing.Point(8, 8);
- this.descriptionTextBox.Multiline = true;
this.descriptionTextBox.Name = "descriptionTextBox";
this.descriptionTextBox.ReadOnly = true;
this.descriptionTextBox.Size = new System.Drawing.Size(343, 40);
this.descriptionTextBox.TabIndex = 2;
this.descriptionTextBox.TabStop = false;
- this.descriptionTextBox.Text = "Enter the details of the database to use for the SMTP spool and local store data." +
- "";
+ this.descriptionTextBox.Text = "Enter the details of the databases to use for the SMTP spool and local store data" +
+ ". See the NHibernate website (http://www.hibernate.org/361.html) for more detail" +
+ "s.";
+ this.descriptionTextBox.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.descriptionTextBox_LinkClicked);
//
- // hostname
+ // spoolHibernateTextBox
//
- this.hostname.Location = new System.Drawing.Point(127, 70);
- this.hostname.Name = "hostname";
- this.hostname.Size = new System.Drawing.Size(176, 20);
- this.hostname.TabIndex = 3;
- this.hostname.Text = "127.0.0.1";
+ this.spoolHibernateTextBox.AcceptsReturn = true;
+ this.spoolHibernateTextBox.AcceptsTab = true;
+ this.spoolHibernateTextBox.Location = new System.Drawing.Point(8, 77);
+ this.spoolHibernateTextBox.Multiline = true;
+ this.spoolHibernateTextBox.Name = "spoolHibernateTextBox";
+ this.spoolHibernateTextBox.Size = new System.Drawing.Size(338, 77);
+ this.spoolHibernateTextBox.TabIndex = 3;
//
- // username
+ // localStoreHibernateTextBox
//
- this.username.Location = new System.Drawing.Point(127, 119);
- this.username.Name = "username";
- this.username.Size = new System.Drawing.Size(176, 20);
- this.username.TabIndex = 5;
- this.username.Text = "NMail";
+ this.localStoreHibernateTextBox.AcceptsReturn = true;
+ this.localStoreHibernateTextBox.AcceptsTab = true;
+ this.localStoreHibernateTextBox.Location = new System.Drawing.Point(6, 188);
+ this.localStoreHibernateTextBox.Multiline = true;
+ this.localStoreHibernateTextBox.Name = "localStoreHibernateTextBox";
+ this.localStoreHibernateTextBox.Size = new System.Drawing.Size(338, 77);
+ this.localStoreHibernateTextBox.TabIndex = 4;
//
- // password
+ // spoolLabel
//
- this.password.Enabled = false;
- this.password.Location = new System.Drawing.Point(127, 191);
- this.password.Name = "password";
- this.password.PasswordChar = '*';
- this.password.Size = new System.Drawing.Size(176, 20);
- this.password.TabIndex = 7;
+ this.spoolLabel.AutoSize = true;
+ this.spoolLabel.Location = new System.Drawing.Point(6, 61);
+ this.spoolLabel.Name = "spoolLabel";
+ this.spoolLabel.Size = new System.Drawing.Size(37, 13);
+ this.spoolLabel.TabIndex = 5;
+ this.spoolLabel.Text = "Spool:";
//
- // createDbUserCheckBox
+ // localStoreLabel
//
- this.createDbUserCheckBox.AutoSize = true;
- this.createDbUserCheckBox.Checked = true;
- this.createDbUserCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
- this.createDbUserCheckBox.Location = new System.Drawing.Point(127, 145);
- this.createDbUserCheckBox.Name = "createDbUserCheckBox";
- this.createDbUserCheckBox.Size = new System.Drawing.Size(159, 17);
- this.createDbUserCheckBox.TabIndex = 8;
- this.createDbUserCheckBox.Text = "Create a new database user";
- this.createDbUserCheckBox.UseVisualStyleBackColor = true;
- this.createDbUserCheckBox.CheckedChanged += new System.EventHandler(this.createDbUserCheckBox_CheckedChanged);
+ this.localStoreLabel.AutoSize = true;
+ this.localStoreLabel.Location = new System.Drawing.Point(5, 172);
+ this.localStoreLabel.Name = "localStoreLabel";
+ this.localStoreLabel.Size = new System.Drawing.Size(64, 13);
+ this.localStoreLabel.TabIndex = 6;
+ this.localStoreLabel.Text = "Local Store:";
//
- // autoPassCheckBox
- //
- this.autoPassCheckBox.AutoSize = true;
- this.autoPassCheckBox.Checked = true;
- this.autoPassCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
- this.autoPassCheckBox.Location = new System.Drawing.Point(127, 168);
- this.autoPassCheckBox.Name = "autoPassCheckBox";
- this.autoPassCheckBox.Size = new System.Drawing.Size(141, 17);
- this.autoPassCheckBox.TabIndex = 6;
- this.autoPassCheckBox.Text = "Auto generate password";
- this.autoPassCheckBox.UseVisualStyleBackColor = true;
- //
- // hostLbl
- //
- this.hostLbl.AutoSize = true;
- this.hostLbl.Location = new System.Drawing.Point(42, 73);
- this.hostLbl.Name = "hostLbl";
- this.hostLbl.Size = new System.Drawing.Size(79, 13);
- this.hostLbl.TabIndex = 7;
- this.hostLbl.Text = "Database host:";
- //
- // usernameLbl
- //
- this.usernameLbl.AutoSize = true;
- this.usernameLbl.Location = new System.Drawing.Point(42, 122);
- this.usernameLbl.Name = "usernameLbl";
- this.usernameLbl.Size = new System.Drawing.Size(79, 13);
- this.usernameLbl.TabIndex = 8;
- this.usernameLbl.Text = "Database user:";
- //
- // passwordLbl
- //
- this.passwordLbl.AutoSize = true;
- this.passwordLbl.Location = new System.Drawing.Point(17, 194);
- this.passwordLbl.Name = "passwordLbl";
- this.passwordLbl.Size = new System.Drawing.Size(104, 13);
- this.passwordLbl.TabIndex = 9;
- this.passwordLbl.Text = "Database password:";
- //
// DatabaseConfigPanel
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -158,14 +112,10 @@
#endregion
- private System.Windows.Forms.TextBox descriptionTextBox;
- private System.Windows.Forms.TextBox username;
- private System.Windows.Forms.TextBox hostname;
- private System.Windows.Forms.CheckBox autoPassCheckBox;
- private System.Windows.Forms.Label hostLbl;
- private System.Windows.Forms.TextBox password;
- private System.Windows.Forms.CheckBox createDbUserCheckBox;
- private System.Windows.Forms.Label usernameLbl;
- private System.Windows.Forms.Label passwordLbl;
+ private System.Windows.Forms.RichTextBox descriptionTextBox;
+ private System.Windows.Forms.TextBox spoolHibernateTextBox;
+ private System.Windows.Forms.TextBox localStoreHibernateTextBox;
+ private System.Windows.Forms.Label localStoreLabel;
+ private System.Windows.Forms.Label spoolLabel;
}
}
Modified: NMail/trunk/NMail.SetupWizard/DatabaseConfigPanel.cs
===================================================================
--- NMail/trunk/NMail.SetupWizard/DatabaseConfigPanel.cs 2007-05-08 13:20:38 UTC (rev 190)
+++ NMail/trunk/NMail.SetupWizard/DatabaseConfigPanel.cs 2007-05-09 12:56:42 UTC (rev 191)
@@ -23,9 +23,6 @@
using System.Text;
using System.Windows.Forms;
-using NMail.SpoolData.MySql.Configuration;
-using NMail.LocalStoreData.MySql.Configuration;
-
namespace NMail.SetupWizard {
public partial class DatabaseConfigPanel : BasePanel {
public DatabaseConfigPanel(BaseForm baseForm, SmtpSubSysConfigPanel smtpConfigPanel, LocalStoreConfigPanel localStoreConfigPanel, BasePanel previous) : base(baseForm) {
@@ -36,139 +33,52 @@
this.PreviousPanel = previous;
this.NextPanel = new ServiceConfigPanel(this.BaseForm, this);
- // TODO: load config
-
- // Make a random password
- this.password.Text = Convert.ToBase64String(Guid.NewGuid().ToByteArray());
- this.password.Text = this.password.Text.Replace("=", "a");
- this.password.Text = this.password.Text.Replace("+", "b");
- this.password.Text = this.password.Text.Replace("/", "c");
-
- this.createDbUserTask = new Task("Create a new database user.", new TaskDelegate(createDbUser));
-
- this.grantDbUserPrivsTask = new Task("Grant privileges to the database user.", new TaskDelegate(grantDbPrivileges));
+ loadConfiguration();
}
private LocalStoreConfigPanel localStoreConfigPanel;
private SmtpSubSysConfigPanel smtpConfigPanel;
- private Task createDbUserTask;
-
- private Task grantDbUserPrivsTask;
-
/// <summary>
- /// The code that attempts to create a new database user.
- /// </summary>
- /// <param name="message">A message if an error occurs.</param>
- /// <returns>The result of the attempt to create the database user.</returns>
- private TaskResult createDbUser(out string message) {
- try {
- MySqlHelper.DatabaseHost = this.DatabaseHost;
- MySqlHelper.CreateUser(this.DatabaseUsername, this.DatabasePassword);
- message = null;
- return TaskResult.Ok;
-
- } catch (Exception e) {
- message = "Error creating database user: " + e.Message;
- return TaskResult.Error;
- }
- }
-
- /// <summary>
- /// Grants the database user the required privileges to the database.
- /// </summary>
- /// <param name="message">A message if an error occurs.</param>
- /// <returns>The result of the attempt to grant the privileges.</returns>
- private TaskResult grantDbPrivileges(out string message) {
- try {
- string dbUser = this.DatabaseUsername + "@'%'";
- MySqlHelper.DatabaseHost = this.DatabaseHost;
- MySqlHelper.GrantPrivileges(dbUser, "mysql.proc", "SELECT"); // TODO: remove for MySql connector 1.0.8 and higher
- MySqlHelper.GrantPrivileges(dbUser, "NMailSpool.*", "INSERT,SELECT,UPDATE,DELETE,EXECUTE");
- MySqlHelper.GrantPrivileges(dbUser, "NMailLocalStore.*", "INSERT,SELECT,UPDATE,DELETE,EXECUTE");
-
- message = null;
- return TaskResult.Ok;
-
- } catch (Exception e) {
- message = "Error granting privileges to database user: " + e.Message;
- return TaskResult.Error;
- }
- }
-
- /// <summary>
- /// Gets the database host.
- /// </summary>
- public string DatabaseHost {
- get {
- return this.hostname.Text;
- }
- }
-
- /// <summary>
- /// Gets the database password.
- /// </summary>
- public string DatabasePassword {
- get {
- return this.password.Text;
- }
- }
-
- /// <summary>
- /// Gets the database username.
- /// </summary>
- public string DatabaseUsername {
- get {
- return this.username.Text;
- }
- }
-
- /// <summary>
/// Stores the settings into the configuration objects.
/// </summary>
private void storeConfiguration() {
if (this.smtpConfigPanel.SmtpSubSystemEnabled) {
// Ensure our config sections are there
- MySqlSpoolDataConfiguration.AddToConfigFile();
+ NMail.SpoolData.NHibernate.Configuration.AddToConfigFile();
- MySqlSpoolDataConfiguration msdc = MySqlSpoolDataConfiguration.Current;
+ NMail.SpoolData.NHibernate.Configuration nhsdc = NMail.SpoolData.NHibernate.Configuration.Current;
- // Save the connection string
- msdc.ConnectionString = string.Format(
- "Host={0};Password={1};Uid={2};Database=NMailSpool",
- this.hostname.Text,
- this.password.Text,
- this.username.Text);
-
+ // TODO: save filename to config, save file
+ throw new NotImplementedException();
+
} else {
// Remove the configuration
- MySqlSpoolDataConfiguration.RemoveFromConfigFile();
+ NMail.LocalStoreData.NHibernate.Configuration.RemoveFromConfigFile();
}
if (this.localStoreConfigPanel.LocalStoreSubSystemEnabled) {
// Ensure our config sections are there
- MySqlLocalStoreDataConfiguration.AddToConfigFile();
+ NMail.LocalStoreData.NHibernate.Configuration.AddToConfigFile();
- MySqlLocalStoreDataConfiguration mlsdc = MySqlLocalStoreDataConfiguration.Current;
+ NMail.LocalStoreData.NHibernate.Configuration nhlsdc = NMail.LocalStoreData.NHibernate.Configuration.Current;
- // Save the connection string
- mlsdc.ConnectionString = string.Format(
- "Host={0};Password={1};Uid={2};Database=NMailLocalStore",
- this.hostname.Text,
- this.password.Text,
- this.username.Text);
+ // TODO: save filename to config, save file
+ throw new NotImplementedException();
} else {
// Remove the configuration
- MySqlLocalStoreDataConfiguration.RemoveFromConfigFile();
+ NMail.LocalStoreData.NHibernate.Configuration.RemoveFromConfigFile();
}
}
private void loadConfiguration() {
- MySqlSpoolDataConfiguration msdc = MySqlSpoolDataConfiguration.Current;
+ NMail.LocalStoreData.NHibernate.Configuration nhlsdc = NMail.LocalStoreData.NHibernate.Configuration.Current;
+ NMail.SpoolData.NHibernate.Configuration nhsdc = NMail.SpoolData.NHibernate.Configuration.Current;
// TODO: Populate the widgets with the current config
+ throw new NotImplementedException();
}
protected override void OnNextButtonClick() {
@@ -179,33 +89,12 @@
MessageBox.Show(this, e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
-
- if (this.createDbUserCheckBox.Checked && !this.BaseForm.Tasks.Contains(this.createDbUserTask)) {
- int makeTablesIndex = this.smtpConfigPanel.MakeSpoolTablesTaskIndex;
-
- if (makeTablesIndex == -1) {
- this.BaseForm.Tasks.Add(this.createDbUserTask);
- this.BaseForm.Tasks.Add(this.grantDbUserPrivsTask);
- } else {
- // Insert the create user task before the make spool tables task
- this.BaseForm.Tasks.Insert(makeTablesIndex, this.createDbUserTask);
- this.BaseForm.Tasks.Insert(makeTablesIndex + 1, this.grantDbUserPrivsTask);
- }
- }
base.OnNextButtonClick();
}
- protected override void OnBackButtonClick() {
- this.BaseForm.Tasks.Remove(this.createDbUserTask);
- this.BaseForm.Tasks.Remove(this.grantDbUserPrivsTask);
-
- base.OnBackButtonClick();
+ private void descriptionTextBox_LinkClicked(object sender, LinkClickedEventArgs e) {
+ System.Diagnostics.Process.Start(e.LinkText);
}
-
- private void createDbUserCheckBox_CheckedChanged(object sender, EventArgs e) {
- this.autoPassCheckBox.Enabled = this.createDbUserCheckBox.Checked;
- this.password.Enabled = this.createDbUserCheckBox.Checked && !this.autoPassCheckBox.Checked;
- }
}
}
Modified: NMail/trunk/NMail.SetupWizard/LocalStoreConfigPanel.cs
===================================================================
--- NMail/trunk/NMail.SetupWizard/LocalStoreConfigPanel.cs 2007-05-08 13:20:38 UTC (rev 190)
+++ NMail/trunk/NMail.SetupWizard/LocalStoreConfigPanel.cs 2007-05-09 12:56:42 UTC (rev 191)
@@ -28,8 +28,7 @@
using NMail.DataTypes;
using NMail.Helper;
using NMail.ImapService.Configuration;
-using NMail.LocalStoreData.MySql;
-using NMail.LocalStoreData.MySql.Configuration;
+using NMail.LocalStoreData.NHibernate;
namespace NMail.SetupWizard {
public partial class LocalStoreConfigPanel : BasePanel {
@@ -41,7 +40,7 @@
// If any of these are present consider it all enabled
if (ImapServiceConfiguration.ConfigurationPresent
- || MySqlLocalStoreDataConfiguration.ConfigurationPresent) {
+ || NMail.LocalStoreData.NHibernate.Configuration.ConfigurationPresent) {
this.enableLocalStoreSubSysBox.Checked = true;
@@ -50,7 +49,7 @@
// Ensure the rest are there
ImapServiceConfiguration.AddToConfigFile();
- MySqlLocalStoreDataConfiguration.AddToConfigFile();
+ NMail.LocalStoreData.NHibernate.Configuration.AddToConfigFile();
}
if (this.enableLocalStoreSubSysBox.Checked) {
@@ -81,7 +80,7 @@
/// <returns>The result of the attempt to create the tables.</returns>
private TaskResult makeStoreTables(out string message) {
try {
- MySqlHelper.RunScript("MySqlLocalStore.sql");
+ NMailConfiguration.Current.LocalStoreData.ReinstallSchema();
message = null;
return TaskResult.Ok;
@@ -120,10 +119,10 @@
if (this.enableLocalStoreSubSysBox.Checked) {
// Ensure our config sections are there
ImapServiceConfiguration.AddToConfigFile();
- MySqlLocalStoreDataConfiguration.AddToConfigFile();
+ NMail.LocalStoreData.NHibernate.Configuration.AddToConfigFile();
ImapServiceConfiguration isc = ImapServiceConfiguration.Current;
- MySqlLocalStoreDataConfiguration mlsdc = MySqlLocalStoreDataConfiguration.Current;
+ NMail.LocalStoreData.NHibernate.Configuration nhc = NMail.LocalStoreData.NHibernate.Configuration.Current;
// Ensure the IMAP service is in the list of services
bool foundImapService = false;
@@ -165,14 +164,14 @@
if (!foundLocalStoreData) {
NamedServiceElement service = new NamedServiceElement();
service.Name = "LocalStoreData";
- service.ObjectType = typeof(MySqlLocalStoreData);
+ service.ObjectType = typeof(NMail.LocalStoreData.NHibernate.NHibernateLocalStoreData);
nc.NamedServiceDetails.Add(service);
}
if (!foundAuthProvider) {
NamedServiceElement service = new NamedServiceElement();
service.Name = "AuthProvider";
- service.ObjectType = typeof(MySqlAuthProvider);
+ service.ObjectType = typeof(NMail.LocalStoreData.NHibernate.NHibernateAuthProvider);
nc.NamedServiceDetails.Add(service);
}
@@ -197,7 +196,7 @@
} else {
// Remove the configuration
ImapServiceConfiguration.RemoveFromConfigFile();
- MySqlLocalStoreDataConfiguration.RemoveFromConfigFile();
+ NMail.LocalStoreData.NHibernate.Configuration.RemoveFromConfigFile();
// Ensure the IMAP service is not in the list of services
for (int i = 0; i < nc.ServiceDetails.Count; i++) {
@@ -225,7 +224,7 @@
private void loadConfiguration() {
ImapServiceConfiguration isc = ImapServiceConfiguration.Current;
- MySqlLocalStoreDataConfiguration mlsdc = MySqlLocalStoreDataConfiguration.Current;
+ NMail.LocalStoreData.NHibernate.Configuration nhc = NMail.LocalStoreData.NHibernate.Configuration.Current;
// Populate the widgets with the current config
this.visibleHostTextBox.Text = isc.VisibleHost.ToString();
Deleted: NMail/trunk/NMail.SetupWizard/MySqlHelper.cs
===================================================================
--- NMail/trunk/NMail.SetupWizard/MySqlHelper.cs 2007-05-08 13:20:38 UTC (rev 190)
+++ NMail/trunk/NMail.SetupWizard/MySqlHelper.cs 2007-05-09 12:56:42 UTC (rev 191)
@@ -1,133 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Text;
-using System.Windows.Forms;
-
-using MySql.Data.MySqlClient;
-
-namespace NMail.SetupWizard {
- public static class MySqlHelper {
-
- private static PasswordDialog passwordDialog = new PasswordDialog();
-
- static MySqlHelper() {
- Username = "root";
- Password = string.Empty;
- DatabaseHost = "localhost";
- }
-
- private static string host;
-
- /// <summary>
- /// The host that the helper will connect to.
- /// </summary>
- public static string DatabaseHost {
- get {
- return host;
- }
- set {
- host = value;
- passwordDialog.ConnectionLabel = "Connecting to MySql on " + host;
- }
- }
-
- /// <summary>
- /// The username to connect with.
- /// </summary>
- public static string Username {
- get {
- return passwordDialog.Username;
- }
- set {
- passwordDialog.Username = value;
- }
- }
-
- /// <summary>
- /// The password to connect with.
- /// </summary>
- public static string Password {
- get {
- return passwordDialog.Password;
- }
- set {
- passwordDialog.Password = value;
- }
- }
-
- private static MySqlConnection GetConnection() {
- while (true) {
- MySqlConnection cnn = new MySqlConnection();
- cnn.ConnectionString = string.Format(
- "Host={0};Database=mysql;Username={1};Password={2}",
- DatabaseHost,
- Username,
- Password);
-
- try {
- cnn.Open();
- return cnn;
-
- } catch (MySqlException) { }
-
- DialogResult dialogResult = passwordDialog.ShowDialog();
-
- if (dialogResult == DialogResult.Cancel) {
- throw new InvalidOperationException("MySql login cancelled by user.");
- }
- }
- }
-
- public static void CreateDatabase(string databaseName) {
- MySqlConnection cnn = GetConnection();
-
- MySqlCommand cmd = cnn.CreateCommand();
- cmd.CommandText = "CREATE DATABASE ?Database";
- cmd.Parameters.Add("?Database", databaseName);
-
- cmd.ExecuteNonQuery();
- }
-
- /// <summary>
- /// Grants privileges on a database to a user.
- /// </summary>
- /// <remarks><b>WARNING:</b> The strings used in this function are not
- /// checked for SQL injection attacks. Only use input from a trusted
- /// source!</remarks>
- public static void GrantPrivileges(string username, string database, string privileges) {
- MySqlConnection cnn = GetConnection();
-
- string cmdText = string.Format("GRANT {0} ON {1} TO {2}", privileges, database, username);
-
- MySqlCommand cmd = cnn.CreateCommand();
- cmd.CommandText = cmdText;
-
- cmd.ExecuteNonQuery();
- }
-
- public static void CreateUser(string username, string password) {
- MySqlConnection cnn = GetConnection();
-
- MySqlCommand cmd = cnn.CreateCommand();
- cmd.CommandText = "CREATE USER ?User IDENTIFIED BY ?Password";
- cmd.Parameters.Add("?User", username);
- cmd.Parameters.Add("?Password", password);
-
- cmd.ExecuteNonQuery();
- }
-
- public static void RunScript(string scriptFile) {
- FileStream fs = File.Open(scriptFile, FileMode.Open);
- StreamReader reader = new StreamReader(fs);
- string scriptData = reader.ReadToEnd();
-
- MySqlConnection cnn = GetConnection();
- MySqlCommand cmd = cnn.CreateCommand();
-
- cmd.CommandText = scriptData;
-
- cmd.ExecuteNonQuery();
- }
- }
-}
Modified: NMail/trunk/NMail.SetupWizard/NMail.SetupWizard.csproj
===================================================================
--- NMail/trunk/NMail.SetupWizard/NMail.SetupWizard.csproj 2007-05-08 13:20:38 UTC (rev 190)
+++ NMail/trunk/NMail.SetupWizard/NMail.SetupWizard.csproj 2007-05-09 12:56:42 UTC (rev 191)
@@ -28,10 +28,6 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
- <Reference Include="MySql.Data, Version=1.0.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\References\MySql.Data.dll</HintPath>
- </Reference>
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Data" />
@@ -78,7 +74,6 @@
<Compile Include="LocalStoreConfigPanel.Designer.cs">
<DependentUpon>LocalStoreConfigPanel.cs</DependentUpon>
</Compile>
- <Compile Include="MySqlHelper.cs" />
<Compile Include="PasswordDialog.cs">
<SubType>Form</SubType>
</Compile>
@@ -175,9 +170,9 @@
<Project>{A6C6E9C2-5A17-4E00-9CE7-550C0359E023}</Project>
<Name>NMail.ImapService</Name>
</ProjectReference>
- <ProjectReference Include="..\NMail.LocalStoreData.MySql\NMail.LocalStoreData.MySql.csproj">
- <Project>{90B33C2B-F945-478A-BBA0-4F66EF78B870}</Project>
- <Name>NMail.LocalStoreData.MySql</Name>
+ <ProjectReference Include="..\NMail.LocalStoreData.NHibernate\NMail.LocalStoreData.NHibernate.csproj">
+ <Project>{72F7E307-F0A9-4750-9ED5-5A1F97725A11}</Project>
+ <Name>NMail.LocalStoreData.NHibernate</Name>
</ProjectReference>
<ProjectReference Include="..\NMail.LocalStore\NMail.LocalStore.csproj">
<Project>{488A8890-EEE1-4ACC-9B35-3DDBE8E70D1D}</Project>
@@ -195,9 +190,9 @@
<Project>{AEFF4DA8-7243-44C2-8223-69035380B042}</Project>
<Name>NMail.SmtpService</Name>
</ProjectReference>
- <ProjectReference Include="..\NMail.SpoolData.MySql\NMail.SpoolData.MySql.csproj">
- <Project>{68D6D57F-02CC-419F-8D69-3B479A1BFBED}</Project>
- <Name>NMail.SpoolData.MySql</Name>
+ <ProjectReference Include="..\NMail.SpoolData.NHibernate\NMail.SpoolData.NHibernate.csproj">
+ <Project>{A5EAEF38-D326-40B0-A51F-8A96D0621EEC}</Project>
+ <Name>NMail.SpoolData.NHibernate</Name>
</ProjectReference>
<ProjectReference Include="..\NMail.SpoolFilter\NMail.SpoolFilter.csproj">
<Project>{1C585C54-6FE4-47F5-9A1F-8437F412DCF5}</Project>
@@ -233,7 +228,7 @@
</Target>
-->
<PropertyGroup>
- <PostBuildEvent>copy /y "$(SolutionDir)NMail.SpoolData.MySql\*.sql" "$(ProjectDir)$(OutDir)"
-copy /y "$(SolutionDir)NMail.LocalStoreData.MySql\*.sql" "$(ProjectDir)$(OutDir)"</PostBuildEvent>
+ <PostBuildEvent>
+ </PostBuildEvent>
</PropertyGroup>
</Project>
\ No newline at end of file
Modified: NMail/trunk/NMail.SetupWizard/SmtpSubSysConfigPanel.cs
===================================================================
--- NMail/trunk/NMail.SetupWizard/SmtpSubSysConfigPanel.cs 2007-05-08 13:20:38 UTC (rev 190)
+++ NMail/trunk/NMail.SetupWizard/SmtpSubSysConfigPanel.cs 2007-05-09 12:56:42 UTC (rev 191)
@@ -28,7 +28,6 @@
using NMail.MessageRouter.Configuration;
using NMail.SmtpClient.Configuration;
using NMail.SmtpService.Configuration;
-using NMail.SpoolData.MySql;
using NMail.SpoolFilter.Configuration;
using NMail.SpoolService.Configuration;
@@ -86,7 +85,7 @@
/// <returns>The result of the attempt to create the tables.</returns>
private TaskResult makeSpoolTables(out string message) {
try {
- MySqlHelper.RunScript("MySqlSpoolData.sql");
+ NMailConfiguration.Current.SpoolData.ReinstallSchema();
message = null;
return TaskResult.Ok;
@@ -180,7 +179,7 @@
if (!foundSpoolData) {
NamedServiceElement service = new NamedServiceElement();
service.Name = "SpoolData";
- service.ObjectType = typeof(MySqlSpoolData);
+ service.ObjectType = typeof(NMail.SpoolData.NHibernate.NHibernateSpoolData);
nc.NamedServiceDetails.Add(service);
}
Modified: NMail/trunk/NMail.sln
===================================================================
--- NMail/trunk/NMail.sln 2007-05-08 13:20:38 UTC (rev 190)
+++ NMail/trunk/NMail.sln 2007-05-09 12:56:42 UTC (rev 191)
@@ -34,8 +34,6 @@
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NMail.UnitTests", "NMail.UnitTests\NMail.UnitTests.csproj", "{ED0957A8-FB7C-496B-8301-7A15842A3F01}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NMail.Administration.Console", "NMail.Administration.Console\NMail.Administration.Console.csproj", "{93F9B202-EB30-4FF8-B10F-BD45FD3B7E9F}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NMail.PostInstall", "NMail.PostInstall\NMail.PostInstall.csproj", "{906413B5-1C7D-4072-B5CF-FDCED1F6CA7C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NMail.SetupWizard", "NMail.SetupWizard\NMail.SetupWizard.csproj", "{DDE40B82-A5D9-4BE4-997B-C7EF3FFF5EBD}"
@@ -48,8 +46,6 @@
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NMail.LocalStoreData.NHibernate", "NMail.LocalStoreData.NHibernate\NMail.LocalStoreData.NHibernate.csproj", "{72F7E307-F0A9-4750-9ED5-5A1F97725A11}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NMail.SpoolData.MySql", "NMail.SpoolData.MySql\NMail.SpoolData.MySql.csproj", "{68D6D57F-02CC-419F-8D69-3B479A1BFBED}"
-EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -194,14 +190,6 @@
{ED0957A8-FB7C-496B-8301-7A15842A3F01}.Release|Any CPU.Build.0 = Release|Any CPU
{ED0957A8-FB7C-496B-8301-7A15842A3F01}.Release2005|Any CPU.ActiveCfg = Release|Any CPU
{ED0957A8-FB7C-496B-8301-7A15842A3F01}.Release2005|Any CPU.Build.0 = Release|Any CPU
- {93F9B202-EB30-4FF8-B10F-BD45FD3B7E9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {93F9B202-EB30-4FF8-B10F-BD45FD3B7E9F}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {93F9B202-EB30-4FF8-B10F-BD45FD3B7E9F}.Debug2005|Any CPU.ActiveCfg = Debug|Any CPU
- {93F9B202-EB30-4FF8-B10F-BD45FD3B7E9F}.Debug2005|Any CPU.Build.0 = Debug|Any CPU
- {93F9B202-EB30-4FF8-B10F-BD45FD3B7E9F}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {93F9B202-EB30-4FF8-B10F-BD45FD3B7E9F}.Release|Any CPU.Build.0 = Release|Any CPU
- {93F9B202-EB30-4FF8-B10F-BD45FD3B7E9F}.Release2005|Any CPU.ActiveCfg = Release|Any CPU
- {93F9B202-EB30-4FF8-B10F-BD45FD3B7E9F}.Release2005|Any CPU.Build.0 = Release|Any CPU
{906413B5-1C7D-4072-B5CF-FDCED1F6CA7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{906413B5-1C7D-4072-B5CF-FDCED1F6CA7C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{906413B5-1C7D-4072-B5CF-FDCED1F6CA7C}.Debug2005|Any CPU.ActiveCfg = Debug|Any CPU
@@ -250,14 +238,6 @@
{72F7E307-F0A9-4750-9ED5-5A1F97725A11}.Release|Any CPU.Build.0 = Release|Any CPU
{72F7E307-F0A9-4750-9ED5-5A1F97725A11}.Release2005|Any CPU.ActiveCfg = Release|Any CPU
{72F7E307-F0A9-4750-9ED5-5A1F97725A11}.Release2005|Any CPU.Build.0 = Release|Any CPU
- {68D6D57F-02CC-419F-8D69-3B479A1BFBED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {68D6D57F-02CC-419F-8D69-3B479A1BFBED}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {68D6D57F-02CC-419F-8D69-3B479A1BFBED}.Debug2005|Any CPU.ActiveCfg = Debug|Any CPU
- {68D6D57F-02CC-419F-8D69-3B479A1BFBED}.Debug2005|Any CPU.Build.0 = Debug|Any CPU
- {68D6D57F-02CC-419F-8D69-3B479A1BFBED}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {68D6D57F-02CC-419F-8D69-3B479A1BFBED}.Release|Any CPU.Build.0 = Release|Any CPU
- {68D6D57F-02CC-419F-8D69-3B479A1BFBED}.Release2005|Any CPU.ActiveCfg = Release|Any CPU
- {68D6D57F-02CC-419F-8D69-3B479A1BFBED}.Release2005|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2007-05-08 13:20:37
|
Revision: 190
http://svn.sourceforge.net/nmailserver/?rev=190&view=rev
Author: tmyroadctfig
Date: 2007-05-08 06:20:38 -0700 (Tue, 08 May 2007)
Log Message:
-----------
Work on ACLs and calendars.
Modified Paths:
--------------
NMail/trunk/NMail/DataTypes/Calendar/CalendarEntry.cs
NMail/trunk/NMail/DataTypes/LocalStore/ILocalStore.cs
NMail/trunk/NMail/DataTypes/LocalStore/ILocalStoreData.cs
NMail/trunk/NMail/NMail.csproj
NMail/trunk/NMail.LocalStore/LocalStore.cs
NMail/trunk/NMail.LocalStoreData.NHibernate/NHibernateLocalStoreData.cs
NMail/trunk/NMail.LocalStoreData.NHibernate/NMail.LocalStoreData.NHibernate.csproj
NMail/trunk/NMail.Server.Console/NMail.Server.Console.csproj
NMail/trunk/NMail.Server.Service/NMail.Server.Service.csproj
NMail/trunk/NMail.UnitTests/LocalStoreData/CreateCalendarTest1.cs
NMail/trunk/NMail.UnitTests/LocalStoreData/CreateCalendarTest2.cs
NMail/trunk/NMail.UnitTests/LocalStoreData/CreateEventEntryTest1.cs
NMail/trunk/NMail.UnitTests/NMail.UnitTests.csproj
NMail/trunk/NMail.sln
Added Paths:
-----------
NMail/trunk/NMail.LocalStoreData.NHibernate/InternalUserGroupAdminAce.cs
NMail/trunk/NMail.LocalStoreData.NHibernate/Mappings/NMail.LocalStoreData.NHibernate.InternalUserGroupAdminAce.hbm.xml
NMail/trunk/NMail.UnitTests/LocalStoreData/GetSetRemoveUserGroupAdminAceTest1.cs
Removed Paths:
-------------
NMail/trunk/NMail/DataTypes/LocalStore/LocalStoreCalendarResult.cs
Modified: NMail/trunk/NMail/DataTypes/Calendar/CalendarEntry.cs
===================================================================
--- NMail/trunk/NMail/DataTypes/Calendar/CalendarEntry.cs 2007-05-08 11:35:52 UTC (rev 189)
+++ NMail/trunk/NMail/DataTypes/Calendar/CalendarEntry.cs 2007-05-08 13:20:38 UTC (rev 190)
@@ -77,7 +77,7 @@
#region Date/Time Properties
- private DateTime startTime;
+ private DateTime startTime = DateTime.Now;
/// <summary>
/// The time the event starts. (iCal "DTSTART")
@@ -163,7 +163,7 @@
// TODO: exdate, exrule
- private DateTime recurrenceId;
+ private DateTime recurrenceId = DateTime.Now;
/// <summary>
/// The recurrence Id for this recurrence of the entry. (iCal "RECURRENCE-ID-")
@@ -176,7 +176,7 @@
#region Change Management Component Properties
- private DateTime created;
+ private DateTime created = DateTime.Now;
/// <summary>
/// The date/time the entry was created. (iCal "CREATED")
@@ -186,7 +186,7 @@
set { created = value; }
}
- private DateTime timeStamp;
+ private DateTime timeStamp = DateTime.Now;
/// <summary>
/// The date/time this instance was created. (iCal "DTSTAMP")
@@ -196,7 +196,7 @@
set { timeStamp = value; }
}
- private DateTime lastModified;
+ private DateTime lastModified = DateTime.Now;
/// <summary>
/// The date/time the event was last modified. (iCal "LAST-MODIFIED")
Modified: NMail/trunk/NMail/DataTypes/LocalStore/ILocalStore.cs
===================================================================
--- NMail/trunk/NMail/DataTypes/LocalStore/ILocalStore.cs 2007-05-08 11:35:52 UTC (rev 189)
+++ NMail/trunk/NMail/DataTypes/LocalStore/ILocalStore.cs 2007-05-08 13:20:38 UTC (rev 190)
@@ -576,12 +576,99 @@
void RemoveAdministrationAce(IAuthenticationToken authToken, string identifier);
#endregion
- LocalStoreCalendarResult CreateCalandar(IAuthenticationToken authToken, Calendar.Calendar calendar);
+ #region Calendar Manipulation
+ /// <summary>
+ /// Creates a new calendar.
+ /// </summary>
+ /// <param name="calendar">The calendar to create.</param>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <exception cref="System.Data.DuplicateNameException">If a calendar with the same name already exists.</exception>
+ /// <exception cref="System.InvalidOperationException">Changes to the calendar are not permitted.</exception>
+ /// <exception cref="System.ArgumentException">The calendar is invalid.</exception>
+ void CreateCalandar(IAuthenticationToken authToken, Calendar.Calendar calendar);
+ /// <summary>
+ /// Gets the calendar for the given name.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="name">The name to look up.</param>
+ /// <returns>The matching calendar or null if non is found.</returns>
Calendar.Calendar GetCalandar(IAuthenticationToken authToken, string name, int parentFolderId);
+ /// <summary>
+ /// Gets the calendar for the given calendar Id.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="calendarId">The Id of the calendar to look up.</param>
+ /// <returns>The matching calendar or null if non is found.</returns>
Calendar.Calendar GetCalandar(IAuthenticationToken authToken, int calendarId);
- LocalStoreCalendarResult DeleteCalandar(IAuthenticationToken authToken, int calendarId);
+ /// <summary>
+ /// Updates an existing calendar.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="calendar">The calendar to update.</param>
+ /// <exception cref="System.Data.DuplicateNameException">If a calendar with the same name already exists.</exception>
+ /// <exception cref="System.InvalidOperationException">Changes to the calendar are not permitted.</exception>
+ /// <exception cref="System.ArgumentException">The calendar is invalid.</exception>
+ void UpdateCalandar(IAuthenticationToken authToken, Calendar.Calendar calendar);
+
+ /// <summary>
+ /// Removes a calendar from the local store.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="calendarId">The Id of the calendar to delete.</param>
+ /// <exception cref="System.InvalidOperationException">Changes to the calendar are not permitted.</exception>
+ /// <exception cref="System.ArgumentException">The calendar is invalid.</exception>
+ /// <exception cref="System.Data.ConstraintException">Calendar still has entries.</exception>
+ void DeleteCalandar(IAuthenticationToken authToken, int calendarId);
+ #endregion
+
+ #region Calendar Entry Manipulation
+ /// <summary>
+ /// Creates a new calendar entry.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="entry">The entry to create.</param>
+ void CreateCalendarEntry(IAuthenticationToken authToken, CalendarEntry entry);
+
+ /// <summary>
+ /// Gets the entry for the given Id.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="entryId">The entry Id to look up.</param>
+ /// <returns>The entry or null.</returns>
+ CalendarEntry GetCalendarEntry(IAuthenticationToken authToken, int entryId);
+
+ /// <summary>
+ /// Updates the given entry.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="entry">The entry to update.</param>
+ /// <param name="calendarId">The Id of the calendar to delete.</param>
+ /// <exception cref="System.InvalidOperationException">Changes to the calendar are not permitted.</exception>
+ /// <exception cref="System.ArgumentException">The calendar is invalid.</exception>
+ /// <exception cref="System.Data.ConstraintException">Calendar still has entries.</exception>
+ void UpdateCalendarEntry(IAuthenticationToken authToken, CalendarEntry entry);
+
+ /// <summary>
+ /// Gets a list of calendar entries.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="startTime">The start time for the entries returned.</param>
+ /// <param name="endTime">The end time for the entries returned.</param>
+ /// <param name="calendarId">The Id of the calendar to look in.</param>
+ /// <returns>The list of entries</returns>
+ IList<CalendarEntry> GetCalendarEntries(IAuthenticationToken authToken, DateTime startTime, DateTime endTime, int calendarId);
+
+ /// <summary>
+ /// Removes a calendar entry from the local store.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="entryId">The Id of the calendar entry to delete.</param>
+ /// <exception cref="System.InvalidOperationException">Changes to the calendar entry are not permitted.</exception>
+ /// <exception cref="System.ArgumentException">The calendar entry is invalid.</exception>
+ void DeleteCalendarEntry(IAuthenticationToken authToken, int entryId);
+ #endregion
}
}
Modified: NMail/trunk/NMail/DataTypes/LocalStore/ILocalStoreData.cs
===================================================================
--- NMail/trunk/NMail/DataTypes/LocalStore/ILocalStoreData.cs 2007-05-08 11:35:52 UTC (rev 189)
+++ NMail/trunk/NMail/DataTypes/LocalStore/ILocalStoreData.cs 2007-05-08 13:20:38 UTC (rev 190)
@@ -463,23 +463,110 @@
GenericAcl<SystemPrivilege> GetSystemPrivilegeAcl();
#endregion
+ #region User/Group Admin ACL
+ /// <summary>
+ /// Sets the user/group admin privileges for the associated identifier. If no ACE exists for
+ /// the associated identifier one is added.
+ /// </summary>
+ /// <param name="ace">The privileges and the identifier to put.</param>
+ void SetUserGroupAdminPrivilegeAce(GenericAce<UserGroupAdminPrivilege> ace);
+
+ /// <summary>
+ /// Removes any ACE associated with the given identifier.
+ /// </summary>
+ /// <param name="identifier">The identifier to remove from the ACL.</param>
+ void RemoveUserGroupAdminPrivilegeAce(string identifier);
+
+ /// <summary>
+ /// Gets the user/group admin ACL.
+ /// </summary>
+ /// <returns>The user/group admin ACL.</returns>
+ GenericAcl<UserGroupAdminPrivilege> GetUserGroupAdminPrivilegeAcl();
+ #endregion
+
#region Calendar Manipulation
+ /// <summary>
+ /// Creates a new calendar.
+ /// </summary>
+ /// <param name="calendar">The calendar to create.</param>
+ /// <exception cref="System.Data.DuplicateNameException">If a calendar with the same name already exists.</exception>
+ /// <exception cref="System.InvalidOperationException">Changes to the calendar are not permitted.</exception>
+ /// <exception cref="System.ArgumentException">The calendar is invalid.</exception>
+ void CreateCalandar(Calendar.Calendar calendar);
- void SaveCalandar(Calendar.Calendar calendar);
-
+ /// <summary>
+ /// Gets the calendar for the given name.
+ /// </summary>
+ /// <param name="name">The name to look up.</param>
+ /// <returns>The matching calendar or null if non is found.</returns>
Calendar.Calendar GetCalandar(string name, int parentFolderId);
+ /// <summary>
+ /// Gets the calendar for the given calendar Id.
+ /// </summary>
+ /// <param name="calendarId">The Id of the calendar to look up.</param>
+ /// <returns>The matching calendar or null if non is found.</returns>
Calendar.Calendar GetCalandar(int calendarId);
+ /// <summary>
+ /// Updates an existing calendar.
+ /// </summary>
+ /// <param name="calendar">The calendar to update.</param>
+ /// <exception cref="System.Data.DuplicateNameException">If a calendar with the same name already exists.</exception>
+ /// <exception cref="System.InvalidOperationException">Changes to the calendar are not permitted.</exception>
+ /// <exception cref="System.ArgumentException">The calendar is invalid.</exception>
+ void UpdateCalandar(Calendar.Calendar calendar);
+
+ /// <summary>
+ /// Removes a calendar from the local store.
+ /// </summary>
+ /// <param name="calendarId">The Id of the calendar to delete.</param>
+ /// <exception cref="System.InvalidOperationException">Changes to the calendar are not permitted.</exception>
+ /// <exception cref="System.ArgumentException">The calendar is invalid.</exception>
+ /// <exception cref="System.Data.ConstraintException">Calendar still has entries.</exception>
void DeleteCalandar(int calendarId);
#endregion
- void SaveCalendarEntry(CalendarEntry entry);
+ #region Calendar Entry Manipulation
+ /// <summary>
+ /// Creates a new calendar entry.
+ /// </summary>
+ /// <param name="entry">The entry to create.</param>
+ void CreateCalendarEntry(CalendarEntry entry);
+ /// <summary>
+ /// Gets the entry for the given Id.
+ /// </summary>
+ /// <param name="entryId">The entry Id to look up.</param>
+ /// <returns>The entry or null.</returns>
CalendarEntry GetCalendarEntry(int entryId);
+ /// <summary>
+ /// Updates the given entry.
+ /// </summary>
+ /// <param name="entry">The entry to update.</param>
+ /// <param name="calendarId">The Id of the calendar to delete.</param>
+ /// <exception cref="System.InvalidOperationException">Changes to the calendar are not permitted.</exception>
+ /// <exception cref="System.ArgumentException">The calendar is invalid.</exception>
+ /// <exception cref="System.Data.ConstraintException">Calendar still has entries.</exception>
+ void UpdateCalendarEntry(CalendarEntry entry);
+
+ /// <summary>
+ /// Gets a list of calendar entries.
+ /// </summary>
+ /// <param name="startTime">The start time for the entries returned.</param>
+ /// <param name="endTime">The end time for the entries returned.</param>
+ /// <param name="calendarId">The Id of the calendar to look in.</param>
+ /// <returns>The list of entries</returns>
IList<CalendarEntry> GetCalendarEntries(DateTime startTime, DateTime endTime, int calendarId);
+ /// <summary>
+ /// Removes a calendar entry from the local store.
+ /// </summary>
+ /// <param name="entryId">The Id of the calendar entry to delete.</param>
+ /// <exception cref="System.InvalidOperationException">Changes to the calendar entry are not permitted.</exception>
+ /// <exception cref="System.ArgumentException">The calendar entry is invalid.</exception>
void DeleteCalendarEntry(int entryId);
+ #endregion
}
}
Deleted: NMail/trunk/NMail/DataTypes/LocalStore/LocalStoreCalendarResult.cs
===================================================================
--- NMail/trunk/NMail/DataTypes/LocalStore/LocalStoreCalendarResult.cs 2007-05-08 11:35:52 UTC (rev 189)
+++ NMail/trunk/NMail/DataTypes/LocalStore/LocalStoreCalendarResult.cs 2007-05-08 13:20:38 UTC (rev 190)
@@ -1,29 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace NMail.DataTypes.LocalStore {
- public enum LocalStoreCalendarResult {
- /// <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 operation failed because the parent 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 = 2,
-
- /// <summary>
- /// The user is not permitted to perform the operation.
- /// </summary>
- NotPermitted = 2
- }
-}
Modified: NMail/trunk/NMail/NMail.csproj
===================================================================
--- NMail/trunk/NMail/NMail.csproj 2007-05-08 11:35:52 UTC (rev 189)
+++ NMail/trunk/NMail/NMail.csproj 2007-05-08 13:20:38 UTC (rev 190)
@@ -149,7 +149,6 @@
<Compile Include="DataTypes\Calendar\ToDoEntry.cs" />
<Compile Include="DataTypes\Classification.cs" />
<Compile Include="DataTypes\LatLong.cs" />
- <Compile Include="DataTypes\LocalStore\LocalStoreCalendarResult.cs" />
<Compile Include="DataTypes\Message\IMultipartMessageBody.cs" />
<Compile Include="DataTypes\Service\BaseService.cs" />
<Compile Include="DataTypes\Service\BaseSession.cs" />
Modified: NMail/trunk/NMail.LocalStore/LocalStore.cs
===================================================================
--- NMail/trunk/NMail.LocalStore/LocalStore.cs 2007-05-08 11:35:52 UTC (rev 189)
+++ NMail/trunk/NMail.LocalStore/LocalStore.cs 2007-05-08 13:20:38 UTC (rev 190)
@@ -37,9 +37,7 @@
/// clients.
/// </summary>
public class LocalStore : MarshalByRefObject, ILocalStore {
-
- // TODO: check with AuthProvider that AuthTokens are valid
-
+
#region ILocalStore Members
#region Delivery & Validation
@@ -419,9 +417,13 @@
/// <param name="authToken">The authentication credentials.</param>
/// <returns>The list of folders.</returns>
public IList<StoreFolder> GetFolders(IAuthenticationToken authToken) {
- // TODO: check for admin ACLs
- return LocalStoreData.GetFolders();
+ // Only show all folders to administrators
+ if (hasSystemPrivilege(authToken.Username, SystemPrivilege.EditAllAcls)) {
+ return LocalStoreData.GetFolders();
+ }
+
+ return new List<StoreFolder>();
}
#region Move Folder
@@ -472,8 +474,7 @@
/// <returns>The list of matching folders.</returns>
public IList<StoreFolder> GetMatching(IAuthenticationToken authToken, string queryFolder) {
// TODO: handle wildcards in the middle of mailbox names, e.g "A*" matches "Ab" and "Ac.d"
- // TODO: filter out any folders that the user can't see due to ACLs
-
+
StoreFolder resolvedFolder = GetStoreFolder(authToken, queryFolder);
List<StoreFolder> result = new List<StoreFolder>();
if (resolvedFolder != GetNominalStoreFolder(authToken)) {
@@ -483,6 +484,19 @@
// Get descendant folders
GetDescendants(authToken, resolvedFolder, result);
+ // Filter out any folders that the user can't see due to ACLs
+ List<StoreFolder> removeList = new List<StoreFolder>();
+
+ for (int i = 0; i < result.Count; i++) {
+ if (!hasFolderPrivilege(authToken.Username, result[i].FolderId, StoreFolderPrivilege.Lookup)) {
+ removeList.Add(result[i]);
+ }
+ }
+
+ foreach (StoreFolder folder in removeList) {
+ result.Remove(folder);
+ }
+
// Return the list of matching folders
return result;
}
@@ -1009,49 +1023,79 @@
#region User Management
- // TODO: ACLs for user management!!!
public LocalStoreUser GetUser(IAuthenticationToken authToken, string username) {
- return LocalStoreData.GetUser(username);
+ if (hasUserGroupPrivilege(authToken.Username, UserGroupAdminPrivilege.ViewAllUsers)) {
+ return LocalStoreData.GetUser(username);
+ }
+
+ return null;
}
public LocalStoreUser GetUser(IAuthenticationToken authToken, int userId) {
- return LocalStoreData.GetUser(userId);
+ if (hasUserGroupPrivilege(authToken.Username, UserGroupAdminPrivilege.ViewAllUsers)) {
+ return LocalStoreData.GetUser(userId);
+ }
+
+ return null;
}
public IList<LocalStoreUser> GetUsers(IAuthenticationToken authToken) {
- return LocalStoreData.GetUsers();
+ if (hasUserGroupPrivilege(authToken.Username, UserGroupAdminPrivilege.ViewAllUsers)) {
+ return LocalStoreData.GetUsers();
+ }
+
+ return List<LocalStoreUser>();
}
public void CreateUser(IAuthenticationToken authToken, LocalStoreUser user) {
- LocalStoreData.CreateUser(user);
+ if (hasUserGroupPrivilege(authToken.Username, UserGroupAdminPrivilege.CreateUsers)) {
+ LocalStoreData.CreateUser(user);
+ } else {
+ throw new InvalidOperationException("Permission denied.");
+ }
}
public void DeleteUser(IAuthenticationToken authToken, int userId) {
- LocalStoreData.DeleteUser(userId);
+ if (hasUserGroupPrivilege(authToken.Username, UserGroupAdminPrivilege.DeleteUsers)) {
+ LocalStoreData.DeleteUser(userId);
+ } else {
+ throw new InvalidOperationException("Permission denied.");
+ }
}
public void UpdateUser(IAuthenticationToken authToken, LocalStoreUser user) {
- LocalStoreData.UpdateUser(user);
+ if (hasUserGroupPrivilege(authToken.Username, UserGroupAdminPrivilege.EditUsers)) {
+ LocalStoreData.UpdateUser(user);
+ } else {
+ throw new InvalidOperationException("Permission denied.");
+ }
}
public IList<EmailAddress> GetUserAddresses(IAuthenticationToken authToken, int userId) {
- List<EmailAddress> result = new List<EmailAddress>();
- IList<MailDomain> mailDomains = LocalStoreData.GetMailDomains();
- LocalStoreUser user = LocalStoreData.GetUser(userId);
- if (user != null) {
- foreach (MailDomain mailDomain in mailDomains) {
- foreach (ILocalStoreUserMap mapping in mailDomain.MailboxMappings) {
- IList<Mailbox> mailboxes = mapping.GetUserMailboxes(user.Username);
+ if (hasUserGroupPrivilege(authToken.Username, UserGroupAdminPrivilege.ViewAllUsers)) {
- foreach (Mailbox mailbox in mailboxes) {
- result.Add(new EmailAddress(mailbox, mailDomain.PrimaryHost));
+ List<EmailAddress> result = new List<EmailAddress>();
+ IList<MailDomain> mailDomains = LocalStoreData.GetMailDomains();
+ LocalStoreUser user = LocalStoreData.GetUser(userId);
+
+ if (user != null) {
+ foreach (MailDomain mailDomain in mailDomains) {
+ foreach (ILocalStoreUserMap mapping in mailDomain.MailboxMappings) {
+ IList<Mailbox> mailboxes = mapping.GetUserMailboxes(user.Username);
+
+ foreach (Mailbox mailbox in mailboxes) {
+ result.Add(new EmailAddress(mailbox, mailDomain.PrimaryHost));
+ }
}
}
}
+
+ return result;
+
+ } else {
+ throw new InvalidOperationException("Permission denied.");
}
-
- return result;
}
/// <summary>
@@ -1061,13 +1105,15 @@
/// <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>
public IList<StoreFolder> GetUserFolders(IAuthenticationToken authToken, int userId) {
- return this.LocalStoreData.GetUserFolders(userId);
+ if (hasUserGroupPrivilege(authToken.Username, UserGroupAdminPrivilege.ViewAllUsers)) {
+ return this.LocalStoreData.GetUserFolders(userId);
+ } else {
+ throw new InvalidOperationException("Permission denied.");
+ }
}
#endregion
#region Group Management
- // TODO: ACLs for group management!!!!
-
/// <summary>
/// Gets the group for the given name.
/// </summary>
@@ -1075,7 +1121,11 @@
/// <param name="name">The name to look up.</param>
/// <returns>The matching group or null if non is found.</returns>
public LocalStoreGroup GetGroup(IAuthenticationToken authToken, string name) {
- return LocalStoreData.GetGroup(name);
+ if (hasUserGroupPrivilege(authToken.Username, UserGroupAdminPrivilege.ViewAllGroups)) {
+ return LocalStoreData.GetGroup(name);
+ }
+
+ return null;
}
/// <summary>
@@ -1085,7 +1135,11 @@
/// <param name="groupId">The Id of the group to look up.</param>
/// <returns>The matching group or null if non is found.</returns>
public LocalStoreGroup GetGroup(IAuthenticationToken authToken, int groupId) {
- return LocalStoreData.GetGroup(groupId);
+ if (hasUserGroupPrivilege(authToken.Username, UserGroupAdminPrivilege.ViewAllGroups)) {
+ return LocalStoreData.GetGroup(groupId);
+ }
+
+ return null;
}
/// <summary>
@@ -1094,7 +1148,11 @@
/// <param name="authToken">The authentication credentials.</param>
/// <returns>The list of groups.</returns>
public IList<LocalStoreGroup> GetGroups(IAuthenticationToken authToken) {
- return LocalStoreData.GetGroups();
+ if (hasUserGroupPrivilege(authToken.Username, UserGroupAdminPrivilege.ViewAllGroups)) {
+ return LocalStoreData.GetGroups();
+ }
+
+ return new List<LocalStoreGroup>();
}
/// <summary>
@@ -1106,7 +1164,11 @@
/// <exception cref="System.InvalidOperationException">Changes to the group are not permitted.</exception>
/// <exception cref="System.ArgumentException">The group is invalid.</exception>
public void CreateGroup(IAuthenticationToken authToken, LocalStoreGroup group) {
- LocalStoreData.CreateGroup(group);
+ if (hasUserGroupPrivilege(authToken.Username, UserGroupAdminPrivilege.CreateGroups)) {
+ LocalStoreData.CreateGroup(group);
+ } else {
+ throw new InvalidOperationException("Permission denied.");
+ }
}
/// <summary>
@@ -1117,7 +1179,11 @@
/// <exception cref="System.InvalidOperationException">Changes to the group are not permitted.</exception>
/// <exception cref="System.ArgumentException">The user is invalid.</exception>
public void DeleteGroup(IAuthenticationToken authToken, int groupId) {
- LocalStoreData.DeleteGroup(groupId);
+ if (hasUserGroupPrivilege(authToken.Username, UserGroupAdminPrivilege.DeleteGroups)) {
+ LocalStoreData.DeleteGroup(groupId);
+ } else {
+ throw new InvalidOperationException("Permission denied.");
+ }
}
/// <summary>
@@ -1129,7 +1195,11 @@
/// <exception cref="System.InvalidOperationException">Changes to the group are not permitted.</exception>
/// <exception cref="System.ArgumentException">The group is invalid.</exception>
public void UpdateGroup(IAuthenticationToken authToken, LocalStoreGroup group) {
- LocalStoreData.UpdateGroup(group);
+ if (hasUserGroupPrivilege(authToken.Username, UserGroupAdminPrivilege.EditGroups)) {
+ LocalStoreData.UpdateGroup(group);
+ } else {
+ throw new InvalidOperationException("Permission denied.");
+ }
}
#endregion
@@ -1286,25 +1356,144 @@
}
#endregion
- public LocalStoreCalendarResult CreateCalandar(IAuthenticationToken authToken, Calendar calendar) {
- LocalStoreData.SaveCalandar(calendar);
- return LocalStoreCalendarResult.OkSuccessful;
+ #region Calendar Manipulation
+ /// <summary>
+ /// Creates a new calendar.
+ /// </summary>
+ /// <param name="calendar">The calendar to create.</param>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <exception cref="System.Data.DuplicateNameException">If a calendar with the same name already exists.</exception>
+ /// <exception cref="System.InvalidOperationException">Changes to the calendar are not permitted.</exception>
+ /// <exception cref="System.ArgumentException">The calendar is invalid.</exception>
+ public void CreateCalandar(IAuthenticationToken authToken, Calendar calendar) {
+ // TODO: check privileges!!
+
+ LocalStoreData.CreateCalandar(calendar);
}
+ /// <summary>
+ /// Gets the calendar for the given name.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="name">The name to look up.</param>
+ /// <returns>The matching calendar or null if non is found.</returns>
public Calendar GetCalandar(IAuthenticationToken authToken, string name, int parentFolderId) {
+ // TODO: check privileges!!
+
return LocalStoreData.GetCalandar(name, parentFolderId);
}
+ /// <summary>
+ /// Gets the calendar for the given calendar Id.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="calendarId">The Id of the calendar to look up.</param>
+ /// <returns>The matching calendar or null if non is found.</returns>
public Calendar GetCalandar(IAuthenticationToken authToken, int calendarId) {
+ // TODO: check privileges!!
+
return LocalStoreData.GetCalandar(calendarId);
}
- public LocalStoreCalendarResult DeleteCalandar(IAuthenticationToken authToken, int calendarId) {
+ /// <summary>
+ /// Updates an existing calendar.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="calendar">The calendar to update.</param>
+ /// <exception cref="System.Data.DuplicateNameException">If a calendar with the same name already exists.</exception>
+ /// <exception cref="System.InvalidOperationException">Changes to the calendar are not permitted.</exception>
+ /// <exception cref="System.ArgumentException">The calendar is invalid.</exception>
+ public void UpdateCalandar(IAuthenticationToken authToken, Calendar calendar) {
+ // TODO: check privileges!!
+
+ LocalStoreData.UpdateCalandar(calendar);
+ }
+
+ /// <summary>
+ /// Removes a calendar from the local store.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="calendarId">The Id of the calendar to delete.</param>
+ /// <exception cref="System.InvalidOperationException">Changes to the calendar are not permitted.</exception>
+ /// <exception cref="System.ArgumentException">The calendar is invalid.</exception>
+ /// <exception cref="System.Data.ConstraintException">Calendar still has entries.</exception>
+ public void DeleteCalandar(IAuthenticationToken authToken, int calendarId) {
+ // TODO: check privileges!!
+
LocalStoreData.DeleteCalandar(calendarId);
- return LocalStoreCalendarResult.OkSuccessful;
}
#endregion
+ #region Calendar Entry Manipulation
+ /// <summary>
+ /// Creates a new calendar entry.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="entry">The entry to create.</param>
+ public void CreateCalendarEntry(IAuthenticationToken authToken, CalendarEntry entry) {
+ // TODO: check privileges!!
+
+ LocalStoreData.CreateCalendarEntry(entry);
+ }
+
+ /// <summary>
+ /// Gets the entry for the given Id.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="entryId">The entry Id to look up.</param>
+ /// <returns>The entry or null.</returns>
+ public CalendarEntry GetCalendarEntry(IAuthenticationToken authToken, int entryId) {
+ // TODO: check privileges!!
+
+ return LocalStoreData.GetCalendarEntry(entryId);
+ }
+
+ /// <summary>
+ /// Updates the given entry.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="entry">The entry to update.</param>
+ /// <param name="calendarId">The Id of the calendar to delete.</param>
+ /// <exception cref="System.InvalidOperationException">Changes to the calendar are not permitted.</exception>
+ /// <exception cref="System.ArgumentException">The calendar is invalid.</exception>
+ /// <exception cref="System.Data.ConstraintException">Calendar still has entries.</exception>
+ public void UpdateCalendarEntry(IAuthenticationToken authToken, CalendarEntry entry) {
+ // TODO: check privileges!!
+
+ LocalStoreData.UpdateCalendarEntry(entry);
+ }
+
+ /// <summary>
+ /// Gets a list of calendar entries.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="startTime">The start time for the entries returned.</param>
+ /// <param name="endTime">The end time for the entries returned.</param>
+ /// <param name="calendarId">The Id of the calendar to look in.</param>
+ /// <returns>The list of entries</returns>
+ public IList<CalendarEntry> GetCalendarEntries(IAuthenticationToken authToken, DateTime startTime, DateTime endTime, int calendarId) {
+ // TODO: check privileges!!
+
+ return LocalStoreData.GetCalendarEntries(startTime, endTime, calendarId);
+ }
+
+ /// <summary>
+ /// Removes a calendar entry from the local store.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="entryId">The Id of the calendar entry to delete.</param>
+ /// <exception cref="System.InvalidOperationException">Changes to the calendar entry are not permitted.</exception>
+ /// <exception cref="System.ArgumentException">The calendar entry is invalid.</exception>
+ public void DeleteCalendarEntry(IAuthenticationToken authToken, int entryId) {
+ // TODO: check privileges!!
+
+ LocalStoreData.DeleteCalendarEntry(entryId);
+ }
+ #endregion
+ #endregion
+
+ // TODO: check with AuthProvider that AuthTokens are valid
+
#region Privilege Checks
// TODO: check group permissions
@@ -1387,7 +1576,38 @@
return true;
}
#endregion
+
+ #region Has User/Group Privilege
+ /// <summary>
+ /// Checks if a identifier has a user group admin privilege.
+ /// </summary>
+ /// <param name="identifier">The identifier to check.</param>
+ /// <param name="privilege">The privilege to check for.</param>
+ /// <returns>True if the user has the privilege.</returns>
+ private bool hasUserGroupPrivilege(string identifier, UserGroupAdminPrivilege privilege) {
+ if (privilege == UserGroupAdminPrivilege.None) {
+ // Anyone is allowed no privileges, even if they're not on the ACL! ;-)
+ return true;
+ }
+
+ GenericAcl<UserGroupAdminPrivilege> userGroupAdminAcl = LocalStoreData.GetUserGroupAdminPrivilegeAcl();
+ GenericAce<UserGroupAdminPrivilege> identifierAce = userGroupAdminAcl[identifier];
+
+ if (identifierAce == null) {
+ // Identifier isn't listed on the ACL
+ return false;
+ }
+
+ if ((identifierAce.AceType != AcePrivilegeType.Allow)
+ || ((identifierAce.Privilege & privilege) != privilege)) {
+ // Identifier doesn't have the required privilege
+ return false;
+ }
+
+ return true;
+ }
#endregion
+ #endregion
/// <summary>
/// The folder delimiter used by this local store.
Added: NMail/trunk/NMail.LocalStoreData.NHibernate/InternalUserGroupAdminAce.cs
===================================================================
--- NMail/trunk/NMail.LocalStoreData.NHibernate/InternalUserGroupAdminAce.cs (rev 0)
+++ NMail/trunk/NMail.LocalStoreData.NHibernate/InternalUserGroupAdminAce.cs 2007-05-08 13:20:38 UTC (rev 190)
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+using NMail.DataTypes.ACLs;
+using NMail.DataTypes.LocalStore;
+
+namespace NMail.LocalStoreData.NHibernate {
+
+ internal class InternalUserGroupAdminAce : GenericAce<UserGroupAdminPrivilege> {
+
+ internal InternalUserGroupAdminAce() { }
+
+ private int aceId;
+
+ /// <summary>
+ /// The Id of this system ACE.
+ /// </summary>
+ public int AceId {
+ get { return aceId; }
+ set { aceId = value; }
+ }
+ }
+}
Added: NMail/trunk/NMail.LocalStoreData.NHibernate/Mappings/NMail.LocalStoreData.NHibernate.InternalUserGroupAdminAce.hbm.xml
===================================================================
--- NMail/trunk/NMail.LocalStoreData.NHibernate/Mappings/NMail.LocalStoreData.NHibernate.InternalUserGroupAdminAce.hbm.xml (rev 0)
+++ NMail/trunk/NMail.LocalStoreData.NHibernate/Mappings/NMail.LocalStoreData.NHibernate.InternalUserGroupAdminAce.hbm.xml 2007-05-08 13:20:38 UTC (rev 190)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="NMail.LocalStoreData.NHibernate" assembly="NMail.LocalStoreData.NHibernate" default-lazy="false">
+
+ <class name="NMail.LocalStoreData.NHibernate.InternalUserGroupAdminAce" table="UserGroupAdminAce">
+ <id name="AceId" type="Int32" unsaved-value="0">
+ <column name="AceId" not-null="true"/>
+ <generator class="native" />
+ </id>
+
+ <property name="Identifier" not-null="true" unique="true"/>
+
+ <property name="AceType" not-null="true" unique="true"/>
+
+ <property name="Privilege" not-null="true" unique="true"/>
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Modified: NMail/trunk/NMail.LocalStoreData.NHibernate/NHibernateLocalStoreData.cs
===================================================================
--- NMail/trunk/NMail.LocalStoreData.NHibernate/NHibernateLocalStoreData.cs 2007-05-08 11:35:52 UTC (rev 189)
+++ NMail/trunk/NMail.LocalStoreData.NHibernate/NHibernateLocalStoreData.cs 2007-05-08 13:20:38 UTC (rev 190)
@@ -1575,24 +1575,48 @@
}
#endregion
- public void SaveCalandar(Calendar calendar) {
+ #region User/Group Admin ACL
+ /// <summary>
+ /// Sets the user/group admin privileges for the associated identifier. If no ACE exists for
+ /// the associated identifier one is added.
+ /// </summary>
+ /// <param name="ace">The privileges and the identifier to put.</param>
+ public void SetUserGroupAdminPrivilegeAce(GenericAce<UserGroupAdminPrivilege> ace) {
using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
- if (calendar.CalendarId == 0) {
- // Check if any other calendars with the same name exists in this folder
- ICriteria criteria = session.CreateCriteria(typeof(Calendar));
- criteria.Add(Expression.Like("Name", calendar.Name));
- criteria.Add(Expression.Eq("ParentFolderId", calendar.ParentFolderId));
- IList<Calendar> existing = criteria.List<Calendar>();
+ InternalUserGroupAdminAce userGroupAdminAce = session.CreateCriteria(typeof(InternalUserGroupAdminAce))
+ .Add(Expression.Eq("Identifier", ace.Identifier))
+ .UniqueResult<InternalUserGroupAdminAce>();
- if (existing.Count > 0) {
- throw new DuplicateNameException("Calendar with the same name already exists in this folder.");
- }
+ if (userGroupAdminAce == null) {
+ userGroupAdminAce = new InternalUserGroupAdminAce();
+ }
- session.Save(calendar);
+ userGroupAdminAce.AceType = ace.AceType;
+ userGroupAdminAce.Identifier = ace.Identifier;
+ userGroupAdminAce.Privilege = ace.Privilege;
- } else {
- session.Update(calendar);
+ session.SaveOrUpdate(userGroupAdminAce);
+
+ tx.Commit();
+ session.Close();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Removes any ACE associated with the given identifier.
+ /// </summary>
+ /// <param name="identifier">The identifier to remove from the ACL.</param>
+ public void RemoveUserGroupAdminPrivilegeAce(string identifier) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
+ using (ITransaction tx = session.BeginTransaction()) {
+ IList<InternalUserGroupAdminAce> userGroupAdminAcl = session.CreateCriteria(typeof(InternalUserGroupAdminAce))
+ .Add(Expression.Eq("Identifier", identifier))
+ .List<InternalUserGroupAdminAce>();
+
+ foreach (InternalUserGroupAdminAce ace in userGroupAdminAcl) {
+ session.Delete(ace);
}
tx.Commit();
@@ -1601,70 +1625,200 @@
}
}
+ /// <summary>
+ /// Gets the user/group admin ACL.
+ /// </summary>
+ /// <returns>The user/group admin ACL.</returns>
+ public GenericAcl<UserGroupAdminPrivilege> GetUserGroupAdminPrivilegeAcl() {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
+ IList<InternalUserGroupAdminAce> systemAcl = session.CreateCriteria(typeof(InternalUserGroupAdminAce))
+ .List<InternalUserGroupAdminAce>();
+
+ GenericAcl<UserGroupAdminPrivilege> result = new GenericAcl<UserGroupAdminPrivilege>();
+
+ foreach (InternalUserGroupAdminAce ace in systemAcl) {
+ result.SetAce(ace);
+ }
+
+ return result;
+ }
+ }
+ #endregion
+
+ #region Calendar Manipulation
+ /// <summary>
+ /// Creates a new calendar.
+ /// </summary>
+ /// <param name="calendar">The calendar to create.</param>
+ /// <exception cref="System.Data.DuplicateNameException">If a calendar with the same name already exists.</exception>
+ /// <exception cref="System.InvalidOperationException">Changes to the calendar are not permitted.</exception>
+ /// <exception cref="System.ArgumentException">The calendar is invalid.</exception>
+ public void CreateCalandar(Calendar calendar) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
+ using (ITransaction tx = session.BeginTransaction()) {
+ // Check if any other calendars with the same name exists in this folder
+ IList<Calendar> existing = session.CreateCriteria(typeof(Calendar))
+ .Add(Expression.Like("Name", calendar.Name))
+ .Add(Expression.Eq("ParentFolderId", calendar.ParentFolderId))
+ .List<Calendar>();
+
+ if (existing.Count > 0) {
+ throw new DuplicateNameException("Calendar with the same name already exists in this folder.");
+ }
+
+ session.Save(calendar);
+
+ tx.Commit();
+ session.Close();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets the calendar for the given name.
+ /// </summary>
+ /// <param name="name">The name to look up.</param>
+ /// <returns>The matching calendar or null if non is found.</returns>
public Calendar GetCalandar(string name, int parentFolderId) {
using (ISession session = NHibernateHelper.Factory.OpenSession()) {
- ICriteria criteria = session.CreateCriteria(typeof(Calendar));
- criteria.Add(Expression.Like("Name", name));
- criteria.Add(Expression.Eq("ParentFolderId", parentFolderId));
- IList<Calendar> matches = criteria.List<Calendar>();
+ IList<Calendar> matches = session.CreateCriteria(typeof(Calendar))
+ .Add(Expression.Like("Name", name))
+ .Add(Expression.Eq("ParentFolderId", parentFolderId))
+ .List<Calendar>();
return (matches.Count == 1) ? matches[0] : null;
}
}
+ /// <summary>
+ /// Gets the calendar for the given calendar Id.
+ /// </summary>
+ /// <param name="calendarId">The Id of the calendar to look up.</param>
+ /// <returns>The matching calendar or null if non is found.</returns>
public Calendar GetCalandar(int calendarId) {
using (ISession session = NHibernateHelper.Factory.OpenSession()) {
return (Calendar) session.Load(typeof(Calendar), calendarId);
}
}
+ /// <summary>
+ /// Updates an existing calendar.
+ /// </summary>
+ /// <param name="calendar">The calendar to update.</param>
+ /// <exception cref="System.Data.DuplicateNameException">If a calendar with the same name already exists.</exception>
+ /// <exception cref="System.InvalidOperationException">Changes to the calendar are not permitted.</exception>
+ /// <exception cref="System.ArgumentException">The calendar is invalid.</exception>
+ public void UpdateCalandar(Calendar calendar) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
+ using (ITransaction tx = session.BeginTransaction()) {
+ // Check if any other user with the same name exists in the system
+ IList<Calendar> existing = session.CreateCriteria(typeof(Calendar))
+ .Add(Expression.Like("Name", calendar.Name))
+ .Add(Expression.Eq("ParentFolderId", calendar.ParentFolderId))
+ .List<Calendar>();
+
+ if (existing.Count > 0) {
+ throw new DuplicateNameException("Calendar with the same name already exists in the folder.");
+ }
+
+ session.Update(calendar);
+
+ tx.Commit();
+ session.Close();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Removes a calendar from the local store.
+ /// </summary>
+ /// <param name="calendarId">The Id of the calendar to delete.</param>
+ /// <exception cref="System.InvalidOperationException">Changes to the calendar are not permitted.</exception>
+ /// <exception cref="System.ArgumentException">The calendar is invalid.</exception>
+ /// <exception cref="System.Data.ConstraintException">Calendar still has entries.</exception>
public void DeleteCalandar(int calendarId) {
using (ISession session = NHibernateHelper.Factory.OpenSession()) {
session.Delete("from Calendar as cal where cal.CalendarId = ?", calendarId, NHibernateUtil.Int32);
}
}
+ #endregion
- public void SaveCalendarEntry(CalendarEntry entry) {
+ #region Calendar Entry Manipulation
+ /// <summary>
+ /// Creates a new calendar entry.
+ /// </summary>
+ /// <param name="entry">The entry to create.</param>
+ public void CreateCalendarEntry(CalendarEntry entry) {
using (ISession session = NHibernateHelper.Factory.OpenSession()) {
// Update the entry's change management fields
entry.LastModified = DateTime.Now;
entry.Sequence++;
// Save it to the database
- session.SaveOrUpdate(entry);
- session.Flush();
+ session.Save(entry);
}
}
+ /// <summary>
+ /// Gets the entry for the given Id.
+ /// </summary>
+ /// <param name="entryId">The entry Id to look up.</param>
+ /// <returns>The entry or null.</returns>
public CalendarEntry GetCalendarEntry(int entryId) {
using (ISession session = NHibernateHelper.Factory.OpenSession()) {
return (CalendarEntry) session.Load(typeof(CalendarEntry), entryId);
}
}
+ /// <summary>
+ /// Updates the given entry.
+ /// </summary>
+ /// <param name="entry">The entry to update.</param>
+ public void UpdateCalendarEntry(CalendarEntry entry) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
+ // Update the entry's change management fields
+ entry.LastModified = DateTime.Now;
+ entry.Sequence++;
+
+ // Save it to the database
+ session.Update(entry);
+ }
+ }
+
+ /// <summary>
+ /// Gets a list of calendar entries.
+ /// </summary>
+ /// <param name="startTime">The start time for the entries returned.</param>
+ /// <param name="endTime">The end time for the entries returned.</param>
+ /// <param name="calendarId">The Id of the calendar to look in.</param>
+ /// <returns>The list of entries</returns>
public IList<CalendarEntry> GetCalendarEntries(DateTime startTime, DateTime endTime, int calendarId) {
using (ISession session = NHibernateHelper.Factory.OpenSession()) {
- ICriteria criteria = session.CreateCriteria(typeof(CalendarEntry));
- criteria.Add(Expression.Eq("CalendarId", calendarId));
- criteria.Add(Expression.Ge("StartTime", startTime));
- IList<CalendarEntry> matches = criteria.List<CalendarEntry>();
+ IList<CalendarEntry> matches = session.CreateCriteria(typeof(CalendarEntry))
+ .Add(Expression.Ge("StartTime", startTime))
+ .Add(Expression.Le("StartTime", endTime))
+ .CreateCriteria("Calendar")
+ .Add(Expression.Eq("CalendarId", calendarId))
+ .List<CalendarEntry>();
- List<CalendarEntry> result = new List<CalendarEntry>();
- foreach (CalendarEntry entry in matches) {
- result.Add(entry);
- }
-
// TODO: catch recurrences, etc
- return result;
+ return matches;
}
}
+ /// <summary>
+ /// Removes a calendar entry from the local store.
+ /// </summary>
+ /// <param name="entryId">The Id of the calendar entry to delete.</param>
+ /// <exception cref="System.InvalidOperationException">Changes to the calendar entry are not permitted.</exception>
+ /// <exception cref="System.ArgumentException">The calendar entry is invalid.</exception>
public void DeleteCalendarEntry(int entryId) {
using (ISession session = NHibernateHelper.Factory.OpenSession()) {
session.Delete("from CalendarEntry as calE where calE.EntryId = ?", entryId, NHibernateUtil.Int64);
}
}
+ #endregion
#region Reinstall Schema
/// <summary>
Modified: NMail/trunk/NMail.LocalStoreData.NHibernate/NMail.LocalStoreData.NHibernate.csproj
===================================================================
--- NMail/trunk/NMail.LocalStoreData.NHibernate/NMail.LocalStoreData.NHibernate.csproj 2007-05-08 11:35:52 UTC (rev 189)
+++ NMail/trunk/NMail.LocalStoreData.NHibernate/NMail.LocalStoreData.NHibernate.csproj 2007-05-08 13:20:38 UTC (rev 190)
@@ -48,6 +48,7 @@
<ItemGroup>
<Compile Include="AuthenticationUser.cs" />
<Compile Include="Configuration.cs" />
+ <Compile Include="InternalUserGroupAdminAce.cs" />
<Compile Include="InternalSystemAce.cs" />
<Compile Include="InternalUserObject.cs" />
<Compile Include="FolderSubscription.cs" />
@@ -65,6 +66,7 @@
<Content Include="hibernate-localstore-configuration.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
+ <EmbeddedResource Include="Mappings\NMail.LocalStoreData.NHibernate.InternalUserGroupAdminAce.hbm.xml" />
<EmbeddedResource Include="Mappings\NMail.LocalStoreData.NHibernate.UserMailboxMapping.hbm.xml" />
</ItemGroup>
<ItemGroup>
Modified: NMail/trunk/NMail.Server.Console/NMail.Server.Console.csproj
===================================================================
--- NMail/trunk/NMail.Server.Console/NMail.Server.Console.csproj 2007-05-08 11:35:52 UTC (rev 189)
+++ NMail/trunk/NMail.Server.Console/NMail.Server.Console.csproj 2007-05-08 13:20:38 UTC (rev 190)
@@ -112,11 +112,6 @@
<Project>{A6C6E9C2-5A17-4E00-9CE7-550C0359E023}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
</ProjectReference>
- <ProjectReference Include="..\NMail.LocalStoreData.MySql\NMail.LocalStoreData.MySql.csproj">
- <Name>NMail.LocalStoreData.MySql</Name>
- <Project>{90B33C2B-F945-478A-BBA0-4F66EF78B870}</Project>
- <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
- </ProjectReference>
<ProjectReference Include="..\NMail.LocalStoreData.NHibernate\NMail.LocalStoreData.NHibernate.csproj">
<Project>{72F7E307-F0A9-4750-9ED5-5A1F97725A11}</Project>
<Name>NMail.LocalStoreData.NHibernate</Name>
Modified: NMail/trunk/NMail.Server.Service/NMail.Server.Service.csproj
===================================================================
--- NMail/trunk/NMail.Server.Service/NMail.Server.Service.csproj 2007-05-08 11:35:52 UTC (rev 189)
+++ NMail/trunk/NMail.Server.Service/NMail.Server.Service.csproj 2007-05-08 13:20:38 UTC (rev 190)
@@ -109,11 +109,6 @@
<Project>{A6C6E9C2-5A17-4E00-9CE7-550C0359E023}</Project>
<Name>NMail.ImapService</Name>
</ProjectReference>
- <ProjectReference Include="..\NMail.LocalStoreData.MySql\NMail.LocalStoreData.MySql.csproj">
- <Name>NMail.LocalStoreData.MySql</Name>
- <Project>{90B33C2B-F945-478A-BBA0-4F66EF78B870}</Project>
- <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
- </ProjectReference>
<ProjectReference Include="..\NMail.LocalStore\NMail.LocalStore.csproj">
<Name>NMail.LocalStore</Name>
<Project>{488A8890-EEE1-4ACC-9B35-3DDBE8E70D1D}</Project>
Modified: NMail/trunk/NMail.UnitTests/LocalStoreData/CreateCalendarTest1.cs
===================================================================
--- NMail/trunk/NMail.UnitTests/LocalStoreData/CreateCalendarTest1.cs 2007-05-08 11:35:52 UTC (rev 189)
+++ NMail/trunk/NMail.UnitTests/LocalStoreData/CreateCalendarTest1.cs 2007-05-08 13:20:38 UTC (rev 190)
@@ -22,7 +22,7 @@
c1.OwnerUserId = 1;
c1.ParentFolderId = 1;
- localStoreData.SaveCalandar(c1);
+ localStoreData.CreateCalandar(c1);
Assert.IsTrue(c1.CalendarId > 0, "Valid calendar Id.");
}
Modified: NMail/trunk/NMail.UnitTests/LocalStoreData/CreateCalendarTest2.cs
===================================================================
--- NMail/trunk/NMail.UnitTests/LocalStoreData/CreateCalendarTest2.cs 2007-05-08 11:35:52 UTC (rev 189)
+++ NMail/trunk/NMail.UnitTests/LocalStoreData/CreateCalendarTest2.cs 2007-05-08 13:20:38 UTC (rev 190)
@@ -23,7 +23,7 @@
c1.OwnerUserId = 1;
c1.ParentFolderId = 1;
- localStoreData.SaveCalandar(c1);
+ localStoreData.CreateCalandar(c1);
Assert.IsTrue(c1.CalendarId > 0, "Valid calendar Id.");
@@ -32,7 +32,7 @@
c2.OwnerUserId = 1;
c2.ParentFolderId = 1;
- localStoreData.SaveCalandar(c2);
+ localStoreData.CreateCalandar(c2);
Assert.Fail("Allowed duplicate calendar names.");
}
Modified: NMail/trunk/NMail.UnitTests/LocalStoreData/CreateEventEntryTest1.cs
===================================================================
--- NMail/trunk/NMail.UnitTests/LocalStoreData/CreateEventEntryTest1.cs 2007-05-08 11:35:52 UTC (rev 189)
+++ NMail/trunk/NMail.UnitTests/LocalStoreData/CreateEventEntryTest1.cs 2007-05-08 13:20:38 UTC (rev 190)
@@ -22,7 +22,7 @@
c1.OwnerUserId = 1;
c1.ParentFolderId = 1;
- localStoreData.SaveCalandar(c1);
+ localStoreData.CreateCalandar(c1);
Assert.IsTrue(c1.CalendarId > 0, "Valid calendar Id.");
@@ -34,7 +34,7 @@
e1.Classification = NMail.DataTypes.Classification.Private;
e1.StartTime = startTime;
- localStoreData.SaveCalendarEntry(e1);
+ localStoreData.CreateCalendarEntry(e1);
IList<CalendarEntry> entries = localStoreData.GetCalendarEntries(startTime, DateTime.Now, c1.CalendarId);
Added: NMail/trunk/NMail.UnitTests/LocalStoreData/GetSetRemoveUserGroupAdminAceTest1.cs
===================================================================
--- NMail/trunk/NMail.UnitTests/LocalStoreData/GetSetRemoveUserGroupAdminAceTest1.cs (rev 0)
+++ NMail/trunk/NMail.UnitTests/LocalStoreData/GetSetRemoveUserGroupAdminAceTest1.cs 2007-05-08 13:20:38 UTC (rev 190)
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+using NUnit.Framework;
+
+using NMail.Configuration;
+using NMail.DataTypes.ACLs;
+using NMail.DataTypes.LocalStore;
+
+namespace NMail.UnitTests.LocalStoreData {
+ /// <summary>
+ /// Tests getting/settting/removing user/group admin ACEs.
+ /// </summary>
+ [TestFixture]
+ public class GetSetRemoveUserGroupAdminAceTest1 : BaseLocalStoreDataTest {
+
+ [Test]
+ public void TestUserGroupAdminAce() {
+ GenericAce<UserGroupAdminPrivilege> ace1 = new GenericAce<UserGroupAdminPrivilege>();
+ ace1.Identifier = "Test";
+ ace1.AceType = AcePrivilegeType.Allow;
+ ace1.Privilege = UserGroupAdminPrivilege.CreateGroups;
+ this.localStoreData.SetUserGroupAdminPrivilegeAce(ace1);
+
+ GenericAcl<UserGroupAdminPrivilege> acl1 = this.localStoreData.GetUserGroupAdminPrivilegeAcl();
+ Assert.IsTrue(acl1.Count > 0, "Valid ACL entry count 1.");
+ Assert.AreEqual(UserGroupAdminPrivilege.CreateGroups, acl1["Test"].Privilege, "acl[\"Test\"].Priv == CreateGroups.");
+ Assert.AreEqual(AcePrivilegeType.Allow, acl1["Test"].AceType, "acl[\"Test\"].PrivType == Allow.");
+
+ this.localStoreData.RemoveUserGroupAdminPrivilegeAce("Test");
+
+ GenericAcl<UserGroupAdminPrivilege> acl2 = this.localStoreData.GetUserGroupAdminPrivilegeAcl();
+ Assert.IsNull(acl2["Test"], "acl[\"Test\"] is null");
+ }
+ }
+}
Modified: NMail/trunk/NMail.UnitTests/NMail.UnitTests.csproj
===================================================================
--- NMail/trunk/NMail.UnitTests/NMail.UnitTests.csproj 2007-05-08 11:35:52 UTC (rev 189)
+++ NMail/trunk/NMail.UnitTests/NMail.UnitTests.csproj 2007-05-08 13:20:38 UTC (rev 190)
@@ -54,6 +54,7 @@
<Compile Include="DataTypes\Helper\MimeHelperTests.cs" />
<Compile Include="DataTypes\Helper\StringTokenizerTests.cs" />
<Compile Include="LocalStoreData\BaseLocalStoreDataTest.cs" />
+ <Compile Include="LocalStoreData\GetSetRemoveUserGroupAdminAceTest1.cs" />
<Compile Include="LocalStoreData\GetSetRemoveSystemAceTest1.cs" />
<Compile Include="LocalStoreData\LoadSaveObjectTest1.cs" />
<Compile Include="LocalStoreData\PurgeDeletedMessagesTest1.cs" />
Modified: NMail/trunk/NMail.sln
===================================================================
--- NMail/trunk/NMail.sln 2007-05-08 11:35:52 UTC (rev 189)
+++ NMail/trunk/NMail.sln 2007-05-08 13:20:38 UTC (rev 190)
@@ -1,7 +1,5 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual C# Express 2005
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NMail.LocalStoreData.MySql", "NMail.LocalStoreData.MySql\NMail.LocalStoreData.MySql.csproj", "{90B33C2B-F945-478A-BBA0-4F66EF78B870}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NMail.ImapService", "NMail.ImapService\NMail.ImapService.csproj", "{A6C6E9C2-5A17-4E00-9CE7-550C0359E023}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoPrivileges", "MonoPrivileges\MonoPrivileges.csproj", "{18586CD8-276B-44E7-B0C1-B8537D8A8090}"
@@ -60,14 +58,6 @@
Release2005|Any CPU = Release2005|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {90B33C2B-F945-478A-BBA0-4F66EF78B870}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {90B33C2B-F945-478A-BBA0-4F66EF78B870}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {90B33C2B-F945-478A-BBA0-4F66EF78B870}.Debug2005|Any CPU.ActiveCfg = Debug|Any CPU
- {90B33C2B-F945-478A-BBA0-4F66EF78B870}.Debug2005|Any CPU.Build.0 = Debug|Any CPU
- {90B33C2B-F945-478A-BBA0-4F66EF78B870}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {90B33C2B-F945-478A-BBA0-4F66EF78B870}.Release|Any CPU.Build.0 = Release|Any CPU
- {90B33C2B-F945-478A-BBA0-4F66EF78B870}.Release2005|Any CPU.ActiveCfg = Release|Any CPU
- {90B33C2B-F945-478A-BBA0-4F66EF78B870}.Release2005|Any CPU.Build.0 = Release|Any CPU
{A6C6E9C2-5A17-4E00-9CE7-550C0359E023}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A6C6E9C2-5A17-4E00-9CE7-550C0359E023}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A6C6E9C2-5A17-4E00-9CE7-550C0359E023}.Debug2005|Any CPU.ActiveCfg = Debug|Any CPU
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2007-05-08 11:35:57
|
Revision: 189
http://svn.sourceforge.net/nmailserver/?rev=189&view=rev
Author: tmyroadctfig
Date: 2007-05-08 04:35:52 -0700 (Tue, 08 May 2007)
Log Message:
-----------
Further work on local store data, local store and related sub-systems.
Modified Paths:
--------------
NMail/trunk/NMail/Authentication/IAuthenticationProvider.cs
NMail/trunk/NMail/Authentication/NullAuthentication.cs
NMail/trunk/NMail/DataTypes/LocalStore/ILocalStore.cs
NMail/trunk/NMail/DataTypes/LocalStore/ILocalStoreUserMap.cs
NMail/trunk/NMail.ImapService/State/AuthenticatedState.cs
NMail/trunk/NMail.ImapService/State/ExamineState.cs
NMail/trunk/NMail.ImapService/State/SelectedState.cs
NMail/trunk/NMail.LocalStore/DeliveryActions/ManageWhiteList.cs
NMail/trunk/NMail.LocalStore/LocalStore.cs
NMail/trunk/NMail.LocalStoreData.MySql/MySqlAuthProvider.cs
NMail/trunk/NMail.LocalStoreData.MySql/MySqlLocalStoreData.cs
NMail/trunk/NMail.LocalStoreData.MySql/MySqlUserMap.cs
NMail/trunk/NMail.LocalStoreData.NHibernate/AuthenticationUser.cs
NMail/trunk/NMail.LocalStoreData.NHibernate/Mappings/NMail.LocalStoreData.NHibernate.AuthenticationUser.hbm.xml
NMail/trunk/NMail.LocalStoreData.NHibernate/NHibernateAuthProvider.cs
NMail/trunk/NMail.LocalStoreData.NHibernate/NHibernateUserMap.cs
NMail/trunk/NMail.LocalStoreData.NHibernate/NMail.LocalStoreData.NHibernate.csproj
NMail/trunk/NMail.Server.Console/NMail.config
NMail/trunk/NMail.UnitTests/NMail.UnitTests.csproj
Added Paths:
-----------
NMail/trunk/NMail.LocalStoreData.NHibernate/Mappings/NMail.LocalStoreData.NHibernate.UserMailboxMapping.hbm.xml
NMail/trunk/NMail.LocalStoreData.NHibernate/UserMailboxMapping.cs
NMail/trunk/NMail.UnitTests/AuthProvider/
NMail/trunk/NMail.UnitTests/AuthProvider/BaseAuthTest.cs
NMail/trunk/NMail.UnitTests/AuthProvider/PasswordAutenticationTest1.cs
Modified: NMail/trunk/NMail/Authentication/IAuthenticationProvider.cs
===================================================================
--- NMail/trunk/NMail/Authentication/IAuthenticationProvider.cs 2007-05-01 13:46:57 UTC (rev 188)
+++ NMail/trunk/NMail/Authentication/IAuthenticationProvider.cs 2007-05-08 11:35:52 UTC (rev 189)
@@ -87,5 +87,11 @@
/// <param name="newPassword">The new password.</param>
/// <returns>True on success, false otherwise.</returns>
bool ChangePassword(IAuthenticationToken user, string newPassword);
+
+ /// <summary>
+ /// Reinstalls the auth provider's data store if required. This is only used
+ /// during deployment and testing.
+ /// </summary>
+ void Reinstall();
}
}
Modified: NMail/trunk/NMail/Authentication/NullAuthentication.cs
===================================================================
--- NMail/trunk/NMail/Authentication/NullAuthentication.cs 2007-05-01 13:46:57 UTC (rev 188)
+++ NMail/trunk/NMail/Authentication/NullAuthentication.cs 2007-05-08 11:35:52 UTC (rev 189)
@@ -62,6 +62,8 @@
public bool IsEnabled(IAuthenticationToken user) {
return true;
}
+
+ public void Reinstall() { }
#endregion
}
}
Modified: NMail/trunk/NMail/DataTypes/LocalStore/ILocalStore.cs
===================================================================
--- NMail/trunk/NMail/DataTypes/LocalStore/ILocalStore.cs 2007-05-01 13:46:57 UTC (rev 188)
+++ NMail/trunk/NMail/DataTypes/LocalStore/ILocalStore.cs 2007-05-08 11:35:52 UTC (rev 189)
@@ -63,9 +63,9 @@
/// </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>
+ /// <param name="folderId">The Id of the folder to deliver the message into.</param>
/// <returns>The result of the delivery.</returns>
- DeliveryResult DeliverMessage(IAuthenticationToken authToken, Message.Message message, StoreFolder folder);
+ DeliveryResult DeliverMessage(IAuthenticationToken authToken, Message.Message message, int folderId);
#endregion
#region Folder Retrieval and Manipulation
@@ -100,8 +100,10 @@
/// </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);
+ /// <exception cref="System.Data.DuplicateNameException">If a folder with the same name already exists.</exception>
+ /// <exception cref="System.InvalidOperationException">Changes to the folder are not permitted.</exception>
+ /// <exception cref="System.ArgumentException">The folder is invalid.</exception>
+ void CreateFolder(IAuthenticationToken authToken, string newFolder);
/// <summary>
/// Deletes an existing folder.
@@ -109,7 +111,8 @@
/// <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);
+ /// <exception cref="System.ArgumentException">The folder is invalid.</exception>
+ void DeleteFolder(IAuthenticationToken authToken, int folderId);
/// <summary>
/// Moves an existing folder in the local store to another location.
@@ -144,9 +147,9 @@
/// 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>
+ /// <param name="parentId">The Id of the parent to get the children from.</param>
/// <returns>The list of folders.</returns>
- IList<StoreFolder> GetChildren(IAuthenticationToken authToken, StoreFolder parent);
+ IList<StoreFolder> GetChildren(IAuthenticationToken authToken, int parentId);
/// <summary>
/// Gets a list of all folders
@@ -169,16 +172,15 @@
/// 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);
+ /// <param name="folderId">The Id of the folder to subscribe to.</param>
+ void Subscribe(IAuthenticationToken authToken, int folderId);
/// <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);
+ /// <param name="folderId">The Id of the folder to unsubscribe from.</param>
+ void UnSubscribe(IAuthenticationToken authToken, int folderId);
#endregion
#region Message Id and Offset
@@ -187,35 +189,35 @@
/// </summary>
/// <param name="authToken">The authentication credentials.</param>
/// <param name="currentId">The Id to start looking from.</param>
- /// <param name="folder"></param>
+ /// <param name="folderId">The Id of the folder to get the next message Id in.</param>
/// <returns>The Id of the next existing message or 0 if there is none.</returns>
- int GetNextMessageId(IAuthenticationToken authToken, int currentId, StoreFolder folder);
+ int GetNextMessageId(IAuthenticationToken authToken, int currentId, int folderId);
/// <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>
+ /// <param name="folderId">The Id of the folder the message is in.</param>
/// <returns>The next message Id or 0 if insufficient privileges.</returns>
- int GetNextMessageId(IAuthenticationToken authToken, StoreFolder folder);
+ int GetNextMessageId(IAuthenticationToken authToken, int folderId);
/// <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>
+ /// <param name="folderId">The Id of 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);
+ int GetMessageId(IAuthenticationToken authToken, int messageOffset, int folderId);
/// <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>
+ /// <param name="folderId">The Id of 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);
+ int GetMessageOffset(IAuthenticationToken authToken, int messageId, int folderId);
/// <summary>
/// Gets a list of message Ids for a given folder.
@@ -232,9 +234,9 @@
/// </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>
+ /// <param name="folderId">The Id of 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);
+ StoreMessageFlags? GetMessageFlags(IAuthenticationToken authToken, int messageId, int folderId);
/// <summary>
/// Sets the message flags for a message.
@@ -242,9 +244,9 @@
/// <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="folderId">The Id of 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);
+ void SetMessageFlags(IAuthenticationToken authToken, int messageId, int folderId, StoreMessageFlags flags);
#endregion
#region Message Retrieval
@@ -253,18 +255,18 @@
/// </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>
+ /// <param name="folderId">The Id of 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);
+ DateTime? GetInternalDate(IAuthenticationToken authToken, int messageId, int folderId);
/// <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>
+ /// <param name="folderId">The Id of 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);
+ int? GetMessageSize(IAuthenticationToken authToken, int messageId, int folderId);
/// <summary>
/// Gets the headers for the message.
@@ -309,30 +311,30 @@
/// 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>
+ /// <param name="folderId">The Id of 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);
+ int? GetMessageCount(IAuthenticationToken authToken, int folderId);
/// <summary>
/// Gets the number of messages with the specified flags set.
/// </summary>
/// <param name="authToken">The authentication credentials.</param>
- /// <param name="folder">The folder to count the flagged messages in.</param>
+ /// <param name="folderId">The Id of the folder to count the flagged messages in.</param>
/// <param name="flags">The flags to check for when counting.</param>
/// <returns>The number of messages or null if invalid folder or privileges.</returns>
- int? GetMessageCountWithFlags(IAuthenticationToken authToken, StoreFolder folder, StoreMessageFlags flags);
+ int? GetMessageCountWithFlags(IAuthenticationToken authToken, int folderId, StoreMessageFlags flags);
#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>
+ /// <param name="folderId">The Id of 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);
+ int[] PurgeDeletedMessages(IAuthenticationToken authToken, int folderId);
#region Folder ACLs
/// <summary>
@@ -340,17 +342,17 @@
/// 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="folderId">The Id of 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);
+ void SetStoreFolderAce(IAuthenticationToken authToken, int folderId, 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="folderId">The Id of 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);
+ void RemoveStoreFolderAce(IAuthenticationToken authToken, int folderId, string identifier);
/// <summary>
/// Gets the ACL for the given folder.
@@ -582,141 +584,4 @@
LocalStoreCalendarResult DeleteCalandar(IAuthenticationToken authToken, int calendarId);
}
-
- /// <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>
- UnknownError = 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,
-
- /// <summary>
- /// The user doesn't exist in the mail domain.
- /// </summary>
- NoSuchUser = 4
- }
}
Modified: NMail/trunk/NMail/DataTypes/LocalStore/ILocalStoreUserMap.cs
===================================================================
--- NMail/trunk/NMail/DataTypes/LocalStore/ILocalStoreUserMap.cs 2007-05-01 13:46:57 UTC (rev 188)
+++ NMail/trunk/NMail/DataTypes/LocalStore/ILocalStoreUserMap.cs 2007-05-08 11:35:52 UTC (rev 189)
@@ -16,7 +16,7 @@
*/
using System;
-using System.Xml;
+using System.Collections.Generic;
using NMail.DataTypes;
@@ -37,7 +37,7 @@
/// </summary>
/// <param name="username">The user to look up the mailboxes for.</param>
/// <returns>The user's mailboxes.</returns>
- Mailbox[] GetUserMailboxes(string username);
+ IList<Mailbox> GetUserMailboxes(string username);
/// <summary>
/// Adds the given mailbox the to list of mailboxes for the user.
Modified: NMail/trunk/NMail.ImapService/State/AuthenticatedState.cs
===================================================================
--- NMail/trunk/NMail.ImapService/State/AuthenticatedState.cs 2007-05-01 13:46:57 UTC (rev 188)
+++ NMail/trunk/NMail.ImapService/State/AuthenticatedState.cs 2007-05-08 11:35:52 UTC (rev 189)
@@ -88,7 +88,7 @@
if (folder.HasChildren) {
// Get a list of child folders
IList<StoreFolder> children =
- LocalStore.GetChildren(Session.AuthenticationToken, folder);
+ LocalStore.GetChildren(Session.AuthenticationToken, folder.FolderId);
// Output each matching folder to the client
foreach (StoreFolder current in children) {
@@ -142,7 +142,7 @@
if (folder != null) {
// Attempt to subscribe to the folder
- LocalStore.Subscribe(Session.AuthenticationToken, folder);
+ LocalStore.Subscribe(Session.AuthenticationToken, folder.FolderId);
QueueResponse(new SimpleResponse(cmd.Tag, ResponseType.Ok, "SUBSCRIBE Completed."));
} else {
@@ -162,7 +162,7 @@
// Attempt to subscribe to the folder
StoreFolder folder = LocalStore.GetStoreFolder(Session.AuthenticationToken, cmd.Folder);
if (folder != null) {
- LocalStore.UnSubscribe(Session.AuthenticationToken, folder);
+ LocalStore.UnSubscribe(Session.AuthenticationToken, folder.FolderId);
QueueResponse(new SimpleResponse(cmd.Tag, ResponseType.Ok, "UNSUBSCRIBE Completed."));
} else {
@@ -193,9 +193,9 @@
#region Process Select and Examine Commands
protected void sendSelectResponses(StoreFolder folder) {
QueueResponse(new SimpleResponse(ResponseType.Flags, @"(\Answered \Flagged \Deleted \Seen \Draft)"));
- QueueResponse(new SimpleResponse(LocalStore.GetMessageCount(Session.AuthenticationToken, folder) + " EXISTS"));
- QueueResponse(new SimpleResponse(LocalStore.GetMessageCountWithFlags(Session.AuthenticationToken, folder, StoreMessageFlags.Recent) + " RECENT"));
- QueueResponse(new SimpleResponse(ResponseType.Ok, "[UIDNEXT " + LocalStore.GetNextMessageId(Session.AuthenticationToken, folder) + "]"));
+ QueueResponse(new SimpleResponse(LocalStore.GetMessageCount(Session.AuthenticationToken, folder.FolderId) + " EXISTS"));
+ QueueResponse(new SimpleResponse(LocalStore.GetMessageCountWithFlags(Session.AuthenticationToken, folder.FolderId, StoreMessageFlags.Recent) + " RECENT"));
+ QueueResponse(new SimpleResponse(ResponseType.Ok, "[UIDNEXT " + LocalStore.GetNextMessageId(Session.AuthenticationToken, folder.FolderId) + "]"));
QueueResponse(new SimpleResponse(ResponseType.Ok, "[UIDVALIDITY " + folder.FolderId + "]"));
// TODO: OK [UNSEEN #]
@@ -252,13 +252,13 @@
StatusResponse response = new StatusResponse(cmd.Folder);
if ((cmd.Items & StatusItems.Messages) != StatusItems.None) {
- response.AppendResponseItem("MESSAGES " + LocalStore.GetMessageCount(Session.AuthenticationToken, folder));
+ response.AppendResponseItem("MESSAGES " + LocalStore.GetMessageCount(Session.AuthenticationToken, folder.FolderId));
}
if ((cmd.Items & StatusItems.Recent) != StatusItems.None) {
- response.AppendResponseItem("RECENT " + LocalStore.GetMessageCountWithFlags(Session.AuthenticationToken, folder, StoreMessageFlags.Recent));
+ response.AppendResponseItem("RECENT " + LocalStore.GetMessageCountWithFlags(Session.AuthenticationToken, folder.FolderId, StoreMessageFlags.Recent));
}
if ((cmd.Items & StatusItems.UidNext) != StatusItems.None) {
- response.AppendResponseItem("UIDNEXT " + LocalStore.GetNextMessageId(Session.AuthenticationToken, folder));
+ response.AppendResponseItem("UIDNEXT " + LocalStore.GetNextMessageId(Session.AuthenticationToken, folder.FolderId));
}
if ((cmd.Items & StatusItems.UidValidity) != StatusItems.None) {
response.AppendResponseItem("UIDVALIDITY " + folder.FolderId);
@@ -278,9 +278,9 @@
StoreFolder folder = LocalStore.GetStoreFolder(Session.AuthenticationToken, cmd.Folder);
if (folder != null) {
- LocalStoreFolderResult result = LocalStore.DeleteFolder(Session.AuthenticationToken, folder.FolderId);
+ try {
+ LocalStore.DeleteFolder(Session.AuthenticationToken, folder.FolderId);
- if (result == LocalStoreFolderResult.OkSuccessful) {
// Re-create the inbox folder if it is deleted.
if (LocalStore.GetStoreFolder(Session.AuthenticationToken, Folder.Inbox) == null) {
LocalStore.CreateFolder(Session.AuthenticationToken, Folder.Inbox);
@@ -288,16 +288,16 @@
QueueResponse(new SimpleResponse(cmd.Tag, ResponseType.Ok, "DELETE Completed."));
- } else if (result == LocalStoreFolderResult.HasChildren) {
+ } catch (ConstraintException) {
QueueResponse(new SimpleResponse(cmd.Tag, ResponseType.No, "DELETE: Folder:[" + cmd.Folder + "] has children."));
- } else if (result == LocalStoreFolderResult.NonExistent) {
+ } catch (ArgumentException) {
QueueResponse(new SimpleResponse(cmd.Tag, ResponseType.No, "DELETE: No such folder:[" + cmd.Folder + "]"));
- } else if (result == LocalStoreFolderResult.NotPermitted) {
+ } catch (InvalidOperationException) {
QueueResponse(new SimpleResponse(cmd.Tag, ResponseType.No, "DELETE: Insufficient privileges to delete folder:[" + cmd.Folder + "]."));
- } else {
+ } catch (Exception) {
QueueResponse(new SimpleResponse(cmd.Tag, ResponseType.No, "DELETE: Unknown error."));
}
@@ -381,7 +381,7 @@
}
// Attempt to spool the message
- DeliveryResult result = LocalStore.DeliverMessage(Session.AuthenticationToken, message, folder);
+ DeliveryResult result = LocalStore.DeliverMessage(Session.AuthenticationToken, message, folder.FolderId);
if (result.Type == DeliveryResultType.Success) {
QueueResponse(new SimpleResponse(cmd.Tag, ResponseType.Ok, "APPEND Completed"));
@@ -436,7 +436,7 @@
// Set the new privileges
currentAce.Privilege = newPrivileges;
- this.LocalStore.SetStoreFolderAce(Session.AuthenticationToken, folder, currentAce);
+ this.LocalStore.SetStoreFolderAce(Session.AuthenticationToken, folder.FolderId, currentAce);
QueueResponse(new SimpleResponse(cmd.Tag, ResponseType.Ok, "SETACL Completed."));
} else {
@@ -457,7 +457,7 @@
if (folder != null) {
// Remove the ACE from the folder
- LocalStore.RemoveStoreFolderAce(Session.AuthenticationToken, folder, cmd.Identifier);
+ LocalStore.RemoveStoreFolderAce(Session.AuthenticationToken, folder.FolderId, cmd.Identifier);
QueueResponse(new SimpleResponse(cmd.Tag, ResponseType.Ok, "DELETEACL Completed."));
} else {
Modified: NMail/trunk/NMail.ImapService/State/ExamineState.cs
===================================================================
--- NMail/trunk/NMail.ImapService/State/ExamineState.cs 2007-05-01 13:46:57 UTC (rev 188)
+++ NMail/trunk/NMail.ImapService/State/ExamineState.cs 2007-05-08 11:35:52 UTC (rev 189)
@@ -56,14 +56,14 @@
if (usingUid) {
messageUid = messageId;
} else {
- messageUid = LocalStore.GetMessageId(Session.AuthenticationToken, messageId, this.selectedFolder);
+ messageUid = LocalStore.GetMessageId(Session.AuthenticationToken, messageId, this.selectedFolder.FolderId);
}
// Get the message
Message message = LocalStore.GetMessage(Session.AuthenticationToken, messageUid, this.selectedFolder.FolderId);
// Attempt to copy the message
- DeliveryResult result = LocalStore.DeliverMessage(Session.AuthenticationToken, message, dstFolder);
+ DeliveryResult result = LocalStore.DeliverMessage(Session.AuthenticationToken, message, dstFolder.FolderId);
}
public override void ProcessCommand(CopyCommand cmd) {
@@ -81,12 +81,12 @@
// Process each message in the specified range
if (cmd.UidCommand) {
int i = 0;
- int messageId = LocalStore.GetNextMessageId(Session.AuthenticationToken, listItem.Start - 1, this.selectedFolder);
+ int messageId = LocalStore.GetNextMessageId(Session.AuthenticationToken, listItem.Start - 1, this.selectedFolder.FolderId);
while (i < (listItem.End - listItem.Start) && messageId != 0 && messageId <= listItem.End) {
processMessageCopy(messageId, true, dstFolder);
- messageId = LocalStore.GetNextMessageId(Session.AuthenticationToken, messageId, this.selectedFolder);
+ messageId = LocalStore.GetNextMessageId(Session.AuthenticationToken, messageId, this.selectedFolder.FolderId);
i++;
}
} else {
@@ -97,16 +97,16 @@
} else if (listItem.ItemType == ImapMessageListItemType.UnboundedRange) {
if (cmd.UidCommand) {
- int messageId = LocalStore.GetNextMessageId(Session.AuthenticationToken, listItem.Start - 1, this.selectedFolder);
+ int messageId = LocalStore.GetNextMessageId(Session.AuthenticationToken, listItem.Start - 1, this.selectedFolder.FolderId);
while (messageId != 0) {
processMessageCopy(messageId, true, dstFolder);
- messageId = LocalStore.GetNextMessageId(Session.AuthenticationToken, messageId, this.selectedFolder);
+ messageId = LocalStore.GetNextMessageId(Session.AuthenticationToken, messageId, this.selectedFolder.FolderId);
}
} else {
// Process each message in the specified range
- int? messageCount = LocalStore.GetMessageCount(Session.AuthenticationToken, this.selectedFolder);
+ int? messageCount = LocalStore.GetMessageCount(Session.AuthenticationToken, this.selectedFolder.FolderId);
if (!messageCount.HasValue) {
QueueResponse(new SimpleResponse(cmd.Tag, ResponseType.No, "COPY: Access to folder denied."));
@@ -166,7 +166,7 @@
string flagsString = "FLAGS ";
// Get the message flags
- StoreMessageFlags? flags = LocalStore.GetMessageFlags(Session.AuthenticationToken, messageUid, this.selectedFolder);
+ StoreMessageFlags? flags = LocalStore.GetMessageFlags(Session.AuthenticationToken, messageUid, this.selectedFolder.FolderId);
if (flags.HasValue) {
flagsString += StoreMessageFlagsHelper.ToImapFlagsString(flags.Value);
@@ -223,8 +223,8 @@
#endregion
#region sendMessageSize
- protected virtual void sendMessageSize(FetchResponse response, int messageUid) {
- int? messageSize = LocalStore.GetMessageSize(Session.AuthenticationToken, messageUid, this.selectedFolder);
+ protected virtual void sendMessageSize(FetchResponse response, int messageUid) {
+ int? messageSize = LocalStore.GetMessageSize(Session.AuthenticationToken, messageUid, this.selectedFolder.FolderId);
if (messageSize.HasValue) {
response.AppendResponseItem("RFC822.SIZE " + messageSize.Value);
@@ -234,7 +234,7 @@
#region sendInternalDate
protected virtual void sendInternalDate(FetchResponse response, int messageUid) {
- DateTime? internalDate = LocalStore.GetInternalDate(Session.AuthenticationToken, messageUid, this.selectedFolder);
+ DateTime? internalDate = LocalStore.GetInternalDate(Session.AuthenticationToken, messageUid, this.selectedFolder.FolderId);
if (internalDate.HasValue) {
response.AppendResponseItem("INTERNALDATE \"" + internalDate.Value.ToString("r") + "\"");
@@ -351,10 +351,10 @@
if (usingUid) {
messageUid = messageId;
- messageOffset = LocalStore.GetMessageOffset(Session.AuthenticationToken, messageId, this.selectedFolder);
+ messageOffset = LocalStore.GetMessageOffset(Session.AuthenticationToken, messageId, this.selectedFolder.FolderId);
} else {
messageOffset = messageId;
- messageUid = LocalStore.GetMessageId(Session.AuthenticationToken, messageOffset, this.selectedFolder);
+ messageUid = LocalStore.GetMessageId(Session.AuthenticationToken, messageOffset, this.selectedFolder.FolderId);
}
// Ensure the message exists
@@ -450,12 +450,12 @@
// Process each message in the specified range
if (cmd.UidCommand) {
int i = 0;
- int messageId = LocalStore.GetNextMessageId(Session.AuthenticationToken, listItem.Start - 1, this.selectedFolder);
+ int messageId = LocalStore.GetNextMessageId(Session.AuthenticationToken, listItem.Start - 1, this.selectedFolder.FolderId);
while (i <= (listItem.End - listItem.Start) && messageId != 0 && messageId <= listItem.End) {
processMessageFetch(messageId, true, cmd.DataList);
- messageId = LocalStore.GetNextMessageId(Session.AuthenticationToken, messageId, this.selectedFolder);
+ messageId = LocalStore.GetNextMessageId(Session.AuthenticationToken, messageId, this.selectedFolder.FolderId);
i++;
}
} else {
@@ -466,16 +466,16 @@
} else if (listItem.ItemType == ImapMessageListItemType.UnboundedRange) {
if (cmd.UidCommand) {
- int messageId = LocalStore.GetNextMessageId(Session.AuthenticationToken, listItem.Start - 1, this.selectedFolder);
+ int messageId = LocalStore.GetNextMessageId(Session.AuthenticationToken, listItem.Start - 1, this.selectedFolder.FolderId);
while (messageId != 0) {
processMessageFetch(messageId, true, cmd.DataList);
- messageId = LocalStore.GetNextMessageId(Session.AuthenticationToken, messageId, this.selectedFolder);
+ messageId = LocalStore.GetNextMessageId(Session.AuthenticationToken, messageId, this.selectedFolder.FolderId);
}
} else {
// Process each message in the specified range
- int? messageCount = LocalStore.GetMessageCount(Session.AuthenticationToken, this.selectedFolder);
+ int? messageCount = LocalStore.GetMessageCount(Session.AuthenticationToken, this.selectedFolder.FolderId);
if (!messageCount.HasValue) {
QueueResponse(new SimpleResponse(cmd.Tag, ResponseType.No, "FETCH: Access denied."));
@@ -545,7 +545,7 @@
List<int> messageOffsets = new List<int>();
foreach (int messageUid in messageUids) {
- int messageOffset = LocalStore.GetMessageOffset(Session.AuthenticationToken, messageUid, Session.SelectedFolder);
+ int messageOffset = LocalStore.GetMessageOffset(Session.AuthenticationToken, messageUid, Session.SelectedFolder.FolderId);
messageOffsets.Add(messageOffset);
}
Modified: NMail/trunk/NMail.ImapService/State/SelectedState.cs
===================================================================
--- NMail/trunk/NMail.ImapService/State/SelectedState.cs 2007-05-01 13:46:57 UTC (rev 188)
+++ NMail/trunk/NMail.ImapService/State/SelectedState.cs 2007-05-08 11:35:52 UTC (rev 189)
@@ -36,7 +36,7 @@
#region Process Expunge Command
public override void ProcessCommand(ExpungeCommand cmd) {
- int[] messageOffsets = LocalStore.PurgeDeletedMessages(Session.AuthenticationToken, this.selectedFolder);
+ int[] messageOffsets = LocalStore.PurgeDeletedMessages(Session.AuthenticationToken, this.selectedFolder.FolderId);
for (int i = 0; i < messageOffsets.Length; i++) {
QueueResponse(new ExpungeResponse(messageOffsets[i] - i));
@@ -53,33 +53,33 @@
if (usingUid) {
messageUid = messageId;
- messageOffset = LocalStore.GetMessageOffset(Session.AuthenticationToken, messageId, this.selectedFolder);
+ messageOffset = LocalStore.GetMessageOffset(Session.AuthenticationToken, messageId, this.selectedFolder.FolderId);
} else {
messageOffset = messageId;
- messageUid = LocalStore.GetMessageId(Session.AuthenticationToken, messageOffset, this.selectedFolder);
+ messageUid = LocalStore.GetMessageId(Session.AuthenticationToken, messageOffset, this.selectedFolder.FolderId);
}
if (command == StoreFlagsCommand.Replace || command == StoreFlagsCommand.ReplaceSilently) {
// Simply replace the existing flags
- LocalStore.SetMessageFlags(Session.AuthenticationToken, messageUid, this.selectedFolder, flags);
+ LocalStore.SetMessageFlags(Session.AuthenticationToken, messageUid, this.selectedFolder.FolderId, flags);
} else if (command == StoreFlagsCommand.Add || command == StoreFlagsCommand.AddSilently) {
// Add the set flags to the existing flags
- StoreMessageFlags? currentFlags = LocalStore.GetMessageFlags(Session.AuthenticationToken, messageUid, this.selectedFolder);
+ StoreMessageFlags? currentFlags = LocalStore.GetMessageFlags(Session.AuthenticationToken, messageUid, this.selectedFolder.FolderId);
if (currentFlags.HasValue) {
StoreMessageFlags newFlags = currentFlags.Value | flags;
- LocalStore.SetMessageFlags(Session.AuthenticationToken, messageUid, this.selectedFolder, newFlags);
+ LocalStore.SetMessageFlags(Session.AuthenticationToken, messageUid, this.selectedFolder.FolderId, newFlags);
}
} else {
// Remove the set flags from the existing flags
- StoreMessageFlags? currentFlags = LocalStore.GetMessageFlags(Session.AuthenticationToken, messageUid, this.selectedFolder);
+ StoreMessageFlags? currentFlags = LocalStore.GetMessageFlags(Session.AuthenticationToken, messageUid, this.selectedFolder.FolderId);
if (currentFlags.HasValue) {
StoreMessageFlags newFlags = currentFlags.Value ^ flags;
newFlags &= currentFlags.Value;
- LocalStore.SetMessageFlags(Session.AuthenticationToken, messageUid, this.selectedFolder, newFlags);
+ LocalStore.SetMessageFlags(Session.AuthenticationToken, messageUid, this.selectedFolder.FolderId, newFlags);
}
}
@@ -102,12 +102,12 @@
// Process each message in the specified range
if (cmd.UidCommand) {
int i = 0;
- int messageId = LocalStore.GetNextMessageId(Session.AuthenticationToken, listItem.Start - 1, this.selectedFolder);
+ int messageId = LocalStore.GetNextMessageId(Session.AuthenticationToken, listItem.Start - 1, this.selectedFolder.FolderId);
while (i < (listItem.End - listItem.Start) && messageId != 0 && messageId <= listItem.End) {
processMessageStore(messageId, true, cmd.Command, cmd.Flags);
- messageId = LocalStore.GetNextMessageId(Session.AuthenticationToken, messageId, this.selectedFolder);
+ messageId = LocalStore.GetNextMessageId(Session.AuthenticationToken, messageId, this.selectedFolder.FolderId);
i++;
}
} else {
@@ -118,16 +118,16 @@
} else if (listItem.ItemType == ImapMessageListItemType.UnboundedRange) {
if (cmd.UidCommand) {
- int messageId = LocalStore.GetNextMessageId(Session.AuthenticationToken, listItem.Start - 1, this.selectedFolder);
+ int messageId = LocalStore.GetNextMessageId(Session.AuthenticationToken, listItem.Start - 1, this.selectedFolder.FolderId);
while (messageId != 0) {
processMessageStore(messageId, true, cmd.Command, cmd.Flags);
- messageId = LocalStore.GetNextMessageId(Session.AuthenticationToken, messageId, this.selectedFolder);
+ messageId = LocalStore.GetNextMessageId(Session.AuthenticationToken, messageId, this.selectedFolder.FolderId);
}
} else {
// Process each message in the specified range
- int? messageCount = LocalStore.GetMessageCount(Session.AuthenticationToken, this.selectedFolder);
+ int? messageCount = LocalStore.GetMessageCount(Session.AuthenticationToken, this.selectedFolder.FolderId);
if (!messageCount.HasValue) {
QueueResponse(new SimpleResponse(cmd.Tag, ResponseType.No, "Access denied."));
@@ -151,7 +151,7 @@
public override void ProcessCommand(CloseCommand cmd) {
base.ProcessCommand(cmd);
- LocalStore.PurgeDeletedMessages(Session.AuthenticationToken, this.selectedFolder);
+ LocalStore.PurgeDeletedMessages(Session.AuthenticationToken, this.selectedFolder.FolderId);
}
#endregion
@@ -161,11 +161,11 @@
if (!peek) {
// Remove the RECENT flag from the existing flags
- StoreMessageFlags? currentFlags = LocalStore.GetMessageFlags(Session.AuthenticationToken, messageUid, this.selectedFolder);
+ StoreMessageFlags? currentFlags = LocalStore.GetMessageFlags(Session.AuthenticationToken, messageUid, this.selectedFolder.FolderId);
if (currentFlags.HasValue) {
StoreMessageFlags newFlags = (StoreMessageFlags)((int)currentFlags.Value - (int)StoreMessageFlags.Recent);
- LocalStore.SetMessageFlags(Session.AuthenticationToken, messageUid, this.selectedFolder, newFlags);
+ LocalStore.SetMessageFlags(Session.AuthenticationToken, messageUid, this.selectedFolder.FolderId, newFlags);
}
}
}
Modified: NMail/trunk/NMail.LocalStore/DeliveryActions/ManageWhiteList.cs
===================================================================
--- NMail/trunk/NMail.LocalStore/DeliveryActions/ManageWhiteList.cs 2007-05-01 13:46:57 UTC (rev 188)
+++ NMail/trunk/NMail.LocalStore/DeliveryActions/ManageWhiteList.cs 2007-05-08 11:35:52 UTC (rev 189)
@@ -85,9 +85,9 @@
// Ensure the user has a quarantined folder
if (quarantineFolder == null) {
- LocalStoreFolderResult createResult = localStore.CreateFolder(username, "Quarantined");
-
- if (createResult != LocalStoreFolderResult.OkSuccessful) {
+ try {
+ localStore.CreateFolder(username, "Quarantined");
+ } catch (Exception) {
return new DeliveryResult(DeliveryResultType.TemporaryError, "Error creating user's quarantined folder.");
}
}
Modified: NMail/trunk/NMail.LocalStore/LocalStore.cs
===================================================================
--- NMail/trunk/NMail.LocalStore/LocalStore.cs 2007-05-01 13:46:57 UTC (rev 188)
+++ NMail/trunk/NMail.LocalStore/LocalStore.cs 2007-05-08 11:35:52 UTC (rev 189)
@@ -201,11 +201,11 @@
/// </summary>
/// <param name="authToken">The authentication credentials.</param>
/// <param name="message">The message to deliver.</param>
- /// <param name="folder">The folder to deliver the message into.</param>
+ /// <param name="folderId">The Id of the folder to deliver the message into.</param>
/// <returns>The result of the delivery.</returns>
- public DeliveryResult DeliverMessage(IAuthenticationToken authToken, Message message, StoreFolder folder) {
+ public DeliveryResult DeliverMessage(IAuthenticationToken authToken, Message message, int folderId) {
- LocalStoreData.DeliverMessage(message, folder.FolderId);
+ LocalStoreData.DeliverMessage(message, folderId);
return new DeliveryResult(DeliveryResultType.Success, null);
// TODO: lookup a maildomain or a system wide delivery chain to process the message
@@ -348,7 +348,7 @@
/// <param name="authToken">The authentication credentials.</param>
/// <param name="newFolder">The folder to create.</param>
/// <returns>The result of the create attempt.</returns>
- public LocalStoreFolderResult CreateFolder(IAuthenticationToken authToken, string newFolder) {
+ public void CreateFolder(IAuthenticationToken authToken, string newFolder) {
Folder resolvedFolder = getResolvedFolder(authToken, newFolder);
if (resolvedFolder.Parent != null) {
@@ -376,21 +376,19 @@
GenericAce<StoreFolderPrivilege> ace = new GenericAce<StoreFolderPrivilege>(authToken.Username, StoreFolderPrivilegeHelper.AllPrivileges, AcePrivilegeType.Allow);
LocalStoreData.SetStoreFolderAce(createdFolder.FolderId, ace);
- return LocalStoreFolderResult.OkSuccessful;
-
} else {
// Don't have privileges to create the folder
- return LocalStoreFolderResult.NotPermitted;
+ throw new ArgumentException("Invalid folder Id.");
}
} else {
// Invalid parent folder
- return LocalStoreFolderResult.NonExistent;
+ throw new ArgumentException("Invalid folder Id.");
}
} else {
// Currently can't create a folder without a parent
- return LocalStoreFolderResult.NotPermitted;
+ throw new ArgumentException("Invalid folder Id.");
}
}
#endregion
@@ -401,18 +399,16 @@
/// </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>
- public LocalStoreFolderResult DeleteFolder(IAuthenticationToken authToken, int folderId) {
+ public void DeleteFolder(IAuthenticationToken authToken, int folderId) {
// Ensure the user has rights to delete the folder
if (hasFolderPrivilege(authToken.Username, folderId, StoreFolderPrivilege.Delete)) {
// Delete the folder
- throw new NotImplementedException("Need to adjust localstore iface before implementing...");
- //return LocalStoreData.DeleteFolder(folderId);
+ LocalStoreData.DeleteFolder(folderId, false);
} else {
- return LocalStoreFolderResult.NotPermitted;
+ throw new ArgumentException("Invalid folder Id.");
}
}
#endregion
@@ -499,7 +495,7 @@
/// <returns>The list of folders.</returns>
private void GetDescendants(IAuthenticationToken authToken, StoreFolder parent, IList<StoreFolder> result) {
// Get a list of folders for this parent
- IList<StoreFolder> children = GetChildren(authToken, parent);
+ IList<StoreFolder> children = GetChildren(authToken, parent.FolderId);
foreach (StoreFolder child in children) {
// Add the current child and get any descendants
@@ -516,16 +512,15 @@
/// 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>
+ /// <param name="parentId">The Id of the parent to get the children from.</param>
/// <returns>The list of folders.</returns>
- public IList<StoreFolder> GetChildren(IAuthenticationToken authToken, StoreFolder parent) {
+ public IList<StoreFolder> GetChildren(IAuthenticationToken authToken, int parentId) {
// Ensure the user has rights to list the folders
- if (parent != null
- && hasFolderPrivilege(authToken.Username, parent.FolderId, StoreFolderPrivilege.Lookup)) {
+ if (hasFolderPrivilege(authToken.Username, parentId, StoreFolderPrivilege.Lookup)) {
// Return the children
- return LocalStoreData.GetChildren(parent.FolderId);
+ return LocalStoreData.GetChildren(parentId);
} else {
return new List<StoreFolder>();
@@ -584,20 +579,18 @@
/// 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>
- public LocalStoreFolderResult Subscribe(IAuthenticationToken authToken, StoreFolder folder) {
+ /// <param name="folderId">The Id of the folder to subscribe to.</param>
+ public void Subscribe(IAuthenticationToken authToken, int folderId) {
// Ensure the user has rights to subscribe to the folder
- if (hasFolderPrivilege(authToken.Username, folder.FolderId, StoreFolderPrivilege.Lookup)) {
+ if (hasFolderPrivilege(authToken.Username, folderId, StoreFolderPrivilege.Lookup)) {
// Subscribe to the folder
LocalStoreUser user = LocalStoreData.GetUser(authToken.Username);
- LocalStoreData.Subscribe(user.UserId, folder.FolderId);
- return LocalStoreFolderResult.OkSuccessful;
+ LocalStoreData.Subscribe(user.UserId, folderId);
} else {
- return LocalStoreFolderResult.NonExistent;
+ throw new ArgumentException("Invalid folder Id.");
}
}
#endregion
@@ -607,11 +600,11 @@
/// Un-subscribes from a folder.
/// </summary>
/// <param name="authToken">The authentication credentials.</param>
- /// <param name="folder">The folder to unsubscribe from.</param>
- public void UnSubscribe(IAuthenticationToken authToken, StoreFolder folder) {
+ /// <param name="folderId">The Id of the folder to unsubscribe from.</param>
+ public void UnSubscribe(IAuthenticationToken authToken, int folderId) {
// Un-subscribe from the folder
LocalStoreUser user = LocalStoreData.GetUser(authToken.Username);
- LocalStoreData.UnSubscribe(user.UserId, folder.FolderId);
+ LocalStoreData.UnSubscribe(user.UserId, folderId);
}
#endregion
#endregion
@@ -623,15 +616,15 @@
/// </summary>
/// <param name="authToken">The authentication credentials.</param>
/// <param name="currentId">The Id to start looking from.</param>
- /// <param name="folder"></param>
+ /// <param name="folderId"></param>
/// <returns>The Id of the next existing message or 0 if there is none.</returns>
- public int GetNextMessageId(IAuthenticationToken authToken, int currentId, StoreFolder folder) {
+ public int GetNextMessageId(IAuthenticationToken authToken, int currentId, int folderId) {
// Ensure the user has rights to get the message Id
- if (hasFolderPrivilege(authToken.Username, folder.FolderId, StoreFolderPrivilege.Read)) {
+ if (hasFolderPrivilege(authToken.Username, folderId, StoreFolderPrivilege.Read)) {
// Return the message Id
- return LocalStoreData.GetNextMessageId(currentId, folder.FolderId);
+ return LocalStoreData.GetNextMessageId(currentId, folderId);
} else {
return 0;
@@ -642,15 +635,15 @@
/// 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>
+ /// <param name="folderId">The Id of the folder the message is in.</param>
/// <returns>The next message Id or 0 if insufficient privileges.</returns>
- public int GetNextMessageId(IAuthenticationToken authToken, StoreFolder folder) {
+ public int GetNextMessageId(IAuthenticationToken authToken, int folderId) {
// Ensure the user has rights to get the message Id
- if (hasFolderPrivilege(authToken.Username, folder.FolderId, StoreFolderPrivilege.Read)) {
+ if (hasFolderPrivilege(authToken.Username, folderId, StoreFolderPrivilege.Read)) {
// Return the message Id
- return LocalStoreData.GetNextMessageId(folder.FolderId);
+ return LocalStoreData.GetNextMessageId(folderId);
} else {
return 0;
@@ -664,15 +657,15 @@
/// </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>
+ /// <param name="folderId">The Id of the folder the message is in.</param>
/// <returns>The message Id or 0 if there is no such message.</returns>
- public int GetMessageId(IAuthenticationToken authToken, int messageOffset, StoreFolder folder) {
+ public int GetMessageId(IAuthenticationToken authToken, int messageOffset, int folderId) {
// Ensure the user has rights to get the message Id
- if (hasFolderPrivilege(authToken.Username, folder.FolderId, StoreFolderPrivilege.Read)) {
+ if (hasFolderPrivilege(authToken.Username, folderId, StoreFolderPrivilege.Read)) {
// Return the message Id
- return LocalStoreData.GetMessageId(messageOffset, folder.FolderId);
+ return LocalStoreData.GetMessageId(messageOffset, folderId);
} else {
return 0;
@@ -686,15 +679,15 @@
/// </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>
+ /// <param name="folderId">The Id of the folder the message is in.</param>
/// <returns>The message offset or 0 if there is no such message.</returns>
- public int GetMessageOffset(IAuthenticationToken authToken, int messageId, StoreFolder folder) {
+ public int GetMessageOffset(IAuthenticationToken authToken, int messageId, int folderId) {
// Ensure the user has rights to get the message Id
- if (hasFolderPrivilege(authToken.Username, folder.FolderId, StoreFolderPrivilege.Read)) {
+ if (hasFolderPrivilege(authToken.Username, folderId, StoreFolderPrivilege.Read)) {
// Return the message Id
- return LocalStoreData.GetMessageOffset(messageId, folder.FolderId);
+ return LocalStoreData.GetMessageOffset(messageId, folderId);
} else {
return 0;
@@ -726,15 +719,15 @@
/// </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>
+ /// <param name="folderId">The Id of the folder the message is in.</param>
/// <returns>The message flags or null if invalid folder or privileges.</returns>
- public StoreMessageFlags? GetMessageFlags(IAuthenticationToken authToken, int messageId, StoreFolder folder) {
+ public StoreMessageFlags? GetMessageFlags(IAuthenticationToken authToken, int messageId, int folderId) {
// Ensure the user has rights to get the message flags
- if (hasFolderPrivilege(authToken.Username, folder.FolderId, StoreFolderPrivilege.Read)) {
+ if (hasFolderPrivilege(authToken.Username, folderId, StoreFolderPrivilege.Read)) {
// Return the message flags
- return LocalStoreData.GetMessageFlags(messageId, folder.FolderId);
+ return LocalStoreData.GetMessageFlags(messageId, folderId);
} else {
return null;
@@ -749,10 +742,10 @@
/// <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="folderId">The Id of the folder the message is in.</param>
/// <param name="flags">The flags to set.</param>
- public void SetMessageFlags(IAuthenticationToken authToken, int messageId, StoreFolder folder, StoreMessageFlags flags) {
- StoreMessageFlags? tmpFlags = LocalStoreData.GetMessageFlags(messageId, folder.FolderId);
+ public void SetMessageFlags(IAuthenticationToken authToken, int messageId, int folderId, StoreMessageFlags flags) {
+ StoreMessageFlags? tmpFlags = LocalStoreData.GetMessageFlags(messageId, folderId);
if (!tmpFlags.HasValue) {
throw new ArgumentException("Invalid message or folder Id.");
}
@@ -762,7 +755,7 @@
if ((changedFlags & StoreMessageFlags.Deleted) == StoreMessageFlags.Deleted) {
// Ensure the user has rights to delete a message
- if (!hasFolderPrivilege(authToken.Username, folder.FolderId, StoreFolderPrivilege.Delete)) {
+ if (!hasFolderPrivilege(authToken.Username, folderId, StoreFolderPrivilege.Delete)) {
// No rights, replace with the current deleted flag
flags |= StoreMessageFlags.Deleted;
flags ^= StoreMessageFlags.Deleted;
@@ -773,7 +766,7 @@
if ((changedFlags & StoreMessageFlags.Seen) == StoreMessageFlags.Seen) {
// Ensure the user has rights to alter the seen flag
- if (!hasFolderPrivilege(authToken.Username, folder.FolderId, StoreFolderPrivilege.AlterSeenFlag)) {
+ if (!hasFolderPrivilege(authToken.Username, folderId, StoreFolderPrivilege.AlterSeenFlag)) {
// No rights, replace with the current seen flag
flags |= StoreMessageFlags.Seen;
flags ^= StoreMessageFlags.Seen;
@@ -784,7 +777,7 @@
if ((changedFlags ^ (StoreMessageFlags.Deleted | StoreMessageFlags.Seen)) != StoreMessageFlags.None) {
// Ensure the user has rights to alter the other flags
- if (!hasFolderPrivilege(authToken.Username, folder.FolderId, StoreFolderPrivilege.Write)) {
+ if (!hasFolderPrivilege(authToken.Username, folderId, StoreFolderPrivilege.Write)) {
// No rights, replace with the current flags (excluding \Seen and \Deleted)
flags &= (StoreMessageFlags.Deleted | StoreMessageFlags.Seen);
currentFlags |= (StoreMessageFlags.Deleted | StoreMessageFlags.Seen);
@@ -794,7 +787,7 @@
}
}
- LocalStoreData.SetMessageFlags(messageId, folder.FolderId, flags);
+ LocalStoreData.SetMessageFlags(messageId, folderId, flags);
}
#endregion
#endregion
@@ -806,15 +799,15 @@
/// </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>
+ /// <param name="folderId">The Id of the folder the message is in.</param>
/// <returns>The message date or null if invalid folder or privileges.</returns>
- public DateTime? GetInternalDate(IAuthenticationToken authToken, int messageId, StoreFolder folder) {
+ public DateTime? GetInternalDate(IAuthenticationToken authToken, int messageId, int folderId) {
// Ensure the user has rights to get the message date time
- if (hasFolderPrivilege(authToken.Username, folder.FolderId, StoreFolderPrivilege.Read)) {
+ if (hasFolderPrivilege(authToken.Username, folderId, StoreFolderPrivilege.Read)) {
// Return the internal date
- return LocalStoreData.GetInternalDate(messageId, folder.FolderId);
+ return LocalStoreData.GetInternalDate(messageId, folderId);
} else {
return null;
@@ -828,15 +821,15 @@
/// </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>
+ /// <param name="folderId">The Id of the folder the message is in.</param>
/// <returns>The message size in bytes or null if invalid folder or privileges.</returns>
- public int? GetMessageSize(IAuthenticationToken authToken, int messageId, StoreFolder folder) {
+ public int? GetMessageSize(IAuthenticationToken authToken, int messageId, int folderId) {
// Ensure the user has rights to get the message size
- if (hasFolderPrivilege(authToken.Username, folder.FolderId, StoreFolderPrivilege.Read)) {
+ if (hasFolderPrivilege(authToken.Username, folderId, StoreFolderPrivilege.Read)) {
// Return the message size
- return LocalStoreData.GetMessageSize(messageId, folder.FolderId);
+ return LocalStoreData.GetMessageSize(messageId, folderId);
} else {
return null;
@@ -942,15 +935,15 @@
/// 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>
+ /// <param name="folderId">The Id of the folder to count the messages in.</param>
/// <returns>The message count or null if invalid folder or privileges.</returns>
- public int? GetMessageCount(IAuthenticationToken authToken, StoreFolder folder) {
+ public int? GetMessageCount(IAuthenticationToken authToken, int folderId) {
// Ensure the user has rights to get the message count
- if (hasFolderPrivilege(authToken.Username, folder.FolderId, StoreFolderPrivilege.Read)) {
+ if (hasFolderPrivilege(authToken.Username, folderId, StoreFolderPrivilege.Read)) {
// Return the message count
- return LocalStoreData.GetMessageCount(folder.FolderId);
+ return LocalStoreData.GetMessageCount(folderId);
} else {
return null;
@@ -963,16 +956,16 @@
/// Gets the number of messages with the specified flags set.
/// </summary>
/// <param name="authToken">The authentication credentials.</param>
- /// <param name="folder">The folder to count the flagged messages in.</param>
+ /// <param name="folderId">The Id of the folder to count the flagged messages in.</param>
/// <param name="flags">The flags to check for when counting.</param>
/// <returns>The number of messages or null if invalid folder or privileges.</returns>
- public int? GetMessageCountWithFlags(IAuthenticationToken authToken, StoreFolder folder, StoreMessageFlags flags) {
+ public int? GetMessageCountWithFlags(IAuthenticationToken authToken, int folderId, StoreMessageFlags flags) {
// Ensure the user has rights to get the message count
- if (hasFolderPrivilege(authToken.Username, folder.FolderId, StoreFolderPrivilege.Lookup)) {
+ if (hasFolderPrivilege(authToken.Username, folderId, StoreFolderPrivilege.Lookup)) {
// Return the count
- return LocalStoreData.GetMessageCountWithFlags(folder.FolderId, flags);
+ return LocalStoreData.GetMessageCountWithFlags(folderId, flags);
} else {
return null;
@@ -986,18 +979,18 @@
/// Permanently removes messages flagged as deleted.
/// </summary>
/// <param name="authToken">The authentication credentials.</param>
- /// <param name="folder">The folder to delete messages in.</param>
+ /// <param name="folderId">The Id of the folder to delete messages in.</param>
/// <returns>
/// The list of message offsets for the deleted messages or null if insufficient
/// pri...
[truncated message content] |
|
From: <tmy...@us...> - 2007-05-01 13:46:57
|
Revision: 188
http://svn.sourceforge.net/nmailserver/?rev=188&view=rev
Author: tmyroadctfig
Date: 2007-05-01 06:46:57 -0700 (Tue, 01 May 2007)
Log Message:
-----------
Changed the way NHibernate is configured. Added a unit test.
Modified Paths:
--------------
NMail/trunk/NMail.LocalStoreData.NHibernate/Mappings/NMail.LocalStoreData.NHibernate.InternalSystemAce.hbm.xml
NMail/trunk/NMail.LocalStoreData.NHibernate/NHibernateAuthProvider.cs
NMail/trunk/NMail.LocalStoreData.NHibernate/NHibernateLocalStoreData.cs
NMail/trunk/NMail.LocalStoreData.NHibernate/NMail.LocalStoreData.NHibernate.csproj
NMail/trunk/NMail.Server.Console/NMail.Server.Console.csproj
NMail/trunk/NMail.Server.Console/NMail.config
NMail/trunk/NMail.SpoolData.NHibernate/NHibernateSpoolData.cs
NMail/trunk/NMail.SpoolData.NHibernate/NMail.SpoolData.NHibernate.csproj
Added Paths:
-----------
NMail/trunk/NMail.LocalStoreData.NHibernate/Configuration.cs
NMail/trunk/NMail.LocalStoreData.NHibernate/NHibernateHelper.cs
NMail/trunk/NMail.LocalStoreData.NHibernate/hibernate-localstore-configuration.xml
NMail/trunk/NMail.SpoolData.NHibernate/Configuration.cs
NMail/trunk/NMail.SpoolData.NHibernate/hibernate-spool-configuration.xml
NMail/trunk/NMail.UnitTests/LocalStoreData/GetSetRemoveSystemAceTest1.cs
Removed Paths:
-------------
NMail/trunk/NMail.LocalStoreData.NHibernate/hibernate-configuration.xml
NMail/trunk/NMail.Server.Console/oldconfig.xml
NMail/trunk/NMail.SpoolData.NHibernate/hibernate-configuration.xml
Added: NMail/trunk/NMail.LocalStoreData.NHibernate/Configuration.cs
===================================================================
--- NMail/trunk/NMail.LocalStoreData.NHibernate/Configuration.cs (rev 0)
+++ NMail/trunk/NMail.LocalStoreData.NHibernate/Configuration.cs 2007-05-01 13:46:57 UTC (rev 188)
@@ -0,0 +1,69 @@
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Text;
+
+using NMail.Configuration;
+
+namespace NMail.LocalStoreData.NHibernate {
+ /// <summary>
+ /// Provides configuration settings for the NHibernate local store data implementation.
+ /// </summary>
+ public class Configuration : ConfigurationSection {
+ /// <summary>
+ /// Adds a NHibernate local store data configuration section to the current config file.
+ /// </summary>
+ public static void AddToConfigFile() {
+ if (NMailConfigFile.Current.Sections["NMail.LocalStoreData.NHibernate"] == null) {
+ NMailConfigFile.Current.Sections.Add("NMail.LocalStoreData.NHibernate", new Configuration());
+ }
+ }
+
+ /// <summary>
+ /// Remove the config section from the config file.
+ /// </summary>
+ public static void RemoveFromConfigFile() {
+ if (NMailConfigFile.Current.Sections["NMail.LocalStoreData.NHibernate"] != null) {
+ NMailConfigFile.Current.Sections.Remove("NMail.LocalStoreData.NHibernate");
+ }
+ }
+
+ /// <summary>
+ /// Returns true if a NHibernate local store data configuration section exists in the current
+ /// configuration.
+ /// </summary>
+ public static bool ConfigurationPresent {
+ get {
+ return (NMailConfigFile.Current.Sections["NMail.LocalStoreData.NHibernate"] != null);
+ }
+ }
+
+ /// <summary>
+ /// The current configuration in use.
+ /// </summary>
+ public static Configuration Current {
+ get {
+ Configuration current;
+ current = (Configuration) NMailConfigFile.Current.GetSection("NMail.LocalStoreData.NHibernate");
+
+ if (current == null) {
+ throw new ConfigurationErrorsException("NMail NHibernate local store data configuration is missing");
+ }
+ return current;
+ }
+ }
+
+ /// <summary>
+ /// The file containing the actual NHibernate configuration.
+ /// </summary>
+ [ConfigurationProperty("NHibernateCfgFile", IsRequired = true)]
+ public string ConfigurationFile {
+ get {
+ return (string) this["NHibernateCfgFile"];
+ }
+ set {
+ this["NHibernateCfgFile"] = value;
+ }
+ }
+ }
+}
Modified: NMail/trunk/NMail.LocalStoreData.NHibernate/Mappings/NMail.LocalStoreData.NHibernate.InternalSystemAce.hbm.xml
===================================================================
--- NMail/trunk/NMail.LocalStoreData.NHibernate/Mappings/NMail.LocalStoreData.NHibernate.InternalSystemAce.hbm.xml 2007-04-30 08:59:18 UTC (rev 187)
+++ NMail/trunk/NMail.LocalStoreData.NHibernate/Mappings/NMail.LocalStoreData.NHibernate.InternalSystemAce.hbm.xml 2007-05-01 13:46:57 UTC (rev 188)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="NMail.LocalStoreData.NHibernate" assembly="NMail.LocalStoreData.NHibernate" default-lazy="false">
- <class name="NMail.LocalStoreData.NHibernate.InternalSystemAce" table="UserObject">
+ <class name="NMail.LocalStoreData.NHibernate.InternalSystemAce" table="SystemAce">
<id name="AceId" type="Int32" unsaved-value="0">
<column name="AceId" not-null="true"/>
<generator class="native" />
Modified: NMail/trunk/NMail.LocalStoreData.NHibernate/NHibernateAuthProvider.cs
===================================================================
--- NMail/trunk/NMail.LocalStoreData.NHibernate/NHibernateAuthProvider.cs 2007-04-30 08:59:18 UTC (rev 187)
+++ NMail/trunk/NMail.LocalStoreData.NHibernate/NHibernateAuthProvider.cs 2007-05-01 13:46:57 UTC (rev 188)
@@ -32,18 +32,6 @@
namespace NMail.LocalStoreData.NHibernate {
public class NHibernateAuthProvider : MarshalByRefObject, IHashAuthProvider {
- global::NHibernate.Cfg.Configuration hibernateCfg;
-
- ISessionFactory hibernateFactory;
-
- public NHibernateAuthProvider() {
- this.hibernateCfg = new global::NHibernate.Cfg.Configuration();
- this.hibernateCfg.Configure(System.Reflection.Assembly.GetExecutingAssembly(), "NMail.LocalStoreData.NHibernate.hibernate-configuration.xml");
- this.hibernateCfg.AddAssembly("NMail.LocalStoreData.NHibernate");
-
- this.hibernateFactory = this.hibernateCfg.BuildSessionFactory();
- }
-
internal BasicAuthToken createValidatedToken(AuthenticationUser user, ISession session) {
// Ensure session has started a transaction
if (!session.Transaction.IsActive) {
@@ -82,7 +70,7 @@
/// <param name="user">The token to check.</param>
/// <returns>True if the token is valid.</returns>
public bool ValidToken(IAuthenticationToken user) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
BasicAuthToken authToken = user as BasicAuthToken;
@@ -135,7 +123,7 @@
/// <param name="user">The user to check.</param>
/// <returns>True if their account is locked out.</returns>
public bool IsLockedOut(IAuthenticationToken user) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
AuthenticationUser authUser = session.CreateCriteria(typeof(AuthenticationUser))
.CreateCriteria("User")
@@ -162,7 +150,7 @@
/// <param name="user">The user to check.</param>
/// <returns>True if their account is enabled.</returns>
public bool IsEnabled(IAuthenticationToken user) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
AuthenticationUser authUser = session.CreateCriteria(typeof(AuthenticationUser))
.CreateCriteria("User")
@@ -190,7 +178,7 @@
/// <param name="newPassword">The new password.</param>
/// <returns>True on success, false otherwise.</returns>
public bool ChangePassword(IAuthenticationToken user, string newPassword) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
AuthenticationUser authUser = session.CreateCriteria(typeof(AuthenticationUser))
.CreateCriteria("User")
@@ -218,7 +206,7 @@
/// </summary>
/// <param name="username">The username for the account to reset.</param>
public void ResetLockOut(string username) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
AuthenticationUser user = session.CreateCriteria(typeof(AuthenticationUser))
.CreateCriteria("User")
@@ -244,7 +232,7 @@
/// <param name="username">The username to alter.</param>
/// <param name="enabled">True if the account is enabled, false for disabled.</param>
public void SetEnabled(string username, bool enabled) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
AuthenticationUser user = session.CreateCriteria(typeof(AuthenticationUser))
.CreateCriteria("User")
@@ -271,7 +259,7 @@
/// <param name="password">The given password to attempt authentication with.</param>
/// <returns>The authentication token or null if authentication fails.</returns>
public IAuthenticationToken Authenticate(string username, string password) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
AuthenticationUser user = session.CreateCriteria(typeof(AuthenticationUser))
.CreateCriteria("User")
@@ -299,7 +287,7 @@
/// <param name="username">The username to create the token for.</param>
/// <returns>The token or null if the user is invalid</returns>
public IAuthenticationToken CreateAuthToken(string username) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
AuthenticationUser user = session.CreateCriteria(typeof(AuthenticationUser))
.CreateCriteria("User")
@@ -320,7 +308,7 @@
#region IHashAuthProvider Members
public IAuthenticationToken Authenticate(string username, string hash, HashAuthType authType) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
AuthenticationUser user = session.CreateCriteria(typeof(AuthenticationUser))
.CreateCriteria("User")
Added: NMail/trunk/NMail.LocalStoreData.NHibernate/NHibernateHelper.cs
===================================================================
--- NMail/trunk/NMail.LocalStoreData.NHibernate/NHibernateHelper.cs (rev 0)
+++ NMail/trunk/NMail.LocalStoreData.NHibernate/NHibernateHelper.cs 2007-05-01 13:46:57 UTC (rev 188)
@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+using NHibernate;
+
+namespace NMail.LocalStoreData.NHibernate {
+ /// <summary>
+ /// An internal helper class that configures the NHibernate factory.
+ /// </summary>
+ internal class NHibernateHelper {
+
+ static global::NHibernate.Cfg.Configuration hibernateCfg;
+
+ /// <summary>
+ /// The current hibernate configuration.
+ /// </summary>
+ internal static global::NHibernate.Cfg.Configuration Configuration {
+ get {
+ return hibernateCfg;
+ }
+ }
+
+ static ISessionFactory hibernateFactory;
+
+ /// <summary>
+ /// The configured factory.
+ /// </summary>
+ internal static ISessionFactory Factory {
+ get {
+ return hibernateFactory;
+ }
+ }
+
+ static NHibernateHelper() {
+ hibernateCfg = new global::NHibernate.Cfg.Configuration();
+ hibernateCfg.Configure(NMail.LocalStoreData.NHibernate.Configuration.Current.ConfigurationFile);
+ hibernateCfg.AddAssembly("NMail.LocalStoreData.NHibernate");
+
+ hibernateFactory = hibernateCfg.BuildSessionFactory();
+ }
+ }
+}
Modified: NMail/trunk/NMail.LocalStoreData.NHibernate/NHibernateLocalStoreData.cs
===================================================================
--- NMail/trunk/NMail.LocalStoreData.NHibernate/NHibernateLocalStoreData.cs 2007-04-30 08:59:18 UTC (rev 187)
+++ NMail/trunk/NMail.LocalStoreData.NHibernate/NHibernateLocalStoreData.cs 2007-05-01 13:46:57 UTC (rev 188)
@@ -41,18 +41,6 @@
[Serializable]
public class NHibernateLocalStoreData : MarshalByRefObject, ILocalStoreData {
- global::NHibernate.Cfg.Configuration hibernateCfg;
-
- ISessionFactory hibernateFactory;
-
- public NHibernateLocalStoreData() {
- this.hibernateCfg = new global::NHibernate.Cfg.Configuration();
- this.hibernateCfg.Configure(System.Reflection.Assembly.GetExecutingAssembly(), "NMail.LocalStoreData.NHibernate.hibernate-configuration.xml");
- this.hibernateCfg.AddAssembly("NMail.LocalStoreData.NHibernate");
-
- this.hibernateFactory = this.hibernateCfg.BuildSessionFactory();
- }
-
#region ILocalStoreData Members
#region Message Delivery
@@ -85,7 +73,7 @@
/// <param name="folder">The Id of the folder to deliver into.</param>
/// <exception cref="ArgumentException">The folder Id was invalid.</exception>
public void DeliverMessage(Message message, int folderId) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
// Get the next folder message id
InternalStoreFolder folder = session.Get<InternalStoreFolder>(folderId);
@@ -123,7 +111,7 @@
/// <param name="folder">The folder to lookup.</param>
/// <returns>The store folder or null if the folder name is invalid.</returns>
public StoreFolder GetStoreFolder(Folder folder) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
return session.CreateCriteria(typeof(InternalStoreFolder))
.Add(Expression.Like("NameSpace", folder.NameSpace))
.Add(Expression.Like("FullFolderName", folder.FullFolderName))
@@ -137,7 +125,7 @@
/// <param name="folderId">The Id of the folder to lookup.</param>
/// <returns>The store folder or null if the folder Id is invalid.</returns>
public StoreFolder GetStoreFolder(int folderId) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
return session.Load<InternalStoreFolder>(folderId);
}
}
@@ -155,7 +143,7 @@
/// <exception cref="System.InvalidOperationException">Changes to the folder are not permitted.</exception>
/// <exception cref="System.ArgumentException">The folder is invalid.</exception>
public void CreateFolder(StoreFolder newFolder) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
CreateFolder(newFolder, session);
@@ -251,7 +239,7 @@
/// </exception>
/// <exception cref="System.ArgumentException">The folder is invalid.</exception>
public void DeleteFolder(int folderId, bool deleteChildren) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
InternalStoreFolder folder = session.Get<InternalStoreFolder>(folderId);
@@ -330,7 +318,7 @@
/// <exception cref="System.InvalidOperationException">Changes to the folder are not permitted.</exception>
/// <exception cref="System.ArgumentException">The folder Id or parent Id or folder name is invalid.</exception>
public void MoveFolder(int folderId, int? parentId, string newFolderName) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
InternalStoreFolder currentFolder = session.Load<InternalStoreFolder>(folderId);
InternalStoreFolder newFolder;
@@ -422,7 +410,7 @@
/// <param name="parentId">The Id of the parent to get the children from.</param>
/// <returns>The list of folders.</returns>
public IList<StoreFolder> GetChildren(int parentId) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
InternalStoreFolder folder = session.Load<InternalStoreFolder>(parentId);
@@ -444,7 +432,7 @@
/// </summary>
/// <returns>The list of folders.</returns>
public IList<StoreFolder> GetFolders() {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
return session.CreateCriteria(typeof(InternalStoreFolder)).List<StoreFolder>();
}
}
@@ -504,7 +492,7 @@
/// <param name="userId">The Id of the user to get the list of subscribed folders for.</param>
/// <returns>The list of folders.</returns>
public IList<StoreFolder> GetSubscribedFolders(int userId) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
IList<FolderSubscription> subscriptionList = session.CreateCriteria(typeof(FolderSubscription))
.Add(Expression.Eq("UserId", userId))
@@ -535,7 +523,7 @@
/// <param name="userId">The Id of the user to subscribe for.</param>
/// <param name="folder">The Id of the folder to subscribe to.</param>
public void Subscribe(int userId, int folderId) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
IList<FolderSubscription> current = session.CreateCriteria(typeof(FolderSubscription))
.Add(Expression.Eq("UserId", userId))
@@ -564,7 +552,7 @@
/// <param name="userId">The Id of the user to unsubscribe for.</param>
/// <param name="folder">The Id of the folder to unsubscribe from.</param>
public void UnSubscribe(int userId, int folderId) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
IList<FolderSubscription> current = session.CreateCriteria(typeof(FolderSubscription))
.Add(Expression.Eq("UserId", userId))
@@ -594,7 +582,7 @@
/// <param name="folderId">The Id of the folder to get the next Id in.</param>
/// <returns>The Id of the next existing message or 0 if there is none.</returns>
public int GetNextMessageId(int messageId, int folderId) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
InternalMessage message = session.CreateCriteria(typeof(InternalMessage))
.Add(Expression.Eq("FolderId", folderId))
.Add(Expression.Gt("FolderMessageId", messageId))
@@ -612,7 +600,7 @@
/// <param name="folderId">The Id of the folder the message is in.</param>
/// <returns>The next message Id.</returns>
public int GetNextMessageId(int folderId) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
InternalStoreFolder folder = session.Get<InternalStoreFolder>(folderId);
return (folder == null) ? 0 : folder.NextMessageId;
}
@@ -627,7 +615,7 @@
/// <param name="folderId">The Id of the folder the message is in.</param>
/// <returns>The message Id or 0 if there is no such message.</returns>
public int GetMessageId(int messageOffset, int folderId) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
InternalMessage message = session.CreateCriteria(typeof(InternalMessage))
.Add(Expression.Eq("FolderId", folderId))
.AddOrder(Order.Asc("FolderMessageId"))
@@ -648,7 +636,7 @@
/// <param name="folderId">The Id of the folder the message is in.</param>
/// <returns>The message offset or 0 if there is no such message.</returns>
public int GetMessageOffset(int messageId, int folderId) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
return GetMessageOffset(messageId, folderId, session);
}
}
@@ -670,7 +658,7 @@
public IList<int> GetMessageIds(int folderId) {
List<int> result = new List<int>();
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
IList<InternalMessage> messages = session.CreateCriteria(typeof(InternalMessage))
.Add(Expression.Eq("FolderId", folderId))
.List<InternalMessage>();
@@ -695,7 +683,7 @@
/// <param name="folderId">The Id of the folder the message is in.</param>
/// <returns>The message flags.</returns>
public StoreMessageFlags? GetMessageFlags(int messageId, int folderId) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
InternalMessage message = session.CreateCriteria(typeof(InternalMessage))
.Add(Expression.Eq("FolderId", folderId))
.Add(Expression.Eq("FolderMessageId", messageId))
@@ -715,7 +703,7 @@
/// <param name="folderId">The Id of the folder the message is in.</param>
/// <param name="flags">The flags to set.</param>
public void SetMessageFlags(int messageId, int folderId, StoreMessageFlags flags) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
InternalMessage message = session.CreateCriteria(typeof(InternalMessage))
@@ -750,7 +738,7 @@
/// <param name="folderId">The Id of the folder the message is in.</param>
/// <returns>The message date or null if non is found.</returns>
public DateTime? GetInternalDate(int messageId, int folderId) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
InternalMessage message = session.CreateCriteria(typeof(InternalMessage))
.Add(Expression.Eq("FolderId", folderId))
.Add(Expression.Eq("FolderMessageId", messageId))
@@ -769,7 +757,7 @@
/// <param name="folderId">The Id of the folder the message is in.</param>
/// <returns>The message size in bytes or null if non is found.</returns>
public int? GetMessageSize(int messageId, int folderId) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
InternalMessage message = session.CreateCriteria(typeof(InternalMessage))
.Add(Expression.Eq("FolderId", folderId))
.Add(Expression.Eq("FolderMessageId", messageId))
@@ -788,7 +776,7 @@
/// <param name="folderId">The Id of the folder the message is in.</param>
/// <returns>The message headers or null if none exists.</returns>
public MessageHeaders GetMessageHeaders(int messageId, int folderId) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
InternalMessage message = session.CreateCriteria(typeof(InternalMessage))
.Add(Expression.Eq("FolderId", folderId))
.Add(Expression.Eq("FolderMessageId", messageId))
@@ -808,7 +796,7 @@
/// <param name="messagePart">The number of the part to get.</param>
/// <returns>The MIME part or null if the part is invalid.</returns>
public IMessageBodyPart GetMessageMimePart(int messageId, int folderId, int messagePart) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
InternalMessage message = session.CreateCriteria(typeof(InternalMessage))
.Add(Expression.Eq("FolderId", folderId))
.Add(Expression.Eq("FolderMessageId", messageId))
@@ -839,7 +827,7 @@
/// <param name="folderId">The Id of the folder the message is in.</param>
/// <returns>The message or null if the message Id is invalid.</returns>
public Message GetMessage(int messageId, int folderId) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
InternalMessage message = session.CreateCriteria(typeof(InternalMessage))
.Add(Expression.Eq("FolderId", folderId))
.Add(Expression.Eq("FolderMessageId", messageId))
@@ -861,7 +849,7 @@
/// <param name="folderId">The Id of the folder to count the messages in.</param>
/// <returns>The message count.</returns>
public int GetMessageCount(int folderId) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
return session.CreateCriteria(typeof(InternalMessage))
.Add(Expression.Eq("FolderId", folderId))
.List<InternalMessage>().Count;
@@ -877,7 +865,7 @@
/// <param name="flags">The flags to check for when counting.</param>
/// <returns>The number of messages.</returns>
public int GetMessageCountWithFlags(int folderId, StoreMessageFlags flags) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
return session.CreateCriteria(typeof(InternalMessage))
.Add(Expression.Eq("FolderId", folderId))
.Add(Expression.Eq("MessageFlags", flags))
@@ -895,7 +883,7 @@
/// <param name="folderId">The Id of the folder to delete messages in.</param>
/// <returns>The list of message offsets for the deleted messages.</returns>
public IList<int> PurgeDeletedMessages(int folderId) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
IList<int> folderMsgIds = new List<int>();
@@ -939,7 +927,7 @@
/// <param name="key">A key to identify which object to get.</param>
/// <returns>The object.</returns>
public object LoadObject(string key) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
return session.CreateCriteria(typeof(InternalUserObject))
.Add(Expression.Eq("Key", key))
.UniqueResult<InternalUserObject>().Data;
@@ -951,7 +939,7 @@
/// </summary>
/// <param name="key">A key to identify the object at load time.</param>
public void SaveObject(object o, string key) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
InternalUserObject current = session.CreateCriteria(typeof(InternalUserObject))
.Add(Expression.Eq("Key", key))
@@ -981,7 +969,7 @@
/// <param name="username">The username to look up.</param>
/// <returns>The matching user or null if non is found.</returns>
public LocalStoreUser GetUser(string name) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
return session.CreateCriteria(typeof(LocalStoreUser))
.Add(Expression.Like("Username", name))
.UniqueResult<LocalStoreUser>();
@@ -994,7 +982,7 @@
/// <param name="userId">The Id of the user to look up.</param>
/// <returns>The matching user or null if non is found.</returns>
public LocalStoreUser GetUser(int userId) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
return session.Load<LocalStoreUser>(userId);
}
}
@@ -1006,7 +994,7 @@
/// </summary>
/// <returns>The list of users.</returns>
public IList<LocalStoreUser> GetUsers() {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
return session.CreateCriteria(typeof(LocalStoreUser)).List<LocalStoreUser>();
}
}
@@ -1021,7 +1009,7 @@
/// <exception cref="System.InvalidOperationException">Changes to the user are not permitted.</exception>
/// <exception cref="System.ArgumentException">The user is invalid.</exception>
public void CreateUser(LocalStoreUser user) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
if (user.UserId != 0) {
throw new InvalidOperationException("Can't save an existing user with this method.");
@@ -1070,7 +1058,7 @@
/// </summary>
/// <param name="userId">The Id of the user to delete.</param>
public void DeleteUser(int userId) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
if (GetUserFolders(userId, session).Count > 0) {
throw new ConstraintException("Can't delete a user that still owns folders.");
@@ -1093,7 +1081,7 @@
/// <param name="user">The user details to update.</param>
/// <returns>The result of the attempt to update the user.</returns>
public void UpdateUser(LocalStoreUser user) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
// Check if any other user with the same name exists in the system
IList<LocalStoreUser> existing = session.CreateCriteria(typeof(LocalStoreUser))
@@ -1120,7 +1108,7 @@
/// <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.</returns>
public IList<StoreFolder> GetUserFolders(int userId) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
return GetUserFolders(userId, session);
}
}
@@ -1147,7 +1135,7 @@
/// <param name="name">The name to look up.</param>
/// <returns>The matching group or null if non is found.</returns>
public LocalStoreGroup GetGroup(string name) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
return session.CreateCriteria(typeof(LocalStoreGroup))
.Add(Expression.Like("Name", name))
.UniqueResult<LocalStoreGroup>();
@@ -1160,7 +1148,7 @@
/// <param name="groupId">The Id of the group to look up.</param>
/// <returns>The matching group or null if non is found.</returns>
public LocalStoreGroup GetGroup(int groupId) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
return session.CreateCriteria(typeof(LocalStoreGroup))
.Add(Expression.Like("GroupId", groupId))
.UniqueResult<LocalStoreGroup>();
@@ -1174,7 +1162,7 @@
/// </summary>
/// <returns>The list of groups.</returns>
public IList<LocalStoreGroup> GetGroups() {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
return session.CreateCriteria(typeof(LocalStoreGroup)).List<LocalStoreGroup>();
}
}
@@ -1189,7 +1177,7 @@
/// <exception cref="System.InvalidOperationException">Changes to the group are not permitted.</exception>
/// <exception cref="System.ArgumentException">The group is invalid.</exception>
public void CreateGroup(LocalStoreGroup group) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
if (group.GroupId != 0) {
throw new InvalidOperationException("Can't save an existing group with this method.");
@@ -1221,7 +1209,7 @@
/// <exception cref="System.InvalidOperationException">Changes to the group are not permitted.</exception>
/// <exception cref="System.ArgumentException">The user is invalid.</exception>
public void DeleteGroup(int groupId) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
LocalStoreGroup group = session.Load<LocalStoreGroup>(groupId);
session.Delete(group);
@@ -1240,7 +1228,7 @@
/// <param name="group">The updated group.</param>
/// <returns>The result of the attempt to update the group.</returns>
public void UpdateGroup(LocalStoreGroup group) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
// Check if any other group with the same name exists in the system
IList<LocalStoreUser> existing = session.CreateCriteria(typeof(LocalStoreGroup))
@@ -1330,7 +1318,7 @@
/// <param name="folder">The Id of the folder to set the ACE on.</param>
/// <param name="ace">The privileges and the identifier to put.</param>
public void SetStoreFolderAce(int folderId, GenericAce<StoreFolderPrivilege> ace) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
SetStoreFolderAce(folderId, ace, session);
@@ -1376,7 +1364,7 @@
/// <param name="folderId">The Id of the folder to remove the ACE from.</param>
/// <param name="identifier">The identifier to remove from the ACL.</param>
public void RemoveStoreFolderAce(int folderId, string identifier) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
IList<InternalStoreFolderAcl> current = session.CreateCriteria(typeof(InternalStoreFolderAcl))
.CreateCriteria("Folder")
@@ -1409,7 +1397,7 @@
/// <param name="folderId">The Id of the folder to get the ACL for.</param>
/// <returns>The folder ACL.</returns>
public StoreFolderAcl GetStoreFolderAcl(int folderId) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
IList<InternalStoreFolderAcl> current = session.CreateCriteria(typeof(InternalStoreFolderAcl))
.CreateCriteria("Folder")
.Add(Expression.Eq("FolderId", folderId))
@@ -1434,7 +1422,7 @@
/// </summary>
/// <returns>The mail domains.</returns>
public IList<MailDomain> GetMailDomains() {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
return session.CreateCriteria(typeof(MailDomain)).List<MailDomain>();
}
}
@@ -1446,7 +1434,7 @@
/// </summary>
/// <param name="mailDomain">The mail domain to create.</param>
public void CreateMailDomain(MailDomain mailDomain) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
if (mailDomain.MailDomainId != 0) {
throw new InvalidOperationException("Can't save an existing mail domain with this method.");
@@ -1477,7 +1465,7 @@
/// <param name="mailDomainId">The Id of the mail domain to delete.</param>
/// <returns>The result of the attempt to delete the domain.</returns>
public void DeleteMailDomain(int mailDomainId) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
MailDomain mailDomain = session.Load<MailDomain>(mailDomainId);
session.Delete(mailDomain);
@@ -1496,7 +1484,7 @@
/// <param name="updatedMailDomain">The updated mail domain.</param>
/// <returns>The result of the attempt to update the mail domain.</returns>
public void UpdateMailDomain(MailDomain updatedMailDomain) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
// Check if any other group with the same name exists in the system
IList<MailDomain> existing = session.CreateCriteria(typeof(MailDomain))
@@ -1524,7 +1512,7 @@
/// </summary>
/// <param name="ace">The privileges and the identifier to put.</param>
public void SetSystemPrivilegeAce(GenericAce<SystemPrivilege> ace) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
InternalSystemAce systemAce = session.CreateCriteria(typeof(InternalSystemAce))
.Add(Expression.Eq("Identifier", ace.Identifier))
@@ -1551,7 +1539,7 @@
/// </summary>
/// <param name="identifier">The identifier to remove from the ACL.</param>
public void RemoveSystemPrivilegeAce(string identifier) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
IList<InternalSystemAce> systemAcl = session.CreateCriteria(typeof(InternalSystemAce))
.Add(Expression.Eq("Identifier", identifier))
@@ -1572,7 +1560,7 @@
/// </summary>
/// <returns>The system ACL.</returns>
public GenericAcl<SystemPrivilege> GetSystemPrivilegeAcl() {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
IList<InternalSystemAce> systemAcl = session.CreateCriteria(typeof(InternalSystemAce))
.List<InternalSystemAce>();
@@ -1588,7 +1576,7 @@
#endregion
public void SaveCalandar(Calendar calendar) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
using (ITransaction tx = session.BeginTransaction()) {
if (calendar.CalendarId == 0) {
// Check if any other calendars with the same name exists in this folder
@@ -1614,7 +1602,7 @@
}
public Calendar GetCalandar(string name, int parentFolderId) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
ICriteria criteria = session.CreateCriteria(typeof(Calendar));
criteria.Add(Expression.Like("Name", name));
criteria.Add(Expression.Eq("ParentFolderId", parentFolderId));
@@ -1625,19 +1613,19 @@
}
public Calendar GetCalandar(int calendarId) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
return (Calendar) session.Load(typeof(Calendar), calendarId);
}
}
public void DeleteCalandar(int calendarId) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
session.Delete("from Calendar as cal where cal.CalendarId = ?", calendarId, NHibernateUtil.Int32);
}
}
public void SaveCalendarEntry(CalendarEntry entry) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
// Update the entry's change management fields
entry.LastModified = DateTime.Now;
entry.Sequence++;
@@ -1649,13 +1637,13 @@
}
public CalendarEntry GetCalendarEntry(int entryId) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
return (CalendarEntry) session.Load(typeof(CalendarEntry), entryId);
}
}
public IList<CalendarEntry> GetCalendarEntries(DateTime startTime, DateTime endTime, int calendarId) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
ICriteria criteria = session.CreateCriteria(typeof(CalendarEntry));
criteria.Add(Expression.Eq("CalendarId", calendarId));
criteria.Add(Expression.Ge("StartTime", startTime));
@@ -1673,7 +1661,7 @@
}
public void DeleteCalendarEntry(int entryId) {
- using (ISession session = this.hibernateFactory.OpenSession()) {
+ using (ISession session = NHibernateHelper.Factory.OpenSession()) {
session.Delete("from CalendarEntry as calE where calE.EntryId = ?", entryId, NHibernateUtil.Int64);
}
}
@@ -1685,7 +1673,7 @@
/// disabling this command.
/// </summary>
public void ReinstallSchema() {
- new global::NHibernate.Tool.hbm2ddl.SchemaExport(this.hibernateCfg).Create(false, true);
+ new global::NHibernate.Tool.hbm2ddl.SchemaExport(NHibernateHelper.Configuration).Create(false, true);
LocalStoreUser administrator = new LocalStoreUser();
administrator.Username = "Administrator"; // TODO: get from a global admin name or something
Modified: NMail/trunk/NMail.LocalStoreData.NHibernate/NMail.LocalStoreData.NHibernate.csproj
===================================================================
--- NMail/trunk/NMail.LocalStoreData.NHibernate/NMail.LocalStoreData.NHibernate.csproj 2007-04-30 08:59:18 UTC (rev 187)
+++ NMail/trunk/NMail.LocalStoreData.NHibernate/NMail.LocalStoreData.NHibernate.csproj 2007-05-01 13:46:57 UTC (rev 188)
@@ -47,6 +47,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="AuthenticationUser.cs" />
+ <Compile Include="Configuration.cs" />
<Compile Include="InternalSystemAce.cs" />
<Compile Include="InternalUserObject.cs" />
<Compile Include="FolderSubscription.cs" />
@@ -54,12 +55,15 @@
<Compile Include="InternalStoreFolder.cs" />
<Compile Include="InternalStoreFolderAcl.cs" />
<Compile Include="NHibernateAuthProvider.cs" />
+ <Compile Include="NHibernateHelper.cs" />
<Compile Include="NHibernateLocalStoreData.cs" />
<Compile Include="NHibernateUserMap.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
- <EmbeddedResource Include="hibernate-configuration.xml" />
+ <Content Include="hibernate-localstore-configuration.xml">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NMail\NMail.csproj">
Deleted: NMail/trunk/NMail.LocalStoreData.NHibernate/hibernate-configuration.xml
===================================================================
--- NMail/trunk/NMail.LocalStoreData.NHibernate/hibernate-configuration.xml 2007-04-30 08:59:18 UTC (rev 187)
+++ NMail/trunk/NMail.LocalStoreData.NHibernate/hibernate-configuration.xml 2007-05-01 13:46:57 UTC (rev 188)
@@ -1,10 +0,0 @@
-\xEF\xBB\xBF<?xml version="1.0" encoding="utf-8" ?>
-<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
- <session-factory>
- <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
- <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
- <property name="connection.connection_string">Data Source=127.0.0.1;Initial Catalog=NMailLocalStore;Integrated Security=True</property>
- <property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
- <property name="hibernate.query.substitutions">true 1, false 0</property>
- </session-factory>
-</hibernate-configuration>
Added: NMail/trunk/NMail.LocalStoreData.NHibernate/hibernate-localstore-configuration.xml
===================================================================
--- NMail/trunk/NMail.LocalStoreData.NHibernate/hibernate-localstore-configuration.xml (rev 0)
+++ NMail/trunk/NMail.LocalStoreData.NHibernate/hibernate-localstore-configuration.xml 2007-05-01 13:46:57 UTC (rev 188)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
+ <session-factory>
+ <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
+ <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
+ <property name="connection.connection_string">Data Source=127.0.0.1;Initial Catalog=NMailLocalStore;Integrated Security=True</property>
+ <property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
+ <property name="hibernate.query.substitutions">true 1, false 0</property>
+ </session-factory>
+</hibernate-configuration>
Modified: NMail/trunk/NMail.Server.Console/NMail.Server.Console.csproj
===================================================================
--- NMail/trunk/NMail.Server.Console/NMail.Server.Console.csproj 2007-04-30 08:59:18 UTC (rev 187)
+++ NMail/trunk/NMail.Server.Console/NMail.Server.Console.csproj 2007-05-01 13:46:57 UTC (rev 188)
@@ -172,7 +172,6 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
- <Content Include="oldconfig.xml" />
<None Include="NMail.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Modified: NMail/trunk/NMail.Server.Console/NMail.config
===================================================================
--- NMail/trunk/NMail.Server.Console/NMail.config 2007-04-30 08:59:18 UTC (rev 187)
+++ NMail/trunk/NMail.Server.Console/NMail.config 2007-05-01 13:46:57 UTC (rev 188)
@@ -12,6 +12,8 @@
<section name="NMail.SpoolData.MySql" type="NMail.SpoolData.MySql.Configuration.MySqlSpoolDataConfiguration, NMail.SpoolData.MySql" />
<section name="NMail.MessageRouter" type="NMail.MessageRouter.Configuration.MessageRouterConfiguration, NMail.MessageRouter" />
<section name="NMail.LocalStoreData.MySql" type="NMail.LocalStoreData.MySql.Configuration.MySqlLocalStoreDataConfiguration, NMail.LocalStoreData.MySql" />
+ <section name="NMail.LocalStoreData.NHibernate" type="NMail.LocalStoreData.NHibernate.Configuration, NMail.LocalStoreData.NHibernate" />
+ <section name="NMail.SpoolData.NHibernate" type="NMail.SpoolData.NHibernate.Configuration, NMail.SpoolData.NHibernate" />
</configSections>
<NMail>
@@ -95,4 +97,8 @@
<NMail.SpoolData.MySql ConnectionString="Database=NMailSpool;Uid=NMail;Password=moo" />
<NMail.LocalStoreData.MySql ConnectionString="Database=NMailLocalStore;Uid=NMail;Password=moo"/>
+
+ <NMail.LocalStoreData.NHibernate NHibernateCfgFile="hibernate-localstore-configuration.xml"/>
+
+ <NMail.SpoolData.NHibernate NHibernateCfgFile="hibernate-spool-configuration.xml"/>
</configuration>
Deleted: NMail/trunk/NMail.Server.Console/oldconfig.xml
===================================================================
--- NMail/trunk/NMail.Server.Console/oldconfig.xml 2007-04-30 08:59:18 UTC (rev 187)
+++ NMail/trunk/NMail.Server.Console/oldconfig.xml 2007-05-01 13:46:57 UTC (rev 188)
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<configuration>
- <nmail.messagerouter>
- <settings visibleHost="localhost.local"/>
- <settings warnTemplateFile="warning.txt"/>
- <settings bounceTemplateFile="bounce.txt"/>
- </nmail.messagerouter>
-
- <nmail.localstore>
- <defaultValidator name="onWhiteList" type="NMail.LocalStore.Validators.OnWhiteList, NMail.LocalStore">
-
- <failValidator name="sender" type="NMail.LocalStore.Validators.AddressSender, NMail.LocalStore">
-
- <failValidator name="date" type="NMail.LocalStore.Validators.AddressDate, NMail.LocalStore">
-
- <failValidator name="keyword" type="NMail.LocalStore.Validators.AddressKeyword, NMail.LocalStore">
-
- <failValidator name="blackList" type="NMail.LocalStore.Validators.OrdbBlackList, NMail.LocalStore">
- <settings server="relays.ordb.org"/>
- </failValidator>
- </failValidator>
- </failValidator>
- </failValidator>
- </defaultValidator>
- </nmail.localstore>
-</configuration>
Added: NMail/trunk/NMail.SpoolData.NHibernate/Configuration.cs
===================================================================
--- NMail/trunk/NMail.SpoolData.NHibernate/Configuration.cs (rev 0)
+++ NMail/trunk/NMail.SpoolData.NHibernate/Configuration.cs 2007-05-01 13:46:57 UTC (rev 188)
@@ -0,0 +1,69 @@
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Text;
+
+using NMail.Configuration;
+
+namespace NMail.SpoolData.NHibernate {
+ /// <summary>
+ /// Provides configuration settings for the NHibernate spool data implementation.
+ /// </summary>
+ public class Configuration : ConfigurationSection {
+ /// <summary>
+ /// Adds a NHibernate spool data configuration section to the current config file.
+ /// </summary>
+ public static void AddToConfigFile() {
+ if (NMailConfigFile.Current.Sections["NMail.SpoolData.NHibernate"] == null) {
+ NMailConfigFile.Current.Sections.Add("NMail.SpoolData.NHibernate", new Configuration());
+ }
+ }
+
+ /// <summary>
+ /// Remove the config section from the config file.
+ /// </summary>
+ public static void RemoveFromConfigFile() {
+ if (NMailConfigFile.Current.Sections["NMail.SpoolData.NHibernate"] != null) {
+ NMailConfigFile.Current.Sections.Remove("NMail.SpoolData.NHibernate");
+ }
+ }
+
+ /// <summary>
+ /// Returns true if a NHibernate spool data configuration section exists in the current
+ /// configuration.
+ /// </summary>
+ public static bool ConfigurationPresent {
+ get {
+ return (NMailConfigFile.Current.Sections["NMail.SpoolData.NHibernate"] != null);
+ }
+ }
+
+ /// <summary>
+ /// The current configuration in use.
+ /// </summary>
+ public static Configuration Current {
+ get {
+ Configuration current;
+ current = (Configuration) NMailConfigFile.Current.GetSection("NMail.SpoolData.NHibernate");
+
+ if (current == null) {
+ throw new ConfigurationErrorsException("NMail NHibernate spool data configuration is missing");
+ }
+ return current;
+ }
+ }
+
+ /// <summary>
+ /// The file containing the actual NHibernate configuration.
+ /// </summary>
+ [ConfigurationProperty("NHibernateCfgFile", IsRequired = true)]
+ public string ConfigurationFile {
+ get {
+ return (string) this["NHibernateCfgFile"];
+ }
+ set {
+ this["NHibernateCfgFile"] = value;
+ }
+ }
+ }
+}
Modified: NMail/trunk/NMail.SpoolData.NHibernate/NHibernateSpoolData.cs
===================================================================
--- NMail/trunk/NMail.SpoolData.NHibernate/NHibernateSpoolData.cs 2007-04-30 08:59:18 UTC (rev 187)
+++ NMail/trunk/NMail.SpoolData.NHibernate/NHibernateSpoolData.cs 2007-05-01 13:46:57 UTC (rev 188)
@@ -43,7 +43,7 @@
public NHibernateSpoolData() {
this.hibernateCfg = new global::NHibernate.Cfg.Configuration();
- this.hibernateCfg.Configure(System.Reflection.Assembly.GetExecutingAssembly(), "NMail.SpoolData.NHibernate.hibernate-configuration.xml");
+ this.hibernateCfg.Configure(NMail.SpoolData.NHibernate.Configuration.Current.ConfigurationFile);
this.hibernateCfg.AddAssembly("NMail.SpoolData.NHibernate");
this.hibernateFactory = this.hibernateCfg.BuildSessionFactory();
Modified: NMail/trunk/NMail.SpoolData.NHibernate/NMail.SpoolData.NHibernate.csproj
===================================================================
--- NMail/trunk/NMail.SpoolData.NHibernate/NMail.SpoolData.NHibernate.csproj 2007-04-30 08:59:18 UTC (rev 187)
+++ NMail/trunk/NMail.SpoolData.NHibernate/NMail.SpoolData.NHibernate.csproj 2007-05-01 13:46:57 UTC (rev 188)
@@ -41,10 +41,12 @@
<HintPath>..\References\nhibernate\NHibernate.dll</HintPath>
</Reference>
<Reference Include="System" />
+ <Reference Include="System.configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="Configuration.cs" />
<Compile Include="NHibernateSpoolData.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
@@ -55,7 +57,9 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
- <EmbeddedResource Include="hibernate-configuration.xml" />
+ <Content Include="hibernate-spool-configuration.xml">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="NMail.SpoolData.NHibernate.hbm.xml" />
Deleted: NMail/trunk/NMail.SpoolData.NHibernate/hibernate-configuration.xml
===================================================================
--- NMail/trunk/NMail.SpoolData.NHibernate/hibernate-configuration.xml 2007-04-30 08:59:18 UTC (rev 187)
+++ NMail/trunk/NMail.SpoolData.NHibernate/hibernate-configuration.xml 2007-05-01 13:46:57 UTC (rev 188)
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
- <session-factory>
- <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
- <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
- <property name="connection.connection_string">Data Source=127.0.0.1;Initial Catalog=NMailSpool;Integrated Security=True</property>
- <property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
- <property name="hibernate.query.substitutions">true 1, false 0</property>
- </session-factory>
-</hibernate-configuration>
Added: NMail/trunk/NMail.SpoolData.NHibernate/hibernate-spool-configuration.xml
===================================================================
--- NMail/trunk/NMail.SpoolData.NHibernate/hibernate-spool-configuration.xml (rev 0)
+++ NMail/trunk/NMail.SpoolData.NHibernate/hibernate-spool-configuration.xml 2007-05-01 13:46:57 UTC (rev 188)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
+ <session-factory>
+ <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
+ <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
+ <property name="connection.connection_string">Data Source=127.0.0.1;Initial Catalog=NMailSpool;Integrated Security=True</property>
+ <property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
+ <property name="hibernate.query.substitutions">true 1, false 0</property>
+ </session-factory>
+</hibernate-configuration>
Added: NMail/trunk/NMail.UnitTests/LocalStoreData/GetSetRemoveSystemAceTest1.cs
===================================================================
--- NMail/trunk/NMail.UnitTests/LocalStoreData/GetSetRemoveSystemAceTest1.cs (rev 0)
+++ NMail/trunk/NMail.UnitTests/LocalStoreData/GetSetRemoveSystemAceTest1.cs 2007-05-01 13:46:57 UTC (rev 188)
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+using NUnit.Framework;
+
+using NMail.Configuration;
+using NMail.DataTypes.ACLs;
+using NMail.DataTypes.LocalStore;
+
+namespace NMail.UnitTests.LocalStoreData {
+ /// <summary>
+ /// Tests getting/settting/removing system ACEs.
+ /// </summary>
+ [TestFixture]
+ public class GetSetRemoveSystemAceTest1 : BaseLocalStoreDataTest {
+
+ [Test]
+ public void TestSystemAce() {
+ GenericAce<SystemPrivilege> ace1 = new GenericAce<SystemPrivilege>();
+ ace1.Identifier = "Test";
+ ace1.AceType = AcePrivilegeType.Allow;
+ ace1.Privilege = SystemPrivilege.CreateMailDomain;
+ this.localStoreData.SetSystemPrivilegeAce(ace1);
+
+ GenericAcl<SystemPrivilege> acl1 = this.localStoreData.GetSystemPrivilegeAcl();
+ Assert.IsTrue(acl1.Count > 0, "Valid ACL entry count 1.");
+ Assert.AreEqual(SystemPrivilege.CreateMailDomain, acl1["Test"].Privilege, "acl[\"Test\"].Priv == CreateMailDomain.");
+ Assert.AreEqual(AcePrivilegeType.Allow, acl1["Test"].AceType, "acl[\"Test\"].PrivType == Allow.");
+
+ this.localStoreData.RemoveSystemPrivilegeAce("Test");
+
+ GenericAcl<SystemPrivilege> acl2 = this.localStoreData.GetSystemPrivilegeAcl();
+ Assert.IsNull(acl2["Test"], "acl[\"Test\"] is null");
+ }
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|