Inheritance: ISearchNodeCriteria
Exemple #1
0
        public static void RefreshNode(string name)
        {
            // Refresh the node in the tree if the name has changed.
             IMainForm mainForm = Instances.MainForm;
             mainForm.RefreshCurrentNode(name);

             SearchNodeText crit = new SearchNodeText(name);
             mainForm.SelectNode(crit);
        }
        private void listObjects_DoubleClick(object sender, EventArgs e)
        {
            if (listObjects.SelectedItems.Count == 0)
             return;

              string name = listObjects.SelectedItems[0].Text;
              IMainForm mainForm = Instances.MainForm;
              SearchNodeText crit = new SearchNodeText(name);
              mainForm.SelectNode(crit);
        }
Exemple #3
0
        public bool SaveData()
        {
            bool newObject = false;
             if (_representedObject == null)
             {
            hMailServer.Application app = APICreator.Application;
            hMailServer.Settings settings = app.Settings;
            hMailServer.SecurityRanges securityRanges = settings.SecurityRanges;
            _representedObject = securityRanges.Add();

            newObject = true;

            Marshal.ReleaseComObject(settings);
            Marshal.ReleaseComObject(securityRanges);
             }

             _representedObject.Name = textName.Text;
             _representedObject.Priority= textPriority.Number;

             _representedObject.LowerIP = textLowerIPAddress.Text;
             _representedObject.UpperIP = textUpperIPAddress.Text;

             _representedObject.AllowSMTPConnections = checkAllowSMTP.Checked;
             _representedObject.AllowPOP3Connections = checkAllowPOP3.Checked;
             _representedObject.AllowIMAPConnections = checkAllowIMAP.Checked;

             _representedObject.RequireSMTPAuthLocalToLocal = checkRequireSMTPAuthLocalToLocal.Checked;
             _representedObject.RequireSMTPAuthLocalToExternal = checkRequireSMTPAuthLocalToExternal.Checked;
             _representedObject.RequireSMTPAuthExternalToLocal = checkRequireSMTPAuthExternalToLocal.Checked;
             _representedObject.RequireSMTPAuthExternalToExternal = checkRequireSMTPAuthExternalToExternal.Checked;

             _representedObject.AllowDeliveryFromLocalToLocal = checkAllowDeliveiesFromL2L.Checked;
             _representedObject.AllowDeliveryFromLocalToRemote = checkAllowDeliveiesFromL2R.Checked;
             _representedObject.AllowDeliveryFromRemoteToLocal = checkAllowDeliveiesFromR2L.Checked;
             _representedObject.AllowDeliveryFromRemoteToRemote = checkAllowDeliveiesFromR2R.Checked;

             _representedObject.EnableSpamProtection = checkSpamProtection.Checked;
             _representedObject.EnableAntiVirus = checkAntiVirus.Checked;

             _representedObject.Expires = checkExpires.Checked;
             _representedObject.ExpiresTime = dateTimeExpiresTime.Value;

             try
             {
            _representedObject.Save();
             }
             catch (Exception e)
             {
            MessageBox.Show(e.Message, EnumStrings.hMailServerAdministrator, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            return false;
             }

             // Refresh the node in the tree if the name has changed.
             IMainForm mainForm = Instances.MainForm;
             mainForm.RefreshCurrentNode(checkExpires.Checked ? Color.Red : Color.Black, textName.Text);

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

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

             return true;
        }
Exemple #4
0
        public bool SaveData()
        {
            bool newObject = false;
             if (_representedObject == null)
             {
            hMailServer.Settings settings = APICreator.Application.Settings;
            hMailServer.AntiSpam antiSpam = settings.AntiSpam;
            hMailServer.DNSBlackLists dnsBlackLists = antiSpam.DNSBlackLists;

            _representedObject = dnsBlackLists.Add();
            newObject = true;

            Marshal.ReleaseComObject(settings);
            Marshal.ReleaseComObject(antiSpam);
            Marshal.ReleaseComObject(dnsBlackLists);
             }

             _representedObject.Active = checkEnabled.Checked;

             _representedObject.DNSHost = textDNSHost.Text;
             _representedObject.ExpectedResult = textExpectedResult.Text;
             _representedObject.RejectMessage = textRejectionMessage.Text;
             _representedObject.Score = textSpamScore.Number;

             _representedObject.Save();

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

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

             if (newObject)
             {
            SearchNodeText crit = new SearchNodeText(_representedObject.DNSHost);
            mainForm.SelectNode(crit);
             }

             return true;
        }
        public bool SaveData()
        {
            bool newObject = false;
            if (representedObject == null)
            {
                hMailServer.Domain domain = APICreator.GetDomain(_domainID);

                hMailServer.DistributionLists lists = domain.DistributionLists;
                representedObject = lists.Add();
                newObject = true;

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

            representedObject.Address = textAddress.Text;
            representedObject.Active = checkEnabled.Checked;

            if (radioModePublic.Checked)
                representedObject.Mode = eDistributionListMode.eLMPublic;

            if (radioModeMembership.Checked)
                representedObject.Mode = eDistributionListMode.eLMMembership;

            if (optModeAnnouncements.Checked)
                representedObject.Mode = eDistributionListMode.eLMAnnouncement;

            representedObject.RequireSenderAddress = textRequireAddress.Text;
            representedObject.RequireSMTPAuth = checkRequireSMTPAuthentication.Checked;

            representedObject.Save();

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

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

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

            EnableDisableTabs();

            return true;
        }
Exemple #6
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;
        }
Exemple #7
0
        public bool SaveData()
        {
            if (_domain == null)
            {
                hMailServer.Domains domains = _application.Domains;
                _domain = domains.Add();
                Marshal.ReleaseComObject(domains);
            }

            _domain.Name = textDomainName.Text;
            _domain.Postmaster = textCatchAllAddress.Text;
            _domain.AddSignaturesToReplies = checkAddSignaturesToReplies.Checked;
            _domain.AddSignaturesToLocalMail = checkAddSignaturesToLocalMail.Checked;
            _domain.SignatureEnabled = checkSignatureEnabled.Checked;
            _domain.Active = checkEnabled.Checked;

            if (radioSMAppendToAccountSignature.Checked == true)
                _domain.SignatureMethod = eDomainSignatureMethod.eSMAppendToAccountSignature;
            else if (radioSMOverwriteAccountSignature.Checked == true)
                _domain.SignatureMethod = eDomainSignatureMethod.eSMOverwriteAccountSignature;
            else if (radioSMSetIfNotSpecifiedInAccount.Checked == true)
                _domain.SignatureMethod = eDomainSignatureMethod.eSMSetIfNotSpecifiedInAccount;

            _domain.MaxSize = textMaxSize.Number;
            _domain.MaxMessageSize = textMaxMessageSize.Number;
            _domain.MaxAccountSize = textMaxAccountSize.Number;
            _domain.MaxNumberOfAccounts = textMaxNumberOfAccounts.Number;
            _domain.MaxNumberOfAliases = textMaxNumberOfAliases.Number;
            _domain.MaxNumberOfDistributionLists = textMaxNumberOfDistributionLists.Number;

            _domain.MaxNumberOfAccountsEnabled = checkMaxNumberOfAccountsEnabled.Checked;
            _domain.MaxNumberOfAliasesEnabled = checkMaxNumberOfAliasesEnabled.Checked;
            _domain.MaxNumberOfDistributionListsEnabled = checkMaxNumberOfDistributionListsEnabled.Checked;

            _domain.SignaturePlainText = textPlainTextSignature.Text;
            _domain.SignatureHTML = textHTMLSignature.Text;

            _domain.PlusAddressingEnabled = checkUsePlusAddressing.Checked;
            _domain.PlusAddressingCharacter = comboPlusAddressingCharacter.Text;
            _domain.AntiSpamEnableGreylisting = checkGreyListingEnabled.Checked;

            _domain.DKIMSignEnabled = checkDKIMSignEnabled.Checked;
            _domain.DKIMPrivateKeyFile = textDKIMPrivateKeyFile.Text;
            _domain.DKIMSelector = textDKIMSelector.Text;

            if (radioDKIMHeaderMethodSimple.Checked)
                _domain.DKIMHeaderCanonicalizationMethod = eDKIMCanonicalizationMethod.eCanonicalizationSimple;
            else if (radioDKIMHeaderMethodRelaxed.Checked)
                _domain.DKIMHeaderCanonicalizationMethod = eDKIMCanonicalizationMethod.eCanonicalizationRelaxed;

            if (radioDKIMBodyMethodSimple.Checked)
                _domain.DKIMBodyCanonicalizationMethod = eDKIMCanonicalizationMethod.eCanonicalizationSimple;
            else if (radioDKIMBodyMethodRelaxed.Checked)
                _domain.DKIMBodyCanonicalizationMethod = eDKIMCanonicalizationMethod.eCanonicalizationRelaxed;

            if (radioDKIMSigningAlgorithmSHA1.Checked)
                _domain.DKIMSigningAlgorithm = eDKIMAlgorithm.eSHA1;
            else if (radioDKIMSigningAlgorithmSHA256.Checked)
                _domain.DKIMSigningAlgorithm = eDKIMAlgorithm.eSHA256;

            try
            {
                _domain.Save();
            }
            catch (Exception ex)
            {
                MessageBox.Show(Strings.Localize(ex.Message), EnumStrings.hMailServerAdministrator, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }

            IMainForm mainForm = Instances.MainForm;

            // Refresh the node in the tree
            mainForm.RefreshCurrentNode(_domain.Name);

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

            SearchNodeText crit = new SearchNodeText(_domain.Name);
            mainForm.SelectNode(crit);

            EnableDisableTabs();

            return true;
        }
Exemple #8
0
        private void EditSelectedItem()
        {
            ListView listView = GetListView();
            if (listView == null)
                return;

            if (listView.SelectedItems.Count == 0)
                return;

            string text = listView.SelectedItems[0].Text;

            // Jump to the sub node.
            IMainForm mainForm = Instances.MainForm;
            SearchNodeText crit = new SearchNodeText(text);
            mainForm.SelectNode(crit);
        }
        public bool SaveData()
        {
            bool newObject = false;
            if (_representedObject == null)
            {
                hMailServer.SURBLServers surblServers = APICreator.SURBLServers;
                _representedObject = surblServers.Add();
                newObject = true;

                Marshal.ReleaseComObject(surblServers);
            }

            _representedObject.Active = checkEnabled.Checked;

            _representedObject.DNSHost = textDNSHost.Text;
            _representedObject.RejectMessage = textRejectionMessage.Text;
            _representedObject.Score = textSpamScore.Number;

            _representedObject.Save();

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

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

            if (newObject)
            {
                SearchNodeText crit = new SearchNodeText(_representedObject.DNSHost);
                mainForm.SelectNode(crit);
            }

            return true;
        }
Exemple #10
0
        public bool SaveData()
        {
            if (!ValidateForm())
            {
                return false;
            }

            bool newAccount = false;

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

                hMailServer.Accounts accounts = domain.Accounts;
                _representedAccount = accounts.Add();

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

            if (_representedAccount.ID == 0)
                newAccount = true;

            _representedAccount.Address = textAddress.Text;
            _representedAccount.MaxSize = textMaxSize.Number;
            _representedAccount.Active = checkEnabled.Checked;

            _representedAccount.VacationMessageIsOn = checkVacationMessageEnable.Checked;
            _representedAccount.VacationSubject = textVacationMessageSubject.Text;
            _representedAccount.VacationMessage = textVacationMessageText.Text;
            _representedAccount.VacationMessageExpires = checkVacationMessageExpires.Checked;
            _representedAccount.VacationMessageExpiresDate = dateVacationMessageExpiresDate.FormattedValue;

            _representedAccount.ForwardEnabled = checkForwardEnabled.Checked;
            _representedAccount.ForwardAddress = textForwardAddress.Text;
            _representedAccount.ForwardKeepOriginal = checkForwardKeepOriginal.Checked;

            _representedAccount.SignatureEnabled = checkSignatureEnabled.Checked;
            _representedAccount.SignaturePlainText = textSignaturePlainText.Text;
            _representedAccount.SignatureHTML = textSignatureHTML.Text;

            _representedAccount.IsAD = checkAccountIsAD.Checked;
            _representedAccount.ADDomain = textADDomain.Text;
            _representedAccount.ADUsername = textADUsername.Text;

            _representedAccount.PersonFirstName = textFirstName.Text;
            _representedAccount.PersonLastName = textLastName.Text;
            _representedAccount.AdminLevel = (hMailServer.eAdminLevel)comboAdministrationLevel.SelectedValue;

            if (textPassword.Dirty)
                _representedAccount.Password = textPassword.Password;

            _representedAccount.Save();

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

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

            if (newAccount)
            {
                SearchNodeText crit = new SearchNodeText(_representedAccount.Address);
                mainForm.SelectNode(crit);
            }
            else
                EnableDisable();

            return true;
        }
        public bool SaveData()
        {
            bool newObject = false;
            if (_representedObject == null)
            {
                hMailServer.Application app = APICreator.Application;
                hMailServer.Settings settings = app.Settings;
                hMailServer.IncomingRelays IncomingRelays = settings.IncomingRelays;
                _representedObject = IncomingRelays.Add();

                newObject = true;

                Marshal.ReleaseComObject(settings);
                Marshal.ReleaseComObject(IncomingRelays);
            }

            _representedObject.Name = textName.Text;

            _representedObject.LowerIP = textLower.Text;
            _representedObject.UpperIP = textUpper.Text;

            _representedObject.Save();

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

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

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

            return true;
        }
        public bool SaveData()
        {
            bool newObject = false;
            if (_representedObject == null)
            {
                hMailServer.Settings settings = APICreator.Application.Settings;
                hMailServer.SSLCertificates sslCertificates = settings.SSLCertificates;

                _representedObject = sslCertificates.Add();

                Marshal.ReleaseComObject(settings);
                Marshal.ReleaseComObject(sslCertificates);

                newObject = true;
            }

            _representedObject.Name = textName.Text;

            _representedObject.CertificateFile = textCertificateFile.Text;
            _representedObject.PrivateKeyFile = textPrivateKeyFile.Text;

            _representedObject.Save();

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

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

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

            return true;
        }
Exemple #13
0
        public bool SaveData()
        {
            bool newObject = false;
            if (representedObject == null)
            {
                hMailServer.Settings settings = APICreator.Application.Settings;
                hMailServer.Groups groups = settings.Groups;
                representedObject = groups.Add();

                Marshal.ReleaseComObject(settings);
                Marshal.ReleaseComObject(groups);

                newObject = true;
            }

            representedObject.Name = textName.Text;

            representedObject.Save();

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

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

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

            EnableDisable();

            return true;
        }