예제 #1
0
        protected override void LoadList()
        {
            listAliases.Items.Clear();

            hMailServer.Links  links  = APICreator.Links;
            hMailServer.Domain domain = links.get_Domain(_domainID);
            Marshal.ReleaseComObject(links);

            hMailServer.Aliases aliases = domain.Aliases;
            Marshal.ReleaseComObject(domain);

            for (int i = 0; i < aliases.Count; i++)
            {
                hMailServer.Alias alias = aliases[i];

                ListViewItem item = listAliases.Items.Add(alias.Name);
                item.SubItems.Add(alias.Value);
                item.SubItems.Add(EnumStrings.GetYesNoString(alias.Active));

                item.Tag = alias.ID;

                Marshal.ReleaseComObject(alias);
            }


            Marshal.ReleaseComObject(aliases);
        }
예제 #2
0
        public void TestAliasLink()
        {
            hMailServer.Alias alias =
                SingletonProvider <Utilities> .Instance.AddAlias(_domain, "mytest", "test2");

            Assert.AreEqual(alias.Value, _links.get_Alias(alias.ID).Value);
        }
예제 #3
0
        public hMailServer.Alias AddAlias(hMailServer.Domain domain, string sName, string sValue)
        {
            hMailServer.Alias oAlias = domain.Aliases.Add();
            oAlias.Name   = sName;
            oAlias.Value  = sValue;
            oAlias.Active = true;
            oAlias.Save();

            return(oAlias);
        }
예제 #4
0
        public void TestAlias()
        {
            hMailServer.Alias oAlias = SingletonProvider <Utilities> .Instance.AddAlias(_domain, "fr'*****@*****.**", "to@t'st.com");

            if (oAlias.ID == 0)
            {
                throw new Exception("Account not properly saved");
            }

            _domain.Aliases.DeleteByDBID(oAlias.ID);
        }
예제 #5
0
        public void TestCaseInsensitivtyAlias()
        {
            hMailServer.Account testAccount = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            hMailServer.Alias testAlias = SingletonProvider <Utilities> .Instance.AddAlias(_domain, "*****@*****.**", "*****@*****.**");

            SMTPClientSimulator oSMTP = new SMTPClientSimulator();
            string upperCase          = testAlias.Name.ToUpper();

            Assert.IsTrue(oSMTP.Send("*****@*****.**", upperCase, "test mail", "test body"));

            POP3Simulator.AssertMessageCount("*****@*****.**", "test", 1);
        }
예제 #6
0
        public void OnDeleteObject(object sender, EventArgs args)
        {
            hMailServer.Links links = APICreator.Links;
            hMailServer.Alias alias = links.get_Alias(_aliasID);

            if (Utility.AskDeleteItem(alias.Name))
            {
                alias.Delete();

                Marshal.ReleaseComObject(links);
                Marshal.ReleaseComObject(alias);

                Instances.MainForm.RefreshParentNode();
            }
        }
예제 #7
0
        public bool SaveData()
        {
            bool newObject = false;

            if (representedObject == null)
            {
                hMailServer.Domain domain = APICreator.GetDomain(_domainID);

                hMailServer.Aliases aliases = domain.Aliases;
                representedObject = aliases.Add();
                newObject         = true;

                Marshal.ReleaseComObject(domain);
                Marshal.ReleaseComObject(aliases);
            }


            representedObject.Name   = textName.Text;
            representedObject.Value  = textValue.Text;
            representedObject.Active = checkEnabled.Checked;

            representedObject.Save();

            // Refresh the node in the tree if the name has changed.
            IMainForm mainForm = Instances.MainForm;

            mainForm.RefreshCurrentNode(representedObject.Name);

            // Set the object to clean.
            DirtyChecker.SetClean(this);

            if (newObject)
            {
                SearchNodeText crit = new SearchNodeText(representedObject.Name);
                mainForm.SelectNode(crit);
            }

            return(true);
        }
예제 #8
0
        public ucAlias(int domainID, int aliasID)
        {
            InitializeComponent();

            _domainID = domainID;

            hMailServer.Domain domain = APICreator.GetDomain(domainID);

            if (aliasID > 0)
            {
                hMailServer.Aliases aliases = domain.Aliases;
                representedObject = aliases.get_ItemByDBID(aliasID);
                Marshal.ReleaseComObject(aliases);
            }

            textName.Text = "@" + domain.Name;
            Marshal.ReleaseComObject(domain);

            DirtyChecker.SubscribeToChange(this, OnContentChanged);

            new TabOrderManager(this).SetTabOrder(TabOrderManager.TabScheme.AcrossFirst);
        }
예제 #9
0
        public ucAlias(int domainID, int aliasID)
        {
            InitializeComponent();

            _domainID = domainID;

            hMailServer.Domain domain = APICreator.GetDomain(domainID);

            if (aliasID > 0)
            {
                hMailServer.Aliases aliases = domain.Aliases;
                representedObject = aliases.get_ItemByDBID(aliasID);
                Marshal.ReleaseComObject(aliases);
            }

            textName.Text = "@" + domain.Name;
            Marshal.ReleaseComObject(domain);

            DirtyChecker.SubscribeToChange(this, OnContentChanged);

            new TabOrderManager(this).SetTabOrder(TabOrderManager.TabScheme.AcrossFirst);
        }
예제 #10
0
        public bool SaveData()
        {
            bool newObject = false;
            if (representedObject == null)
            {
                hMailServer.Domain domain = APICreator.GetDomain(_domainID);

                hMailServer.Aliases aliases = domain.Aliases;
                representedObject = aliases.Add();
                newObject = true;

                Marshal.ReleaseComObject(domain);
                Marshal.ReleaseComObject(aliases);
            }

            representedObject.Name = textName.Text;
            representedObject.Value = textValue.Text;
            representedObject.Active = checkEnabled.Checked;

            representedObject.Save();

            // Refresh the node in the tree if the name has changed.
            IMainForm mainForm = Instances.MainForm;
            mainForm.RefreshCurrentNode(representedObject.Name);

            // Set the object to clean.
            DirtyChecker.SetClean(this);

            if (newObject)
            {
                SearchNodeText crit = new SearchNodeText(representedObject.Name);
                mainForm.SelectNode(crit);
            }

            return true;
        }
예제 #11
0
 private void ConfirmAliasObject()
 {
     hMailServer.Alias alias = _application.Domains[0].Aliases[0];
     Assert.AreEqual("*****@*****.**", alias.Name);
     Assert.AreEqual("*****@*****.**", alias.Value);
 }
예제 #12
0
 private void SetupAliasObject(hMailServer.Domain domain)
 {
     hMailServer.Alias alias = SingletonProvider <Utilities> .Instance.AddAlias(domain, "*****@*****.**", "*****@*****.**");
 }
예제 #13
0
 internal Alias(hMailServer.Alias o)
 {
     _object = o;
 }
예제 #14
0
 internal Alias(hMailServer.Alias o)
 {
     _object = o;
 }