/// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="mailingList">Owner mailing list.</param>
        internal MailingListAclCollection(MailingList mailingList)
        {
            m_pMailingList = mailingList;
            m_pAcl         = new List<string>();

            Bind();
        }
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="mailingList">Owner mailing list.</param>
        internal MailingListMemberCollection(MailingList mailingList)
        {
            m_pMailingList = mailingList;
            m_pMembers     = new List<string>();

            Bind();
        }
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="mailingList">Owner mailing list.</param>
        internal MailingListMemberCollection(MailingList mailingList)
        {
            m_pMailingList = mailingList;
            m_pMembers     = new List <string>();

            Bind();
        }
        /// <summary>
        /// Adds new mailing list to virtual server.
        /// </summary>
        /// <param name="name">Mailing list name.</param>
        /// <param name="description">Mailing list description.</param>
        /// <param name="enabled">Specifies if mailing list is enabled.</param>
        public MailingList Add(string name, string description, bool enabled)
        {
            /* AddMailingList <virtualServerID> "<mailingListID>" "<mailingListName>" "<description>" <enabled>
             *    Responses:
             +OK
             *      -ERR <errorText>
             */

            string id = Guid.NewGuid().ToString();

            // Call TCP AddMailingList
            m_pVirtualServer.Server.TcpClient.TcpStream.WriteLine("AddMailingList " + m_pVirtualServer.VirtualServerID + " " + TextUtils.QuoteString(id) + " " + TextUtils.QuoteString(name) + " " + TextUtils.QuoteString(description) + " " + enabled);

            string response = m_pVirtualServer.Server.ReadLine();

            if (!response.ToUpper().StartsWith("+OK"))
            {
                throw new Exception(response);
            }

            MailingList mailingList = new MailingList(m_pVirtualServer, this, id, name, description, enabled);

            m_pMailingLists.Add(mailingList);
            return(mailingList);
        }
Example #5
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="mailingList">Owner mailing list.</param>
        internal MailingListAclCollection(MailingList mailingList)
        {
            m_pMailingList = mailingList;
            m_pAcl         = new List <string>();

            Bind();
        }
Example #6
0
        /// <summary>
        /// Edit constructor.
        /// </summary>
        /// <param name="serverAPI">Reference to server API.</param>
        /// <param name="mailingList">Mailing list to update.</param>
        public wfrm_MailingList(VirtualServer virtualServer,MailingList mailingList)
        {
            m_pVirtualServer = virtualServer;
            m_pMailingList   = mailingList;

            InitUI();

            LoadDomains();

            m_pMailingListName.Text = mailingList.Name.Split(new char[]{'@'})[0];
            m_pDomains.SelectedText = mailingList.Name.Split(new char[]{'@'})[1];
            m_pDescription.Text = mailingList.Description;
            m_pEnabled.Checked = mailingList.Enabled;

            LoadMembers("");
            LoadAccess("");
        }
Example #7
0
        /// <summary>
        /// Deletes specified mailing list from virtual server.
        /// </summary>
        /// <param name="mailingList"></param>
        public void Remove(MailingList mailingList)
        {
            /* DeleteMailingList <virtualServerID> "<mailingListID>"
                  Responses:
                    +OK                     
                    -ERR <errorText>
            */

            string id = Guid.NewGuid().ToString();

            // Call TCP DeleteGroup
            m_pVirtualServer.Server.TcpClient.TcpStream.WriteLine("DeleteMailingList " + m_pVirtualServer.VirtualServerID + " " + TextUtils.QuoteString(mailingList.ID));
                        
            string response = m_pVirtualServer.Server.ReadLine();
            if(!response.ToUpper().StartsWith("+OK")){
                throw new Exception(response);
            }

            m_pMailingLists.Remove(mailingList);
        }
        /// <summary>
        /// Deletes specified mailing list from virtual server.
        /// </summary>
        /// <param name="mailingList"></param>
        public void Remove(MailingList mailingList)
        {
            /* DeleteMailingList <virtualServerID> "<mailingListID>"
             *    Responses:
             +OK
             *      -ERR <errorText>
             */

            string id = Guid.NewGuid().ToString();

            // Call TCP DeleteGroup
            m_pVirtualServer.Server.TcpClient.TcpStream.WriteLine("DeleteMailingList " + m_pVirtualServer.VirtualServerID + " " + TextUtils.QuoteString(mailingList.ID));

            string response = m_pVirtualServer.Server.ReadLine();

            if (!response.ToUpper().StartsWith("+OK"))
            {
                throw new Exception(response);
            }

            m_pMailingLists.Remove(mailingList);
        }
Example #9
0
        /// <summary>
        /// Adds new mailing list to virtual server.
        /// </summary>
        /// <param name="name">Mailing list name.</param>
        /// <param name="description">Mailing list description.</param>
        /// <param name="enabled">Specifies if mailing list is enabled.</param>
        public MailingList Add(string name,string description,bool enabled)
        {
            /* AddMailingList <virtualServerID> "<mailingListID>" "<mailingListName>" "<description>" <enabled>
                  Responses:
                    +OK                     
                    -ERR <errorText>
            */

            string id = Guid.NewGuid().ToString();

            // Call TCP AddMailingList
            m_pVirtualServer.Server.TcpClient.TcpStream.WriteLine("AddMailingList " + m_pVirtualServer.VirtualServerID + " " + TextUtils.QuoteString(id) + " " + TextUtils.QuoteString(name) + " " + TextUtils.QuoteString(description) + " " + enabled);
                        
            string response = m_pVirtualServer.Server.ReadLine();
            if(!response.ToUpper().StartsWith("+OK")){
                throw new Exception(response);
            }

            MailingList mailingList = new MailingList(m_pVirtualServer,this,id,name,description,enabled);
            m_pMailingLists.Add(mailingList);
            return mailingList;
        }
Example #10
0
        /// <summary>
        /// Adds or updates mailing list as needed. Returns true if operation was successful.
        /// </summary>
        private bool AddOrUpdate()
        {
            //--- Validate values ----------------------------------------------//
            if(m_pMailingListName.Text == ""){
                MessageBox.Show(this,"Please fill mailing list name !","Error:",MessageBoxButtons.OK,MessageBoxIcon.Error);
                return false;
            }
            if(m_pDomains.SelectedIndex == -1){
                MessageBox.Show(this,"Please choose domain !","Error:",MessageBoxButtons.OK,MessageBoxIcon.Error);
                return false;
            }
            //------------------------------------------------------------------//
            
            // Add new mailing list
            if(m_pMailingList == null){
                m_pMailingList = m_pVirtualServer.MailingLists.Add(
                    m_pMailingListName.Text + "@" + m_pDomains.SelectedItem.ToString(),
                    m_pDescription.Text,
                    m_pEnabled.Checked                  
                );
            }
            // Update mailing list
            else{
                m_pMailingList.Enabled = m_pEnabled.Checked;
                m_pMailingList.Name = m_pMailingListName.Text + "@" + m_pDomains.SelectedItem.ToString();
                m_pMailingList.Description = m_pDescription.Text;
                m_pMailingList.Commit();
            }

            return true;
        }